2002-12-31 17:25:02 +03:00
|
|
|
|
|
|
|
#ifndef _MIDI_PRODUCER_H
|
|
|
|
#define _MIDI_PRODUCER_H
|
2002-10-23 17:24:57 +04:00
|
|
|
|
2006-06-16 19:38:29 +04:00
|
|
|
#include <List.h>
|
2002-10-23 17:24:57 +04:00
|
|
|
#include <Locker.h>
|
|
|
|
#include <MidiEndpoint.h>
|
|
|
|
|
2004-05-13 14:55:10 +04:00
|
|
|
namespace BPrivate { class BMidiRosterLooper; }
|
|
|
|
|
2002-10-23 17:24:57 +04:00
|
|
|
class BMidiProducer : public BMidiEndpoint
|
|
|
|
{
|
|
|
|
public:
|
2002-12-31 17:25:02 +03:00
|
|
|
|
|
|
|
status_t Connect(BMidiConsumer* cons);
|
|
|
|
status_t Disconnect(BMidiConsumer* cons);
|
|
|
|
bool IsConnected(BMidiConsumer* cons) const;
|
2002-10-23 17:24:57 +04:00
|
|
|
BList* Connections() const;
|
|
|
|
|
|
|
|
private:
|
2002-12-31 17:25:02 +03:00
|
|
|
|
2002-10-23 17:24:57 +04:00
|
|
|
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
|
|
|
|
2002-12-31 17:25:02 +03:00
|
|
|
BMidiProducer(const char* name = NULL);
|
2002-10-23 17:24:57 +04:00
|
|
|
virtual ~BMidiProducer();
|
|
|
|
|
|
|
|
virtual void _Reserved1();
|
|
|
|
virtual void _Reserved2();
|
|
|
|
virtual void _Reserved3();
|
|
|
|
virtual void _Reserved4();
|
|
|
|
virtual void _Reserved5();
|
|
|
|
virtual void _Reserved6();
|
|
|
|
virtual void _Reserved7();
|
|
|
|
virtual void _Reserved8();
|
2002-12-31 17:25:02 +03:00
|
|
|
|
|
|
|
status_t SendConnectRequest(BMidiConsumer*, bool);
|
|
|
|
void ConnectionMade(BMidiConsumer*);
|
|
|
|
bool ConnectionBroken(BMidiConsumer*);
|
|
|
|
|
|
|
|
int32 CountConsumers() const;
|
|
|
|
BMidiConsumer* ConsumerAt(int32) const;
|
|
|
|
|
|
|
|
bool LockProducer() const;
|
|
|
|
void UnlockProducer() const;
|
|
|
|
|
2006-06-17 18:04:46 +04:00
|
|
|
BList *fConnections;
|
2006-06-16 19:38:29 +04:00
|
|
|
mutable BLocker fLocker;
|
2006-06-17 18:04:46 +04:00
|
|
|
|
|
|
|
uint32 _reserved[2];
|
2002-10-23 17:24:57 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
class BMidiLocalProducer : public BMidiProducer
|
|
|
|
{
|
|
|
|
public:
|
2002-12-31 17:25:02 +03:00
|
|
|
|
|
|
|
BMidiLocalProducer(const char* name = NULL);
|
2002-10-23 17:24:57 +04:00
|
|
|
|
2002-12-31 17:25:02 +03:00
|
|
|
virtual void Connected(BMidiConsumer* cons);
|
|
|
|
virtual void Disconnected(BMidiConsumer* cons);
|
2002-10-23 17:24:57 +04:00
|
|
|
|
2002-12-31 17:25:02 +03:00
|
|
|
void SprayData(
|
|
|
|
void* data, size_t length, bool atomic = false,
|
|
|
|
bigtime_t time = 0) const;
|
2002-10-23 17:24:57 +04:00
|
|
|
|
2002-12-31 17:25:02 +03:00
|
|
|
void SprayNoteOff(
|
|
|
|
uchar channel, uchar note, uchar velocity,
|
|
|
|
bigtime_t time = 0) const;
|
|
|
|
|
|
|
|
void SprayNoteOn(
|
|
|
|
uchar channel, uchar note, uchar velocity,
|
|
|
|
bigtime_t time = 0) const;
|
|
|
|
|
|
|
|
void SprayKeyPressure(
|
|
|
|
uchar channel, uchar note, uchar pressure,
|
|
|
|
bigtime_t time = 0) const;
|
|
|
|
|
|
|
|
void SprayControlChange(
|
|
|
|
uchar channel, uchar controlNumber, uchar controlValue,
|
|
|
|
bigtime_t time = 0) const;
|
|
|
|
|
|
|
|
void SprayProgramChange(
|
|
|
|
uchar channel, uchar programNumber, bigtime_t time = 0) const;
|
|
|
|
|
|
|
|
void SprayChannelPressure(
|
|
|
|
uchar channel, uchar pressure, bigtime_t time = 0) const;
|
|
|
|
|
|
|
|
void SprayPitchBend(
|
|
|
|
uchar channel, uchar lsb, uchar msb, bigtime_t time = 0) const;
|
|
|
|
|
|
|
|
void SpraySystemExclusive(
|
2003-03-09 19:10:30 +03:00
|
|
|
void* data, size_t length, bigtime_t time = 0) const;
|
2002-12-31 17:25:02 +03:00
|
|
|
|
|
|
|
void SpraySystemCommon(
|
|
|
|
uchar status, uchar data1, uchar data2, bigtime_t time = 0) const;
|
|
|
|
|
|
|
|
void SpraySystemRealTime(
|
|
|
|
uchar status, bigtime_t time = 0) const;
|
|
|
|
|
|
|
|
void SprayTempoChange(
|
|
|
|
int32 beatsPerMinute, bigtime_t time = 0) const;
|
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
|
|
|
~BMidiLocalProducer();
|
|
|
|
|
|
|
|
private:
|
2002-12-31 17:25:02 +03:00
|
|
|
|
2003-03-09 19:10:30 +03:00
|
|
|
void SprayEvent(
|
|
|
|
const void* data, size_t length, bool atomic, bigtime_t time,
|
|
|
|
bool sysex = false) const;
|
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();
|
|
|
|
|
|
|
|
uint32 _reserved[2];
|
|
|
|
};
|
|
|
|
|
2002-12-31 17:25:02 +03:00
|
|
|
#endif // _MIDI_PRODUCER_H
|