1 2 #ifndef _MIDI_PORT_H 3 #define _MIDI_PORT_H 4 5 #include <Midi.h> 6 7 class BMidiPort : public BMidi 8 { 9 public: 10 11 BMidiPort(const char* name = NULL); 12 ~BMidiPort(); 13 14 status_t InitCheck() const; 15 status_t Open(const char* name); 16 void Close(); 17 18 const char* PortName() const; 19 20 virtual void NoteOff( 21 uchar channel, uchar note, uchar velocity, uint32 time = B_NOW); 22 23 virtual void NoteOn( 24 uchar channel, uchar note, uchar velocity, uint32 time = B_NOW); 25 26 virtual void KeyPressure( 27 uchar channel, uchar note, uchar pressure, uint32 time = B_NOW); 28 29 virtual void ControlChange( 30 uchar channel, uchar controlNumber, uchar controlValue, 31 uint32 time = B_NOW); 32 33 virtual void ProgramChange( 34 uchar channel, uchar programNumber, uint32 time = B_NOW); 35 36 virtual void ChannelPressure( 37 uchar channel, uchar pressure, uint32 time = B_NOW); 38 39 virtual void PitchBend( 40 uchar channel, uchar lsb, uchar msb, uint32 time = B_NOW); 41 42 virtual void SystemExclusive( 43 void* data, size_t length, uint32 time = B_NOW); 44 45 virtual void SystemCommon( 46 uchar status, uchar data0, uchar data2, uint32 time = B_NOW); 47 48 virtual void SystemRealTime(uchar status, uint32 time = B_NOW); 49 50 virtual status_t Start(); 51 virtual void Stop(); 52 53 int32 CountDevices(); 54 55 status_t GetDeviceName( 56 int32 n, char* name, size_t bufSize = B_OS_NAME_LENGTH); 57 58 private: 59 60 typedef BMidi super; 61 62 friend class BMidiPortGlue; 63 64 virtual void _ReservedMidiPort1(); 65 virtual void _ReservedMidiPort2(); 66 virtual void _ReservedMidiPort3(); 67 68 virtual void Run(); 69 70 void ScanDevices(); 71 void EmptyDeviceList(); 72 73 BMidiLocalProducer* localSource; 74 BMidiLocalConsumer* localSink; 75 BMidiProducer* remoteSource; 76 BMidiConsumer* remoteSink; 77 78 char* portName; 79 status_t status; 80 BList* devices; 81 82 uint32 _reserved[1]; 83 }; 84 85 #endif // _MIDI_PORT_H 86