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 function are here to emulate a midi, so that the 00241 // DeviceManager sends the events to the appropriate 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 00332 void chnPitchBender ( uchar chn, uchar lsb, uchar msb ); 00333 00347 void chnController ( uchar chn, uchar ctl , uchar v ); 00348 00361 void sysEx ( uchar *data,ulong size); 00362 00368 void wait (double ms); 00369 00374 void tmrSetTempo(int v); 00375 00379 void tmrStart(long int tpcn); 00380 00385 void tmrStop(void); 00386 00391 void tmrContinue(void); 00392 00396 void allNotesOff(void); 00397 00408 void sync(bool f=0); 00409 00420 void setVolumePercentage(int i); 00421 00428 int defaultDevice(void); 00429 00439 void setDefaultDevice(int i); 00440 00469 int setPatchesToUse(int *patchesused); 00470 00477 const char *midiMapFilename(void); 00478 00487 void setMidiMap(MidiMapper *map); 00488 00492 int rate(void) { return m_rate; }; 00493 00503 int midiPorts(void) { return n_midi; }; 00504 00514 int synthDevices(void) { return n_synths; }; 00515 00522 const char *name(int i); 00523 00529 const char *type(int i); 00530 00531 private: 00532 class DeviceManagerPrivate; 00533 DeviceManagerPrivate *d; 00534 }; 00535 00536 #endif
KDE Logo
This file is part of the documentation for libkmid Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Oct 10 18:55:46 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003