1 2 #ifndef _MIDI_PRODUCER_H 3 #define _MIDI_PRODUCER_H 4 5 #include <Locker.h> 6 #include <MidiEndpoint.h> 7 8 class BList; 9 10 class BMidiProducer : public BMidiEndpoint 11 { 12 public: 13 14 status_t Connect(BMidiConsumer* cons); 15 status_t Disconnect(BMidiConsumer* cons); 16 bool IsConnected(BMidiConsumer* cons) const; 17 BList* Connections() const; 18 19 private: 20 21 friend class BMidiLocalProducer; 22 friend class BMidiRoster; 23 friend class BMidiRosterLooper; 24 25 BMidiProducer(const char* name = NULL); 26 virtual ~BMidiProducer(); 27 28 virtual void _Reserved1(); 29 virtual void _Reserved2(); 30 virtual void _Reserved3(); 31 virtual void _Reserved4(); 32 virtual void _Reserved5(); 33 virtual void _Reserved6(); 34 virtual void _Reserved7(); 35 virtual void _Reserved8(); 36 37 status_t SendConnectRequest(BMidiConsumer*, bool); 38 void ConnectionMade(BMidiConsumer*); 39 bool ConnectionBroken(BMidiConsumer*); 40 41 int32 CountConsumers() const; 42 BMidiConsumer* ConsumerAt(int32) const; 43 44 bool LockProducer() const; 45 void UnlockProducer() const; 46 47 BList* connections; 48 BLocker* locker; 49 50 uint32 _reserved[10]; 51 }; 52 53 class BMidiLocalProducer : public BMidiProducer 54 { 55 public: 56 57 BMidiLocalProducer(const char* name = NULL); 58 59 virtual void Connected(BMidiConsumer* cons); 60 virtual void Disconnected(BMidiConsumer* cons); 61 62 void SprayData( 63 void* data, size_t length, bool atomic = false, 64 bigtime_t time = 0) const; 65 66 void SprayNoteOff( 67 uchar channel, uchar note, uchar velocity, 68 bigtime_t time = 0) const; 69 70 void SprayNoteOn( 71 uchar channel, uchar note, uchar velocity, 72 bigtime_t time = 0) const; 73 74 void SprayKeyPressure( 75 uchar channel, uchar note, uchar pressure, 76 bigtime_t time = 0) const; 77 78 void SprayControlChange( 79 uchar channel, uchar controlNumber, uchar controlValue, 80 bigtime_t time = 0) const; 81 82 void SprayProgramChange( 83 uchar channel, uchar programNumber, bigtime_t time = 0) const; 84 85 void SprayChannelPressure( 86 uchar channel, uchar pressure, bigtime_t time = 0) const; 87 88 void SprayPitchBend( 89 uchar channel, uchar lsb, uchar msb, bigtime_t time = 0) const; 90 91 void SpraySystemExclusive( 92 void* data, size_t length, bigtime_t time = 0) const; 93 94 void SpraySystemCommon( 95 uchar status, uchar data1, uchar data2, bigtime_t time = 0) const; 96 97 void SpraySystemRealTime( 98 uchar status, bigtime_t time = 0) const; 99 100 void SprayTempoChange( 101 int32 beatsPerMinute, bigtime_t time = 0) const; 102 103 protected: 104 105 ~BMidiLocalProducer(); 106 107 private: 108 109 void SprayEvent( 110 const void* data, size_t length, bool atomic, bigtime_t time, 111 bool sysex = false) const; 112 113 virtual void _Reserved1(); 114 virtual void _Reserved2(); 115 virtual void _Reserved3(); 116 virtual void _Reserved4(); 117 virtual void _Reserved5(); 118 virtual void _Reserved6(); 119 virtual void _Reserved7(); 120 virtual void _Reserved8(); 121 122 uint32 _reserved[2]; 123 }; 124 125 #endif // _MIDI_PRODUCER_H 126