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