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
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
00241
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