libkmid Library API Documentation

deviceman.h

00001 /*  deviceman.h  - The device manager, that hides the use of midiOut
00002     This file is part of LibKMid 0.9.5
00003     Copyright (C) 1997,98,99,2000  Antonio Larrosa Jimenez
00004     LibKMid's homepage : http://www.arrakis.es/~rlarrosa/libkmid.html
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018     Boston, MA 02111-1307, USA.
00019 
00020     Send comments and bug fixes to Antonio Larrosa <larrosa@kde.org>
00021 
00022 ***************************************************************************/
00023 #ifndef DEVICEMAN_H
00024 #define DEVICEMAN_H
00025 
00026 #include <libkmid/dattypes.h>
00027 
00028 class MidiOut;
00029 class MidiMapper;
00030 
00046 class DeviceManager
00047 {
00048   protected:
00049 
00054     MidiOut **device;
00055 
00060     struct midi_info *midiinfo;
00061 
00066     struct synth_info *synthinfo;
00067 
00072     int chn2dev[16];
00073 
00078     int n_synths;
00079 
00084     int n_midi;
00085 
00090     int n_total;
00091 
00096     int m_rate;
00097 
00102     double convertrate;
00103 
00108     int timerstarted;
00109 
00114     double lastwaittime;
00115 
00122     MidiMapper *mapper_tmp;
00123 
00124     int initialized;
00125 
00130     int seqfd;
00131 
00136     int default_dev;
00137 
00141     int _ok;
00142 
00147     bool alsa;
00148 
00152     void seqbuf_dump (void);
00153 
00157     void seqbuf_clean (void);
00158 
00162     void checkAlsa (void);
00163   public:
00171     DeviceManager(int def=-1);
00172 
00177     ~DeviceManager(void);
00178 
00190     int initManager(void);
00191 
00199     int checkInit(void);
00200 
00205     MidiOut *chntodev(int chn)
00206                 { return deviceForChannel(chn); };
00207 
00216     MidiOut *deviceForChannel(int chn)
00217                 { return (device!=0L) ? device[chn2dev[chn]] : 0L ; };
00218 
00222     int deviceNumberForChannel(int chn) { return chn2dev[chn]; };
00223 
00227     void setDeviceNumberForChannel(int chn, int dev);
00228 
00233     int ok(void);
00234 
00238     int usingAlsa(void) { return alsa; };
00239 
00240     // The following funtion are here to emulate a midi, so that the
00241     // DeviceManager sends the events to the appropiate devices.
00242 
00254     void openDev        (void);
00255 
00261     void closeDev       (void);
00262 
00268     void initDev        (void);
00269 
00279     void noteOn         ( uchar chn, uchar note, uchar vel );
00280 
00291     void noteOff        ( uchar chn, uchar note, uchar vel );
00292 
00301     void keyPressure    ( uchar chn, uchar note, uchar vel );
00302 
00311     void chnPatchChange ( uchar chn, uchar patch );
00312 
00320     void chnPressure    ( uchar chn, uchar vel );
00321 
00331     void chnPitchBender ( uchar chn, uchar lsb,  uchar msb );
00332 
00346     void chnController  ( uchar chn, uchar ctl , uchar v );
00347 
00360     void sysEx          ( uchar *data,ulong size);
00361 
00367     void wait (double ms);
00368 
00373      void tmrSetTempo(int v);
00374 
00378     void tmrStart(long int tpcn);
00379 
00384     void tmrStop(void);
00385 
00390     void tmrContinue(void);
00391 
00395     void allNotesOff(void);
00396 
00407     void sync(bool f=0);
00408 
00419     void setVolumePercentage(int i);
00420 
00427     int defaultDevice(void);
00428 
00438     void setDefaultDevice(int i);
00439 
00468     int setPatchesToUse(int *patchesused);
00469 
00476     const char *midiMapFilename(void);
00477 
00486     void setMidiMap(MidiMapper *map);
00487 
00491     int rate(void) { return m_rate; };
00492 
00502     int midiPorts(void) { return n_midi; };
00503 
00513     int synthDevices(void) { return n_synths; };
00514 
00521     const char *name(int i);
00522 
00528     const char *type(int i);
00529 
00530   private:
00531     class DeviceManagerPrivate;
00532     DeviceManagerPrivate *d;
00533 };
00534 
00535 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:28:28 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001