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