00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "config.h"
00026
00027
00028 #ifdef USE_ALSA_SEQ
00029
00030
00031 #ifndef ALSA_MIDI_DRIVER_H
00032 #define ALSA_MIDI_DRIVER_H
00033
00034 #include <alsa/asoundlib.h>
00035 #include <string>
00036 #include <vector>
00037 using std::string;
00038 using std::vector;
00039
00040 #include "Object.h"
00041 #include "Hydrogen.h"
00042 #include "Song.h"
00043
00044 class MidiPortInfo
00045 {
00046 public:
00047 string name;
00048 int client;
00049 int port;
00050 };
00051
00056 class AlsaMidiDriver : public Object
00057 {
00058 public:
00059 virtual string getClassName() { return "AlsaMidiDriver"; }
00060
00061 AlsaMidiDriver();
00062 ~AlsaMidiDriver();
00063
00064 void open();
00065 void close();
00066 void setActive(bool isActive) { this->active = isActive; }
00067 void midi_action(snd_seq_t *seq_handle);
00068 vector<MidiPortInfo> listAlsaOutputPorts();
00069
00070 private:
00071 bool active;
00072 void noteOnEvent( snd_seq_event_t* ev );
00073 void noteOffEvent( snd_seq_event_t* ev );
00074 void controllerEvent( snd_seq_event_t* ev );
00075 void sysexEvent( unsigned char *midiBuffer, int nBytes );
00076 void playEvent();
00077 void stopEvent();
00078
00079 void midiDump( unsigned char *buffer, int bufSize );
00080 };
00081
00082
00083 #endif // USE_ALSA_SEQ
00084
00085 #endif