• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • libtdemid
 

libtdemid

  • libtdemid
deviceman.h
1 /* deviceman.h - The device manager, that hides the use of midiOut
2  This file is part of LibKMid 0.9.5
3  Copyright (C) 1997,98,99,2000 Antonio Larrosa Jimenez
4  LibKMid's homepage : http://www.arrakis.es/~rlarrosa/libtdemid.html
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 
20  Send comments and bug fixes to Antonio Larrosa <larrosa@kde.org>
21 
22 ***************************************************************************/
23 #ifndef DEVICEMAN_H
24 #define DEVICEMAN_H
25 
26 #include <libtdemid/dattypes.h>
27 #include <tdelibs_export.h>
28 
29 class MidiOut;
30 class MidiMapper;
31 
47 class KMID_EXPORT DeviceManager
48 {
49  protected:
50 
55  MidiOut **device;
56 
61  struct midi_info *midiinfo;
62 
67  struct synth_info *synthinfo;
68 
73  int chn2dev[16];
74 
79  int n_synths;
80 
85  int n_midi;
86 
91  int n_total;
92 
97  int m_rate;
98 
103  double convertrate;
104 
109  int timerstarted;
110 
115  double lastwaittime;
116 
123  MidiMapper *mapper_tmp;
124 
125  int initialized;
126 
131  int seqfd;
132 
137  int default_dev;
138 
142  int _ok;
143 
148  bool alsa;
149 
153  void seqbuf_dump (void);
154 
158  void seqbuf_clean (void);
159 
163  void checkAlsa (void);
164  public:
172  DeviceManager(int def=-1);
173 
178  ~DeviceManager(void);
179 
191  int initManager(void);
192 
200  int checkInit(void);
201 
206  MidiOut *chntodev(int chn)
207  { return deviceForChannel(chn); }
208 
217  MidiOut *deviceForChannel(int chn)
218  { return (device!=0L) ? device[chn2dev[chn]] : 0L ; }
219 
223  int deviceNumberForChannel(int chn) { return chn2dev[chn]; }
224 
228  void setDeviceNumberForChannel(int chn, int dev);
229 
234  int ok(void);
235 
239  int usingAlsa(void) { return alsa; }
240 
241  // The following function are here to emulate a midi, so that the
242  // DeviceManager sends the events to the appropriate devices.
243 
255  void openDev (void);
256 
262  void closeDev (void);
263 
269  void initDev (void);
270 
280  void noteOn ( uchar chn, uchar note, uchar vel );
281 
292  void noteOff ( uchar chn, uchar note, uchar vel );
293 
302  void keyPressure ( uchar chn, uchar note, uchar vel );
303 
312  void chnPatchChange ( uchar chn, uchar patch );
313 
321  void chnPressure ( uchar chn, uchar vel );
322 
333  void chnPitchBender ( uchar chn, uchar lsb, uchar msb );
334 
348  void chnController ( uchar chn, uchar ctl , uchar v );
349 
362  void sysEx ( uchar *data,ulong size);
363 
369  void wait (double ms);
370 
375  void tmrSetTempo(int v);
376 
380  void tmrStart(long int tpcn);
381 
386  void tmrStop(void);
387 
392  void tmrContinue(void);
393 
397  void allNotesOff(void);
398 
409  void sync(bool f=0);
410 
421  void setVolumePercentage(int i);
422 
429  int defaultDevice(void);
430 
440  void setDefaultDevice(int i);
441 
470  int setPatchesToUse(int *patchesused);
471 
478  const char *midiMapFilename(void);
479 
488  void setMidiMap(MidiMapper *map);
489 
493  int rate(void) { return m_rate; }
494 
504  int midiPorts(void) { return n_midi; }
505 
515  int synthDevices(void) { return n_synths; }
516 
523  const char *name(int i);
524 
530  const char *type(int i);
531 
532  private:
533  class DeviceManagerPrivate;
534  DeviceManagerPrivate *d;
535 };
536 
537 #endif
DeviceManager
MIDI Device Manager class .
Definition: deviceman.h:48
DeviceManager::rate
int rate(void)
Returns the SNDCTL_SEQ_CTRLRATE ioctl value.
Definition: deviceman.h:493
DeviceManager::deviceForChannel
MidiOut * deviceForChannel(int chn)
It's possible to send different MIDI channels to different MIDI devices, so that you can for example ...
Definition: deviceman.h:217
DeviceManager::midiPorts
int midiPorts(void)
Returns the number of MIDI ports available on the system.
Definition: deviceman.h:504
DeviceManager::chntodev
MidiOut * chntodev(int chn)
Definition: deviceman.h:206
DeviceManager::usingAlsa
int usingAlsa(void)
Returns true if it's running ALSA and false if OSS is being run.
Definition: deviceman.h:239
DeviceManager::deviceNumberForChannel
int deviceNumberForChannel(int chn)
Returns the device number associated with a given channel.
Definition: deviceman.h:223
DeviceManager::synthDevices
int synthDevices(void)
Returns the number of internal synthesizers available on the system.
Definition: deviceman.h:515
MidiMapper
A Midi Mapper class which defines the way MIDI events are translated (or "mapped") to different ones.
Definition: midimapper.h:60
MidiOut
External MIDI port output class .
Definition: midiout.h:52

libtdemid

Skip menu "libtdemid"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

libtdemid

Skip menu "libtdemid"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for libtdemid by doxygen 1.9.1
This website is maintained by Timothy Pearson.