Checkin of the source code for midi2 kit milestone 1.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2335 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
mahlzeit
2002-12-31 14:25:02 +00:00
parent 11e8a16025
commit 1df1f3949f
6 changed files with 265 additions and 266 deletions
+62 -63
View File
@@ -8,70 +8,69 @@
#ifndef _MIDI_CONSTANTS_ #ifndef _MIDI_CONSTANTS_
#define _MIDI_CONSTANTS_ #define _MIDI_CONSTANTS_
/* Channel Message Masks*/ /* Channel Message Masks */
const uchar B_NOTE_OFF = 0x80; const uchar B_NOTE_OFF = 0x80;
const uchar B_NOTE_ON = 0x90; const uchar B_NOTE_ON = 0x90;
const uchar B_KEY_PRESSURE = 0xa0; const uchar B_KEY_PRESSURE = 0xa0;
const uchar B_CONTROL_CHANGE = 0xb0; const uchar B_CONTROL_CHANGE = 0xb0;
const uchar B_PROGRAM_CHANGE = 0xc0; const uchar B_PROGRAM_CHANGE = 0xc0;
const uchar B_CHANNEL_PRESSURE = 0xd0; const uchar B_CHANNEL_PRESSURE = 0xd0;
const uchar B_PITCH_BEND = 0xe0; const uchar B_PITCH_BEND = 0xe0;
/* System Messages*/ /* System Messages */
const uchar B_SYS_EX_START = 0xf0; const uchar B_SYS_EX_START = 0xf0;
const uchar B_MIDI_TIME_CODE = 0xf1; const uchar B_MIDI_TIME_CODE = 0xf1;
const uchar B_SONG_POSITION = 0xf2; const uchar B_SONG_POSITION = 0xf2;
const uchar B_SONG_SELECT = 0xf3; const uchar B_SONG_SELECT = 0xf3;
const uchar B_CABLE_MESSAGE = 0xf5; const uchar B_CABLE_MESSAGE = 0xf5;
const uchar B_TUNE_REQUEST = 0xf6; const uchar B_TUNE_REQUEST = 0xf6;
const uchar B_SYS_EX_END = 0xf7; const uchar B_SYS_EX_END = 0xf7;
const uchar B_TIMING_CLOCK = 0xf8; const uchar B_TIMING_CLOCK = 0xf8;
const uchar B_START = 0xfa; const uchar B_START = 0xfa;
const uchar B_CONTINUE = 0xfb; const uchar B_CONTINUE = 0xfb;
const uchar B_STOP = 0xfc; const uchar B_STOP = 0xfc;
const uchar B_ACTIVE_SENSING = 0xfe; const uchar B_ACTIVE_SENSING = 0xfe;
const uchar B_SYSTEM_RESET = 0xff; const uchar B_SYSTEM_RESET = 0xff;
/* Controller Numbers*/ /* Controller Numbers */
const uchar B_MODULATION = 0x01; const uchar B_MODULATION = 0x01;
const uchar B_BREATH_CONTROLLER = 0x02; const uchar B_BREATH_CONTROLLER = 0x02;
const uchar B_FOOT_CONTROLLER = 0x04; const uchar B_FOOT_CONTROLLER = 0x04;
const uchar B_PORTAMENTO_TIME = 0x05; const uchar B_PORTAMENTO_TIME = 0x05;
const uchar B_DATA_ENTRY = 0x06; const uchar B_DATA_ENTRY = 0x06;
const uchar B_MAIN_VOLUME = 0x07; const uchar B_MAIN_VOLUME = 0x07;
const uchar B_MIDI_BALANCE = 0x08; /* used to be B_BALANCE */ const uchar B_MIDI_BALANCE = 0x08;
const uchar B_PAN = 0x0a; const uchar B_PAN = 0x0a;
const uchar B_EXPRESSION_CTRL = 0x0b; const uchar B_EXPRESSION_CTRL = 0x0b;
const uchar B_GENERAL_CTRL_1 = 0x10; const uchar B_GENERAL_CTRL_1 = 0x10;
const uchar B_GENERAL_CTRL_2 = 0x11; const uchar B_GENERAL_CTRL_2 = 0x11;
const uchar B_GENERAL_CTRL_3 = 0x12; const uchar B_GENERAL_CTRL_3 = 0x12;
const uchar B_GENERAL_CTRL_4 = 0x13; const uchar B_GENERAL_CTRL_4 = 0x13;
const uchar B_SUSTAIN_PEDAL = 0x40; const uchar B_SUSTAIN_PEDAL = 0x40;
const uchar B_PORTAMENTO = 0x41; const uchar B_PORTAMENTO = 0x41;
const uchar B_SOSTENUTO = 0x42; const uchar B_SOSTENUTO = 0x42;
const uchar B_SOFT_PEDAL = 0x43; const uchar B_SOFT_PEDAL = 0x43;
const uchar B_HOLD_2 = 0x45; const uchar B_HOLD_2 = 0x45;
const uchar B_GENERAL_CTRL_5 = 0x50; const uchar B_GENERAL_CTRL_5 = 0x50;
const uchar B_GENERAL_CTRL_6 = 0x51; const uchar B_GENERAL_CTRL_6 = 0x51;
const uchar B_GENERAL_CTRL_7 = 0x52; const uchar B_TEMPO_CHANGE = 0x51;
const uchar B_GENERAL_CTRL_8 = 0x53; const uchar B_GENERAL_CTRL_7 = 0x52;
const uchar B_EFFECTS_DEPTH = 0x5b; const uchar B_GENERAL_CTRL_8 = 0x53;
const uchar B_TREMOLO_DEPTH = 0x5c; const uchar B_EFFECTS_DEPTH = 0x5b;
const uchar B_CHORUS_DEPTH = 0x5d; const uchar B_TREMOLO_DEPTH = 0x5c;
const uchar B_CELESTE_DEPTH = 0x5e; const uchar B_CHORUS_DEPTH = 0x5d;
const uchar B_PHASER_DEPTH = 0x5f; const uchar B_CELESTE_DEPTH = 0x5e;
const uchar B_DATA_INCREMENT = 0x60; const uchar B_PHASER_DEPTH = 0x5f;
const uchar B_DATA_DECREMENT = 0x61; const uchar B_DATA_INCREMENT = 0x60;
const uchar B_RESET_ALL_CONTROLLERS = 0x79; const uchar B_DATA_DECREMENT = 0x61;
const uchar B_LOCAL_CONTROL = 0x7a; const uchar B_RESET_ALL_CONTROLLERS = 0x79;
const uchar B_ALL_NOTES_OFF = 0x7b; const uchar B_LOCAL_CONTROL = 0x7a;
const uchar B_OMNI_MODE_OFF = 0x7c; const uchar B_ALL_NOTES_OFF = 0x7b;
const uchar B_OMNI_MODE_ON = 0x7d; const uchar B_OMNI_MODE_OFF = 0x7c;
const uchar B_MONO_MODE_ON = 0x7e; const uchar B_OMNI_MODE_ON = 0x7d;
const uchar B_POLY_MODE_ON = 0x7f; const uchar B_MONO_MODE_ON = 0x7e;
const uchar B_POLY_MODE_ON = 0x7f;
const uchar B_TEMPO_CHANGE = 0x51; #endif // _MIDI_CONSTANTS_
#endif #endif // _MIDI2_DEFS_H
#endif
+54 -41
View File
@@ -1,5 +1,6 @@
#ifndef _MIDI_SINK_H
#define _MIDI_SINK_H #ifndef _MIDI_CONSUMER_H
#define _MIDI_CONSUMER_H
#include <MidiEndpoint.h> #include <MidiEndpoint.h>
@@ -8,14 +9,17 @@ class BMidiDispatcher;
class BMidiConsumer : public BMidiEndpoint class BMidiConsumer : public BMidiEndpoint
{ {
public: public:
bigtime_t Latency() const; bigtime_t Latency() const;
private: private:
friend class BMidiLocalConsumer; friend class BMidiLocalConsumer;
friend class BMidiLocalProducer; friend class BMidiLocalProducer;
friend class BMidiRoster; friend class BMidiRoster;
friend class BMidiRosterLooper;
BMidiConsumer(const char *name = NULL); BMidiConsumer(const char* name = NULL);
virtual ~BMidiConsumer(); virtual ~BMidiConsumer();
virtual void _Reserved1(); virtual void _Reserved1();
@@ -27,8 +31,8 @@ private:
virtual void _Reserved7(); virtual void _Reserved7();
virtual void _Reserved8(); virtual void _Reserved8();
port_id fEventPort; port_id port;
bigtime_t fLatency; bigtime_t latency;
uint32 _reserved[2]; uint32 _reserved[2];
}; };
@@ -36,51 +40,60 @@ private:
class BMidiLocalConsumer : public BMidiConsumer class BMidiLocalConsumer : public BMidiConsumer
{ {
public: public:
BMidiLocalConsumer(const char *name = NULL);
BMidiLocalConsumer(const char* name = NULL);
void SetLatency(bigtime_t latency); void SetLatency(bigtime_t latency);
int32 GetProducerID(void); int32 GetProducerID(void);
void SetTimeout(bigtime_t when, void *data); void SetTimeout(bigtime_t when, void* data);
virtual void Timeout(void *data); virtual void Timeout(void* data);
virtual void Data(uchar *data, size_t length, bool atomic, virtual void Data(
bigtime_t time); uchar* data, size_t length, bool atomic, bigtime_t time);
// Raw Midi data has been received.
// The default implementation calls one of the virtuals below:
virtual void NoteOff(uchar channel, uchar note, uchar velocity, virtual void NoteOff(
bigtime_t time); uchar channel, uchar note, uchar velocity, bigtime_t time);
virtual void NoteOn(uchar channel, uchar note, uchar velocity,
bigtime_t time); virtual void NoteOn(
virtual void KeyPressure(uchar channel, uchar note, uchar pressure, uchar channel, uchar note, uchar velocity, bigtime_t time);
bigtime_t time);
virtual void ControlChange(uchar channel, uchar controlNumber, virtual void KeyPressure(
uchar controlValue, uchar channel, uchar note, uchar pressure, bigtime_t time);
bigtime_t time);
virtual void ProgramChange(uchar channel, uchar programNumber, virtual void ControlChange(
bigtime_t time); uchar channel, uchar controlNumber, uchar controlValue,
virtual void ChannelPressure(uchar channel, uchar pressure, bigtime_t time);
bigtime_t time);
virtual void PitchBend(uchar channel, uchar lsb, uchar msb, virtual void ProgramChange(
bigtime_t time); uchar channel, uchar programNumber, bigtime_t time);
virtual void SystemExclusive(void* data, size_t dataLength,
bigtime_t time); virtual void ChannelPressure(
virtual void SystemCommon(uchar statusByte, uchar data1, uchar data2, uchar channel, uchar pressure, bigtime_t time);
bigtime_t time);
virtual void SystemRealTime(uchar statusByte, virtual void PitchBend(
bigtime_t time); uchar channel, uchar lsb, uchar msb, bigtime_t time);
virtual void TempoChange(int32 bpm,
bigtime_t time); virtual void SystemExclusive(
virtual void AllNotesOff(bool justChannel, void* data, size_t dataLength, bigtime_t time);
bigtime_t time);
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);
protected: protected:
~BMidiLocalConsumer(); ~BMidiLocalConsumer();
private: private:
friend class BMidiRoster;
friend class BMidiDispatcher; friend class BMidiDispatcher;
friend class BMidiRoster;
virtual void _Reserved1(); virtual void _Reserved1();
virtual void _Reserved2(); virtual void _Reserved2();
@@ -91,12 +104,12 @@ private:
virtual void _Reserved7(); virtual void _Reserved7();
virtual void _Reserved8(); virtual void _Reserved8();
BMidiDispatcher *fDispatcher; BMidiDispatcher* fDispatcher;
bigtime_t fTimeout; bigtime_t fTimeout;
void *fTimeoutData; void* fTimeoutData;
int32 fCurrentProducer; int32 fCurrentProducer;
uint32 _reserved[1]; uint32 _reserved[1];
}; };
#endif #endif // _MIDI_CONSUMER_H
+29 -29
View File
@@ -1,29 +1,21 @@
#ifndef _MIDI_ENDPOINT_H #ifndef _MIDI_ENDPOINT_H
#define _MIDI_ENDPOINT_H #define _MIDI_ENDPOINT_H
#ifndef _BE_BUILD_H
#include <BeBuild.h> #include <BeBuild.h>
#endif
#include <Midi2Defs.h> #include <Midi2Defs.h>
#include <OS.h> #include <OS.h>
#include <String.h> #include <String.h>
class BMidiList;
class BList;
class BMidiProducer; class BMidiProducer;
class BMidiConsumer; class BMidiConsumer;
class BMidiList;
// dynamic_cast<BMidiProducer*> (ptr_to_endpoint)
class BMidiEndpoint class BMidiEndpoint
{ {
public: public:
const char *Name() const;
void SetName(const char *name); const char* Name() const;
void SetName(const char* name);
int32 ID() const; int32 ID() const;
@@ -37,25 +29,24 @@ public:
status_t Release(); status_t Release();
status_t Acquire(); status_t Acquire();
status_t SetProperties(const BMessage *props); status_t SetProperties(const BMessage* properties);
status_t GetProperties(BMessage *props) const; status_t GetProperties(BMessage* properties) const;
status_t Register(void); status_t Register(void);
status_t Unregister(void); status_t Unregister(void);
private: private:
friend class BMidiRoster;
friend class BMidiProducer;
friend class BMidiConsumer; friend class BMidiConsumer;
friend class BMidiLocalProducer;
friend class BMidiLocalConsumer; friend class BMidiLocalConsumer;
friend class BMidiList; friend class BMidiLocalProducer;
friend class BMidiProducer;
friend class BMidiRoster;
friend class BMidiRosterLooper;
BMidiEndpoint(const char *name); BMidiEndpoint(const char* name);
virtual ~BMidiEndpoint(); virtual ~BMidiEndpoint();
BMidiEndpoint(const BMidiEndpoint &) {}
BMidiEndpoint& operator=(const BMidiEndpoint &) { return *this; }
virtual void _Reserved1(); virtual void _Reserved1();
virtual void _Reserved2(); virtual void _Reserved2();
virtual void _Reserved3(); virtual void _Reserved3();
@@ -65,14 +56,23 @@ private:
virtual void _Reserved7(); virtual void _Reserved7();
virtual void _Reserved8(); virtual void _Reserved8();
int32 fID; status_t SendRegisterRequest(bool);
BString fName; status_t SendChangeRequest(BMessage*);
status_t fStatus;
bool IsRegistered() const;
bool LockLooper() const;
void UnlockLooper() const;
int32 id;
BString name;
int32 refCount;
BMessage* properties;
bool isLocal;
bool isConsumer;
bool isRegistered;
bool isAlive;
int32 fFlags;
int32 fRefCount;
uint32 _reserved[4]; uint32 _reserved[4];
}; };
#endif #endif // _MIDI_ENDPOINT_H
+73 -43
View File
@@ -1,24 +1,28 @@
#ifndef _MIDI_SOURCE_H
#define _MIDI_SOURCE_H #ifndef _MIDI_PRODUCER_H
#define _MIDI_PRODUCER_H
#include <Locker.h> #include <Locker.h>
#include <MidiEndpoint.h> #include <MidiEndpoint.h>
class BMidiEvent; class BList;
class BMidiProducer : public BMidiEndpoint class BMidiProducer : public BMidiEndpoint
{ {
public: public:
status_t Connect(BMidiConsumer *toObject);
status_t Disconnect(BMidiConsumer *toObject); status_t Connect(BMidiConsumer* cons);
bool IsConnected(BMidiConsumer *toObject) const; status_t Disconnect(BMidiConsumer* cons);
bool IsConnected(BMidiConsumer* cons) const;
BList* Connections() const; BList* Connections() const;
private: private:
friend class BMidiLocalProducer; friend class BMidiLocalProducer;
friend class BMidiRoster; friend class BMidiRoster;
friend class BMidiRosterLooper;
BMidiProducer(const char *name = NULL); BMidiProducer(const char* name = NULL);
virtual ~BMidiProducer(); virtual ~BMidiProducer();
virtual void _Reserved1(); virtual void _Reserved1();
@@ -29,54 +33,80 @@ private:
virtual void _Reserved6(); virtual void _Reserved6();
virtual void _Reserved7(); virtual void _Reserved7();
virtual void _Reserved8(); virtual void _Reserved8();
BMidiList *fConnections; status_t SendConnectRequest(BMidiConsumer*, bool);
mutable BLocker fLock; void ConnectionMade(BMidiConsumer*);
bool ConnectionBroken(BMidiConsumer*);
int fConnectionCount;
uint32 _reserved[1]; int32 CountConsumers() const;
BMidiConsumer* ConsumerAt(int32) const;
bool LockProducer() const;
void UnlockProducer() const;
BList* connections;
BLocker* locker;
uint32 _reserved[10];
}; };
class BMidiLocalProducer : public BMidiProducer class BMidiLocalProducer : public BMidiProducer
{ {
public: public:
BMidiLocalProducer(const char *name = NULL);
BMidiLocalProducer(const char* name = NULL);
virtual void Connected(BMidiConsumer *dest); virtual void Connected(BMidiConsumer* cons);
virtual void Disconnected(BMidiConsumer *dest); virtual void Disconnected(BMidiConsumer* cons);
// Spray some MIDI data downstream to the targets of this object void SprayData(
void SprayData(void *data, size_t length, void* data, size_t length, bool atomic = false,
bool atomic = false, bigtime_t time = 0) const; bigtime_t time = 0) const;
void SprayNoteOff(uchar channel, uchar note, uchar velocity, void SprayNoteOff(
bigtime_t time = 0) const; uchar channel, uchar note, uchar velocity,
void SprayNoteOn(uchar channel, uchar note, uchar velocity, bigtime_t time = 0) const;
bigtime_t time = 0) const;
void SprayKeyPressure(uchar channel, uchar note, uchar pressure, void SprayNoteOn(
bigtime_t time = 0) const; uchar channel, uchar note, uchar velocity,
void SprayControlChange(uchar channel, uchar controlNumber, bigtime_t time = 0) const;
uchar controlValue, bigtime_t time = 0) const;
void SprayProgramChange(uchar channel, uchar programNumber, void SprayKeyPressure(
bigtime_t time = 0) const; uchar channel, uchar note, uchar pressure,
void SprayChannelPressure(uchar channel, uchar pressure, bigtime_t time = 0) const;
bigtime_t time = 0) const;
void SprayPitchBend(uchar channel, uchar lsb, uchar msb, void SprayControlChange(
bigtime_t time = 0) const; uchar channel, uchar controlNumber, uchar controlValue,
void SpraySystemExclusive(void* data, size_t dataLength, bigtime_t time = 0) const;
bigtime_t time = 0) const;
void SpraySystemCommon(uchar statusByte, uchar data1, uchar data2, void SprayProgramChange(
bigtime_t time = 0) const; uchar channel, uchar programNumber, bigtime_t time = 0) const;
void SpraySystemRealTime(uchar statusByte,
bigtime_t time = 0) const; void SprayChannelPressure(
void SprayTempoChange(int32 bpm, uchar channel, uchar pressure, bigtime_t time = 0) const;
bigtime_t time = 0) const;
void SprayPitchBend(
uchar channel, uchar lsb, uchar msb, bigtime_t time = 0) const;
void SpraySystemExclusive(
void* data, size_t dataLength, bigtime_t time = 0) const;
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;
protected: protected:
~BMidiLocalProducer(); ~BMidiLocalProducer();
private: private:
void SprayEvent(BMidiEvent *event, size_t length) const;
//void SprayEvent(BMidiEvent* event, size_t length) const;
virtual void _Reserved1(); virtual void _Reserved1();
virtual void _Reserved2(); virtual void _Reserved2();
@@ -90,4 +120,4 @@ private:
uint32 _reserved[2]; uint32 _reserved[2];
}; };
#endif #endif // _MIDI_PRODUCER_H
+30 -84
View File
@@ -21,70 +21,38 @@ enum BMidiOp
class BMidiProducer; class BMidiProducer;
class BMidiConsumer; class BMidiConsumer;
class BMidiRosterLooper;
class BMidiRoster class BMidiRoster
{ {
public: public:
static BMidiEndpoint *NextEndpoint(int32 *id);
static BMidiProducer *NextProducer(int32 *id);
static BMidiConsumer *NextConsumer(int32 *id);
static BMidiEndpoint *FindEndpoint(int32 id, bool local_only = false);
static BMidiProducer *FindProducer(int32 id, bool local_only = false);
static BMidiConsumer *FindConsumer(int32 id, bool local_only = false);
// if local_only is true only local objects will be resolved
static void StartWatching(const BMessenger *msngr);
static void StopWatching();
// what = B_MIDI_EVENT (for all below)
//
// be:op = B_MIDI_REGISTERED or B_MIDI_UNREGISTERED
// be:id = <id>
// be:type = "producer" | "consumer"
//
// be:op = B_MIDI_CHANGED_NAME
// be:id = <id>
// be:type = "producer" | "consumer"
// be:name = <name>
//
// be:op = B_MIDI_CHANGED_LATENCY
// be:id = <id>
// be:type = "producer" | "consumer"
// be:latency = <latency>
//
// be:op = B_MIDI_CHANGED_PROPERTIES
// be:id = <id>
// be:type = "producer" | "consumer"
// be:properties = <properties>
//
// be:op = B_MIDI_CONNECTED (when source->Connect(sink) happens)
// be:producer = <id> - connector id (0 if not a public object)
// be:consumer = <id> - connectee id (0 if not a public object)
//
// be:op = B_MIDI_DISCONNECTED (when source->Connect(sink) happens)
// be:producer = <id> - connector id (0 if not a public object)
// be:consumer = <id> - connectee id (0 if not a public object)
//
// When you StartWatching(), you will receive added
// events for all existing midi objects
static status_t Register(BMidiEndpoint *object);
static status_t Unregister(BMidiEndpoint *object);
// Publish a midi object so that it is externall visible.
static BMidiRoster *MidiRoster(); static BMidiEndpoint* NextEndpoint(int32* id);
static BMidiProducer* NextProducer(int32* id);
static BMidiConsumer* NextConsumer(int32* id);
static BMidiEndpoint* FindEndpoint(int32 id, bool localOnly = false);
static BMidiProducer* FindProducer(int32 id, bool localOnly = false);
static BMidiConsumer* FindConsumer(int32 id, bool localOnly = false);
static void StartWatching(const BMessenger* msngr);
static void StopWatching();
static status_t Register(BMidiEndpoint* endp);
static status_t Unregister(BMidiEndpoint* endp);
static BMidiRoster* MidiRoster();
private: private:
friend class BMidiEndpoint;
friend class BMidiProducer;
friend class BMidiConsumer; friend class BMidiConsumer;
friend class BMidiEndpoint;
friend class BMidiLocalProducer; friend class BMidiLocalProducer;
friend class BMidiLocalConsumer; friend class BMidiLocalConsumer;
friend class BMidiProducer;
friend class BMidiRosterKiller;
friend class BMidiRosterLooper; friend class BMidiRosterLooper;
friend class MidiRosterApp;
BMidiRoster();
BMidiRoster(BMessenger *remote = NULL);
virtual ~BMidiRoster(); virtual ~BMidiRoster();
virtual void _Reserved1(); virtual void _Reserved1();
@@ -96,37 +64,15 @@ private:
virtual void _Reserved7(); virtual void _Reserved7();
virtual void _Reserved8(); virtual void _Reserved8();
status_t RemoteConnect(int32 producer, int32 consumer, int32 port); void CreateLocal(BMidiEndpoint*);
status_t RemoteDisconnect(int32 producer, int32 consumer); void DeleteLocal(BMidiEndpoint*);
void RemoteConnected(int32 producer, int32 consumer);
void RemoteDisconnected(int32 producer, int32 consumer); status_t SendRequest(BMessage*, BMessage*);
BMidiEndpoint* RemoteCreateProducer(int32 producer, const char *name); BMidiRosterLooper* looper;
BMidiEndpoint* RemoteCreateConsumer(int32 consumer, const char *name, int32 port, int32 latency); BMessenger* server;
void RemoteDelete(BMidiEndpoint *object);
void RemoteRename(BMidiEndpoint *object, const char *name);
void RemoteChangeLatency(BMidiEndpoint *object, bigtime_t latency);
status_t Remote(int32 id, int32 op);
status_t DoRemote(BMessage *msg, BMessage *result = 0);
void Rename(BMidiEndpoint *midi, const char *name);
status_t Release(BMidiEndpoint *midi);
status_t Acquire(BMidiEndpoint *midi);
void Create(BMidiEndpoint *midi);
void SetLatency(BMidiConsumer *midi, bigtime_t latency);
status_t SetProperties(BMidiEndpoint *midi, const BMessage *props);
status_t GetProperties(const BMidiEndpoint *midi, BMessage *props);
status_t Connect(BMidiProducer *source, BMidiConsumer *sink);
status_t Disconnect(BMidiProducer *source, BMidiConsumer *sink);
BLooper *Looper();
BMidiRosterLooper *looper;
BMessenger *remote;
uint32 _reserved[16]; uint32 _reserved[16];
}; };
#endif #endif // _MIDI_ROSTER_H
+17 -6
View File
@@ -4,25 +4,36 @@
* Debug macros for the Midi Kit * Debug macros for the Midi Kit
* *
* @author Matthijs Hollemans * @author Matthijs Hollemans
* @author Marcus Overhagen
*/ */
#ifndef MIDI_DEBUG_H #ifndef MIDI_DEBUG_H
#define MIDI_DEBUG_H #define MIDI_DEBUG_H
#include <OS.h>
#include <stdio.h> #include <stdio.h>
#ifndef NDEBUG #define WARN(args) { fprintf(stderr, "[midi] WARNING: %s\n", args); }
#define UNIMPLEMENTED { fprintf(stderr, "[midi] UNIMPLEMENTED %s\n",__PRETTY_FUNCTION__); }
#define TRACE(args) { printf args; } #ifdef DEBUG
#define UNIMPLEMENTED TRACE(("[midi] UNIMPLEMENTED %s\n",__PRETTY_FUNCTION__))
#define TRACE(args) { printf("[midi] "); printf args; printf("\n"); }
#define ASSERT(expr) \
if (!(expr))\
{\
char buf[1024];\
sprintf(\
buf, "%s(%d) : Assertion \"%s\" failed!",\
__FILE__, __LINE__, #expr);\
debugger(buf);\
}\
#else #else
#define TRACE(args) #define TRACE(args)
#define UNIMPLEMENTED #define ASSERT(expr)
#endif #endif
#endif // MIDI_DEBUG_H #endif // MIDI_DEBUG_H