2002-12-31 17:25:02 +03:00
|
|
|
|
|
|
|
#ifndef _MIDI_CONSUMER_H
|
|
|
|
#define _MIDI_CONSUMER_H
|
2002-10-23 17:24:57 +04:00
|
|
|
|
|
|
|
#include <MidiEndpoint.h>
|
|
|
|
|
2004-05-13 14:55:10 +04:00
|
|
|
namespace BPrivate { class BMidiRosterLooper; }
|
|
|
|
|
2002-10-23 17:24:57 +04:00
|
|
|
class BMidiConsumer : public BMidiEndpoint
|
|
|
|
{
|
|
|
|
public:
|
2002-12-31 17:25:02 +03:00
|
|
|
|
2002-10-23 17:24:57 +04:00
|
|
|
bigtime_t Latency() const;
|
|
|
|
|
|
|
|
private:
|
2002-12-31 17:25:02 +03:00
|
|
|
|
2002-10-23 17:24:57 +04:00
|
|
|
friend class BMidiLocalConsumer;
|
|
|
|
friend class BMidiLocalProducer;
|
|
|
|
friend class BMidiRoster;
|
2004-05-13 14:55:10 +04:00
|
|
|
friend class BPrivate::BMidiRosterLooper;
|
2002-10-23 17:24:57 +04:00
|
|
|
|
2006-09-13 18:11:42 +04:00
|
|
|
BMidiConsumer(const char *name = NULL);
|
2002-10-23 17:24:57 +04:00
|
|
|
virtual ~BMidiConsumer();
|
|
|
|
|
|
|
|
virtual void _Reserved1();
|
|
|
|
virtual void _Reserved2();
|
|
|
|
virtual void _Reserved3();
|
|
|
|
virtual void _Reserved4();
|
|
|
|
virtual void _Reserved5();
|
|
|
|
virtual void _Reserved6();
|
|
|
|
virtual void _Reserved7();
|
|
|
|
virtual void _Reserved8();
|
|
|
|
|
2006-06-16 19:38:29 +04:00
|
|
|
port_id fPort;
|
|
|
|
bigtime_t fLatency;
|
2002-10-23 17:24:57 +04:00
|
|
|
|
|
|
|
uint32 _reserved[2];
|
|
|
|
};
|
|
|
|
|
|
|
|
class BMidiLocalConsumer : public BMidiConsumer
|
|
|
|
{
|
|
|
|
public:
|
2002-12-31 17:25:02 +03:00
|
|
|
|
2006-09-13 18:11:42 +04:00
|
|
|
BMidiLocalConsumer(const char *name = NULL);
|
2002-10-23 17:24:57 +04:00
|
|
|
|
|
|
|
void SetLatency(bigtime_t latency);
|
2006-09-13 18:11:42 +04:00
|
|
|
int32 GetProducerID();
|
2002-10-31 11:48:13 +03:00
|
|
|
|
2006-09-13 18:11:42 +04:00
|
|
|
void SetTimeout(bigtime_t when, void *data);
|
|
|
|
virtual void Timeout(void *data);
|
2002-10-23 17:24:57 +04:00
|
|
|
|
2002-12-31 17:25:02 +03:00
|
|
|
virtual void Data(
|
2006-09-13 18:11:42 +04:00
|
|
|
uchar *data, size_t length, bool atomic, bigtime_t time);
|
2002-10-23 17:24:57 +04:00
|
|
|
|
2002-12-31 17:25:02 +03:00
|
|
|
virtual void NoteOff(
|
|
|
|
uchar channel, uchar note, uchar velocity, bigtime_t time);
|
|
|
|
|
|
|
|
virtual void NoteOn(
|
|
|
|
uchar channel, uchar note, uchar velocity, bigtime_t time);
|
|
|
|
|
|
|
|
virtual void KeyPressure(
|
|
|
|
uchar channel, uchar note, uchar pressure, bigtime_t time);
|
|
|
|
|
|
|
|
virtual void ControlChange(
|
|
|
|
uchar channel, uchar controlNumber, uchar controlValue,
|
|
|
|
bigtime_t time);
|
|
|
|
|
|
|
|
virtual void ProgramChange(
|
|
|
|
uchar channel, uchar programNumber, bigtime_t time);
|
|
|
|
|
|
|
|
virtual void ChannelPressure(
|
|
|
|
uchar channel, uchar pressure, bigtime_t time);
|
|
|
|
|
|
|
|
virtual void PitchBend(
|
|
|
|
uchar channel, uchar lsb, uchar msb, bigtime_t time);
|
|
|
|
|
|
|
|
virtual void SystemExclusive(
|
2003-03-09 19:10:30 +03:00
|
|
|
void* data, size_t length, bigtime_t time);
|
2002-12-31 17:25:02 +03:00
|
|
|
|
|
|
|
virtual void SystemCommon(
|
|
|
|
uchar status, uchar data1, uchar data2, bigtime_t time);
|
|
|
|
|
|
|
|
virtual void SystemRealTime(uchar status, bigtime_t time);
|
|
|
|
|
|
|
|
virtual void TempoChange(int32 beatsPerMinute, bigtime_t time);
|
|
|
|
|
|
|
|
virtual void AllNotesOff(bool justChannel, bigtime_t time);
|
|
|
|
|
2002-10-23 17:24:57 +04:00
|
|
|
protected:
|
2002-12-31 17:25:02 +03:00
|
|
|
|
2002-10-23 17:24:57 +04:00
|
|
|
~BMidiLocalConsumer();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2002-12-31 17:25:02 +03:00
|
|
|
friend class BMidiRoster;
|
2006-09-13 18:11:42 +04:00
|
|
|
friend int32 _midi_event_thread(void *);
|
2002-10-31 11:48:13 +03:00
|
|
|
|
2002-10-23 17:24:57 +04:00
|
|
|
virtual void _Reserved1();
|
|
|
|
virtual void _Reserved2();
|
|
|
|
virtual void _Reserved3();
|
|
|
|
virtual void _Reserved4();
|
|
|
|
virtual void _Reserved5();
|
|
|
|
virtual void _Reserved6();
|
|
|
|
virtual void _Reserved7();
|
|
|
|
virtual void _Reserved8();
|
2003-03-09 19:10:30 +03:00
|
|
|
|
|
|
|
int32 EventThread();
|
|
|
|
|
2006-06-16 19:38:29 +04:00
|
|
|
bigtime_t fTimeout;
|
|
|
|
void* fTimeoutData;
|
|
|
|
int32 fCurrentProducer;
|
|
|
|
thread_id fThread;
|
2003-03-09 19:10:30 +03:00
|
|
|
|
2002-10-31 11:48:13 +03:00
|
|
|
uint32 _reserved[1];
|
2002-10-23 17:24:57 +04:00
|
|
|
};
|
|
|
|
|
2002-12-31 17:25:02 +03:00
|
|
|
#endif // _MIDI_CONSUMER_H
|