00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
#ifndef DEVICEMAN_H
00024
#define DEVICEMAN_H
00025
00026
#include <libkmid/dattypes.h>
00027
#include <kdelibs_export.h>
00028
00029
class MidiOut;
00030
class MidiMapper;
00031
00047 class KMID_EXPORT DeviceManager
00048 {
00049
protected:
00050
00055
MidiOut **device;
00056
00061
struct midi_info *midiinfo;
00062
00067
struct synth_info *synthinfo;
00068
00073
int chn2dev[16];
00074
00079
int n_synths;
00080
00085
int n_midi;
00086
00091
int n_total;
00092
00097
int m_rate;
00098
00103
double convertrate;
00104
00109
int timerstarted;
00110
00115
double lastwaittime;
00116
00123
MidiMapper *mapper_tmp;
00124
00125
int initialized;
00126
00131
int seqfd;
00132
00137
int default_dev;
00138
00142
int _ok;
00143
00148
bool alsa;
00149
00153
void seqbuf_dump (
void);
00154
00158
void seqbuf_clean (
void);
00159
00163
void checkAlsa (
void);
00164
public:
00172 DeviceManager(
int def=-1);
00173
00178 ~DeviceManager(
void);
00179
00191
int initManager(
void);
00192
00200
int checkInit(
void);
00201
00206 MidiOut *chntodev(
int chn)
00207 {
return deviceForChannel(chn); };
00208
00217 MidiOut *deviceForChannel(
int chn)
00218 {
return (device!=0L) ? device[chn2dev[chn]] : 0L ; };
00219
00223 int deviceNumberForChannel(
int chn) {
return chn2dev[chn]; };
00224
00228
void setDeviceNumberForChannel(
int chn,
int dev);
00229
00234
int ok(
void);
00235
00239 int usingAlsa(
void) {
return alsa; };
00240
00241
00242
00243
00255
void openDev (
void);
00256
00262
void closeDev (
void);
00263
00269
void initDev (
void);
00270
00280
void noteOn ( uchar chn, uchar note, uchar vel );
00281
00292
void noteOff ( uchar chn, uchar note, uchar vel );
00293
00302
void keyPressure ( uchar chn, uchar note, uchar vel );
00303
00312
void chnPatchChange ( uchar chn, uchar patch );
00313
00321
void chnPressure ( uchar chn, uchar vel );
00322
00333
void chnPitchBender ( uchar chn, uchar lsb, uchar msb );
00334
00348
void chnController ( uchar chn, uchar ctl , uchar v );
00349
00362
void sysEx ( uchar *data,ulong size);
00363
00369
void wait (
double ms);
00370
00375
void tmrSetTempo(
int v);
00376
00380
void tmrStart(
long int tpcn);
00381
00386
void tmrStop(
void);
00387
00392
void tmrContinue(
void);
00393
00397
void allNotesOff(
void);
00398
00409
void sync(
bool f=0);
00410
00421
void setVolumePercentage(
int i);
00422
00429
int defaultDevice(
void);
00430
00440
void setDefaultDevice(
int i);
00441
00470
int setPatchesToUse(
int *patchesused);
00471
00478
const char *midiMapFilename(
void);
00479
00488
void setMidiMap(
MidiMapper *map);
00489
00493 int rate(
void) {
return m_rate; };
00494
00504 int midiPorts(
void) {
return n_midi; };
00505
00515 int synthDevices(
void) {
return n_synths; };
00516
00523
const char *name(
int i);
00524
00530
const char *type(
int i);
00531
00532
private:
00533
class DeviceManagerPrivate;
00534 DeviceManagerPrivate *d;
00535 };
00536
00537
#endif