deviceman.h
/* deviceman.h - The device manager, that hides the use of midiOut
This file is part of LibKMid 0.9.5
Copyright (C) 1997,98,99,2000 Antonio Larrosa Jimenez
LibKMid's homepage : http://www.arrakis.es/~rlarrosa/libkmid.html
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
Send comments and bug fixes to Antonio Larrosa <larrosa@kde.org>
***************************************************************************/
#ifndef DEVICEMAN_H
#define DEVICEMAN_H
#include <libkmid/dattypes.h>
#include <kdelibs_export.h>
class MidiOut;
class MidiMapper;
class KMID_EXPORT DeviceManager
{
protected:
MidiOut **device;
struct midi_info *midiinfo;
struct synth_info *synthinfo;
int chn2dev[16];
int n_synths;
int n_midi;
int n_total;
int m_rate;
double convertrate;
int timerstarted;
double lastwaittime;
MidiMapper *mapper_tmp;
int initialized;
int seqfd;
int default_dev;
int _ok;
bool alsa;
void seqbuf_dump (void);
void seqbuf_clean (void);
void checkAlsa (void);
public:
DeviceManager(int def=-1);
~DeviceManager(void);
int initManager(void);
int checkInit(void);
MidiOut *chntodev(int chn)
{ return deviceForChannel(chn); }
MidiOut *deviceForChannel(int chn)
{ return (device!=0L) ? device[chn2dev[chn]] : 0L ; }
int deviceNumberForChannel(int chn) { return chn2dev[chn]; }
void setDeviceNumberForChannel(int chn, int dev);
int ok(void);
int usingAlsa(void) { return alsa; }
// The following function are here to emulate a midi, so that the
// DeviceManager sends the events to the appropriate devices.
void openDev (void);
void closeDev (void);
void initDev (void);
void noteOn ( uchar chn, uchar note, uchar vel );
void noteOff ( uchar chn, uchar note, uchar vel );
void keyPressure ( uchar chn, uchar note, uchar vel );
void chnPatchChange ( uchar chn, uchar patch );
void chnPressure ( uchar chn, uchar vel );
void chnPitchBender ( uchar chn, uchar lsb, uchar msb );
void chnController ( uchar chn, uchar ctl , uchar v );
void sysEx ( uchar *data,ulong size);
void wait (double ms);
void tmrSetTempo(int v);
void tmrStart(long int tpcn);
void tmrStop(void);
void tmrContinue(void);
void allNotesOff(void);
void sync(bool f=0);
void setVolumePercentage(int i);
int defaultDevice(void);
void setDefaultDevice(int i);
int setPatchesToUse(int *patchesused);
const char *midiMapFilename(void);
void setMidiMap(MidiMapper *map);
int rate(void) { return m_rate; }
int midiPorts(void) { return n_midi; }
int synthDevices(void) { return n_synths; }
const char *name(int i);
const char *type(int i);
private:
class DeviceManagerPrivate;
DeviceManagerPrivate *d;
};
#endif
DeviceManager::synthDevices
int synthDevices(void)
Returns the number of internal synthesizers available on the system.
Definition: deviceman.h:515
DeviceManager::deviceNumberForChannel
int deviceNumberForChannel(int chn)
Returns the device number associated with a given channel.
Definition: deviceman.h:223
DeviceManager::midiPorts
int midiPorts(void)
Returns the number of MIDI ports available on the system.
Definition: deviceman.h:504
MidiOut
External MIDI port output class .
Definition: midiout.h:51
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
MidiMapper
A Midi Mapper class which defines the way MIDI events are translated (or "mapped") to different ones...
Definition: midimapper.h:59
DeviceManager::rate
int rate(void)
Returns the SNDCTL_SEQ_CTRLRATE ioctl value.
Definition: deviceman.h:493
DeviceManager
MIDI Device Manager class .
Definition: deviceman.h:47
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

KDE Home | KDE Accessibility Home | Description of Access Keys