From 1df1f3949ff233fee38f99384f83cc99c8178568 Mon Sep 17 00:00:00 2001 From: mahlzeit Date: Tue, 31 Dec 2002 14:25:02 +0000 Subject: [PATCH] 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 --- headers/os/midi2/Midi2Defs.h | 125 ++++++++++++++++---------------- headers/os/midi2/MidiConsumer.h | 95 +++++++++++++----------- headers/os/midi2/MidiEndpoint.h | 58 +++++++-------- headers/os/midi2/MidiProducer.h | 116 ++++++++++++++++++----------- headers/os/midi2/MidiRoster.h | 114 ++++++++--------------------- headers/private/midi/debug.h | 23 ++++-- 6 files changed, 265 insertions(+), 266 deletions(-) diff --git a/headers/os/midi2/Midi2Defs.h b/headers/os/midi2/Midi2Defs.h index 534db6f0ac..2fa89ea822 100644 --- a/headers/os/midi2/Midi2Defs.h +++ b/headers/os/midi2/Midi2Defs.h @@ -8,70 +8,69 @@ #ifndef _MIDI_CONSTANTS_ #define _MIDI_CONSTANTS_ -/* Channel Message Masks*/ -const uchar B_NOTE_OFF = 0x80; -const uchar B_NOTE_ON = 0x90; -const uchar B_KEY_PRESSURE = 0xa0; -const uchar B_CONTROL_CHANGE = 0xb0; -const uchar B_PROGRAM_CHANGE = 0xc0; -const uchar B_CHANNEL_PRESSURE = 0xd0; -const uchar B_PITCH_BEND = 0xe0; +/* Channel Message Masks */ +const uchar B_NOTE_OFF = 0x80; +const uchar B_NOTE_ON = 0x90; +const uchar B_KEY_PRESSURE = 0xa0; +const uchar B_CONTROL_CHANGE = 0xb0; +const uchar B_PROGRAM_CHANGE = 0xc0; +const uchar B_CHANNEL_PRESSURE = 0xd0; +const uchar B_PITCH_BEND = 0xe0; -/* System Messages*/ -const uchar B_SYS_EX_START = 0xf0; -const uchar B_MIDI_TIME_CODE = 0xf1; -const uchar B_SONG_POSITION = 0xf2; -const uchar B_SONG_SELECT = 0xf3; -const uchar B_CABLE_MESSAGE = 0xf5; -const uchar B_TUNE_REQUEST = 0xf6; -const uchar B_SYS_EX_END = 0xf7; -const uchar B_TIMING_CLOCK = 0xf8; -const uchar B_START = 0xfa; -const uchar B_CONTINUE = 0xfb; -const uchar B_STOP = 0xfc; -const uchar B_ACTIVE_SENSING = 0xfe; -const uchar B_SYSTEM_RESET = 0xff; +/* System Messages */ +const uchar B_SYS_EX_START = 0xf0; +const uchar B_MIDI_TIME_CODE = 0xf1; +const uchar B_SONG_POSITION = 0xf2; +const uchar B_SONG_SELECT = 0xf3; +const uchar B_CABLE_MESSAGE = 0xf5; +const uchar B_TUNE_REQUEST = 0xf6; +const uchar B_SYS_EX_END = 0xf7; +const uchar B_TIMING_CLOCK = 0xf8; +const uchar B_START = 0xfa; +const uchar B_CONTINUE = 0xfb; +const uchar B_STOP = 0xfc; +const uchar B_ACTIVE_SENSING = 0xfe; +const uchar B_SYSTEM_RESET = 0xff; -/* Controller Numbers*/ -const uchar B_MODULATION = 0x01; -const uchar B_BREATH_CONTROLLER = 0x02; -const uchar B_FOOT_CONTROLLER = 0x04; -const uchar B_PORTAMENTO_TIME = 0x05; -const uchar B_DATA_ENTRY = 0x06; -const uchar B_MAIN_VOLUME = 0x07; -const uchar B_MIDI_BALANCE = 0x08; /* used to be B_BALANCE */ -const uchar B_PAN = 0x0a; -const uchar B_EXPRESSION_CTRL = 0x0b; -const uchar B_GENERAL_CTRL_1 = 0x10; -const uchar B_GENERAL_CTRL_2 = 0x11; -const uchar B_GENERAL_CTRL_3 = 0x12; -const uchar B_GENERAL_CTRL_4 = 0x13; -const uchar B_SUSTAIN_PEDAL = 0x40; -const uchar B_PORTAMENTO = 0x41; -const uchar B_SOSTENUTO = 0x42; -const uchar B_SOFT_PEDAL = 0x43; -const uchar B_HOLD_2 = 0x45; -const uchar B_GENERAL_CTRL_5 = 0x50; -const uchar B_GENERAL_CTRL_6 = 0x51; -const uchar B_GENERAL_CTRL_7 = 0x52; -const uchar B_GENERAL_CTRL_8 = 0x53; -const uchar B_EFFECTS_DEPTH = 0x5b; -const uchar B_TREMOLO_DEPTH = 0x5c; -const uchar B_CHORUS_DEPTH = 0x5d; -const uchar B_CELESTE_DEPTH = 0x5e; -const uchar B_PHASER_DEPTH = 0x5f; -const uchar B_DATA_INCREMENT = 0x60; -const uchar B_DATA_DECREMENT = 0x61; -const uchar B_RESET_ALL_CONTROLLERS = 0x79; -const uchar B_LOCAL_CONTROL = 0x7a; -const uchar B_ALL_NOTES_OFF = 0x7b; -const uchar B_OMNI_MODE_OFF = 0x7c; -const uchar B_OMNI_MODE_ON = 0x7d; -const uchar B_MONO_MODE_ON = 0x7e; -const uchar B_POLY_MODE_ON = 0x7f; +/* Controller Numbers */ +const uchar B_MODULATION = 0x01; +const uchar B_BREATH_CONTROLLER = 0x02; +const uchar B_FOOT_CONTROLLER = 0x04; +const uchar B_PORTAMENTO_TIME = 0x05; +const uchar B_DATA_ENTRY = 0x06; +const uchar B_MAIN_VOLUME = 0x07; +const uchar B_MIDI_BALANCE = 0x08; +const uchar B_PAN = 0x0a; +const uchar B_EXPRESSION_CTRL = 0x0b; +const uchar B_GENERAL_CTRL_1 = 0x10; +const uchar B_GENERAL_CTRL_2 = 0x11; +const uchar B_GENERAL_CTRL_3 = 0x12; +const uchar B_GENERAL_CTRL_4 = 0x13; +const uchar B_SUSTAIN_PEDAL = 0x40; +const uchar B_PORTAMENTO = 0x41; +const uchar B_SOSTENUTO = 0x42; +const uchar B_SOFT_PEDAL = 0x43; +const uchar B_HOLD_2 = 0x45; +const uchar B_GENERAL_CTRL_5 = 0x50; +const uchar B_GENERAL_CTRL_6 = 0x51; +const uchar B_TEMPO_CHANGE = 0x51; +const uchar B_GENERAL_CTRL_7 = 0x52; +const uchar B_GENERAL_CTRL_8 = 0x53; +const uchar B_EFFECTS_DEPTH = 0x5b; +const uchar B_TREMOLO_DEPTH = 0x5c; +const uchar B_CHORUS_DEPTH = 0x5d; +const uchar B_CELESTE_DEPTH = 0x5e; +const uchar B_PHASER_DEPTH = 0x5f; +const uchar B_DATA_INCREMENT = 0x60; +const uchar B_DATA_DECREMENT = 0x61; +const uchar B_RESET_ALL_CONTROLLERS = 0x79; +const uchar B_LOCAL_CONTROL = 0x7a; +const uchar B_ALL_NOTES_OFF = 0x7b; +const uchar B_OMNI_MODE_OFF = 0x7c; +const uchar B_OMNI_MODE_ON = 0x7d; +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 +#endif // _MIDI2_DEFS_H diff --git a/headers/os/midi2/MidiConsumer.h b/headers/os/midi2/MidiConsumer.h index 1d84520b73..d07695ed41 100644 --- a/headers/os/midi2/MidiConsumer.h +++ b/headers/os/midi2/MidiConsumer.h @@ -1,5 +1,6 @@ -#ifndef _MIDI_SINK_H -#define _MIDI_SINK_H + +#ifndef _MIDI_CONSUMER_H +#define _MIDI_CONSUMER_H #include @@ -8,14 +9,17 @@ class BMidiDispatcher; class BMidiConsumer : public BMidiEndpoint { public: + bigtime_t Latency() const; private: + friend class BMidiLocalConsumer; friend class BMidiLocalProducer; friend class BMidiRoster; + friend class BMidiRosterLooper; - BMidiConsumer(const char *name = NULL); + BMidiConsumer(const char* name = NULL); virtual ~BMidiConsumer(); virtual void _Reserved1(); @@ -27,8 +31,8 @@ private: virtual void _Reserved7(); virtual void _Reserved8(); - port_id fEventPort; - bigtime_t fLatency; + port_id port; + bigtime_t latency; uint32 _reserved[2]; }; @@ -36,51 +40,60 @@ private: class BMidiLocalConsumer : public BMidiConsumer { public: - BMidiLocalConsumer(const char *name = NULL); + + BMidiLocalConsumer(const char* name = NULL); void SetLatency(bigtime_t latency); int32 GetProducerID(void); - void SetTimeout(bigtime_t when, void *data); - virtual void Timeout(void *data); + void SetTimeout(bigtime_t when, void* data); + virtual void Timeout(void* data); - virtual void Data(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 Data( + uchar* data, size_t length, bool atomic, bigtime_t time); - 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(void* data, size_t dataLength, - bigtime_t time); - virtual void SystemCommon(uchar statusByte, uchar data1, uchar data2, - bigtime_t time); - virtual void SystemRealTime(uchar statusByte, - bigtime_t time); - virtual void TempoChange(int32 bpm, - bigtime_t time); - virtual void AllNotesOff(bool justChannel, - bigtime_t time); + 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( + void* data, size_t dataLength, 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: + ~BMidiLocalConsumer(); private: - friend class BMidiRoster; friend class BMidiDispatcher; + friend class BMidiRoster; virtual void _Reserved1(); virtual void _Reserved2(); @@ -91,12 +104,12 @@ private: virtual void _Reserved7(); virtual void _Reserved8(); - BMidiDispatcher *fDispatcher; + BMidiDispatcher* fDispatcher; bigtime_t fTimeout; - void *fTimeoutData; + void* fTimeoutData; int32 fCurrentProducer; uint32 _reserved[1]; }; -#endif +#endif // _MIDI_CONSUMER_H diff --git a/headers/os/midi2/MidiEndpoint.h b/headers/os/midi2/MidiEndpoint.h index 73e16c3058..0ac72ccd05 100644 --- a/headers/os/midi2/MidiEndpoint.h +++ b/headers/os/midi2/MidiEndpoint.h @@ -1,29 +1,21 @@ + #ifndef _MIDI_ENDPOINT_H #define _MIDI_ENDPOINT_H -#ifndef _BE_BUILD_H #include -#endif #include #include - #include -class BMidiList; -class BList; - class BMidiProducer; class BMidiConsumer; -class BMidiList; - -// dynamic_cast (ptr_to_endpoint) - class BMidiEndpoint { public: - const char *Name() const; - void SetName(const char *name); + + const char* Name() const; + void SetName(const char* name); int32 ID() const; @@ -37,25 +29,24 @@ public: status_t Release(); status_t Acquire(); - status_t SetProperties(const BMessage *props); - status_t GetProperties(BMessage *props) const; + status_t SetProperties(const BMessage* properties); + status_t GetProperties(BMessage* properties) const; status_t Register(void); status_t Unregister(void); private: - friend class BMidiRoster; - friend class BMidiProducer; + friend class BMidiConsumer; - friend class BMidiLocalProducer; 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(); - BMidiEndpoint(const BMidiEndpoint &) {} - BMidiEndpoint& operator=(const BMidiEndpoint &) { return *this; } - + virtual void _Reserved1(); virtual void _Reserved2(); virtual void _Reserved3(); @@ -65,14 +56,23 @@ private: virtual void _Reserved7(); virtual void _Reserved8(); - int32 fID; - BString fName; - status_t fStatus; + status_t SendRegisterRequest(bool); + status_t SendChangeRequest(BMessage*); + + 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]; }; -#endif +#endif // _MIDI_ENDPOINT_H diff --git a/headers/os/midi2/MidiProducer.h b/headers/os/midi2/MidiProducer.h index 1479d8a1da..4c86e362a1 100644 --- a/headers/os/midi2/MidiProducer.h +++ b/headers/os/midi2/MidiProducer.h @@ -1,24 +1,28 @@ -#ifndef _MIDI_SOURCE_H -#define _MIDI_SOURCE_H + +#ifndef _MIDI_PRODUCER_H +#define _MIDI_PRODUCER_H #include #include -class BMidiEvent; +class BList; class BMidiProducer : public BMidiEndpoint { public: - status_t Connect(BMidiConsumer *toObject); - status_t Disconnect(BMidiConsumer *toObject); - bool IsConnected(BMidiConsumer *toObject) const; + + status_t Connect(BMidiConsumer* cons); + status_t Disconnect(BMidiConsumer* cons); + bool IsConnected(BMidiConsumer* cons) const; BList* Connections() const; private: + friend class BMidiLocalProducer; friend class BMidiRoster; + friend class BMidiRosterLooper; - BMidiProducer(const char *name = NULL); + BMidiProducer(const char* name = NULL); virtual ~BMidiProducer(); virtual void _Reserved1(); @@ -29,54 +33,80 @@ private: virtual void _Reserved6(); virtual void _Reserved7(); virtual void _Reserved8(); - - BMidiList *fConnections; - mutable BLocker fLock; - - int fConnectionCount; - uint32 _reserved[1]; + + status_t SendConnectRequest(BMidiConsumer*, bool); + void ConnectionMade(BMidiConsumer*); + bool ConnectionBroken(BMidiConsumer*); + + int32 CountConsumers() const; + BMidiConsumer* ConsumerAt(int32) const; + + bool LockProducer() const; + void UnlockProducer() const; + + BList* connections; + BLocker* locker; + + uint32 _reserved[10]; }; class BMidiLocalProducer : public BMidiProducer { public: - BMidiLocalProducer(const char *name = NULL); + + BMidiLocalProducer(const char* name = NULL); - virtual void Connected(BMidiConsumer *dest); - virtual void Disconnected(BMidiConsumer *dest); + virtual void Connected(BMidiConsumer* cons); + virtual void Disconnected(BMidiConsumer* cons); - // Spray some MIDI data downstream to the targets of this object - void SprayData(void *data, size_t length, - bool atomic = false, bigtime_t time = 0) const; + void SprayData( + void* data, size_t length, bool atomic = false, + bigtime_t time = 0) const; - 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(void* data, size_t dataLength, - bigtime_t time = 0) const; - void SpraySystemCommon(uchar statusByte, uchar data1, uchar data2, - bigtime_t time = 0) const; - void SpraySystemRealTime(uchar statusByte, - bigtime_t time = 0) const; - void SprayTempoChange(int32 bpm, - bigtime_t time = 0) const; + 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( + 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: + ~BMidiLocalProducer(); private: - void SprayEvent(BMidiEvent *event, size_t length) const; + + //void SprayEvent(BMidiEvent* event, size_t length) const; virtual void _Reserved1(); virtual void _Reserved2(); @@ -90,4 +120,4 @@ private: uint32 _reserved[2]; }; -#endif +#endif // _MIDI_PRODUCER_H diff --git a/headers/os/midi2/MidiRoster.h b/headers/os/midi2/MidiRoster.h index e72e2876fe..4e1163c43a 100644 --- a/headers/os/midi2/MidiRoster.h +++ b/headers/os/midi2/MidiRoster.h @@ -21,70 +21,38 @@ enum BMidiOp class BMidiProducer; class BMidiConsumer; -class BMidiRosterLooper; class BMidiRoster { 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 = - // be:type = "producer" | "consumer" - // - // be:op = B_MIDI_CHANGED_NAME - // be:id = - // be:type = "producer" | "consumer" - // be:name = - // - // be:op = B_MIDI_CHANGED_LATENCY - // be:id = - // be:type = "producer" | "consumer" - // be:latency = - // - // be:op = B_MIDI_CHANGED_PROPERTIES - // be:id = - // be:type = "producer" | "consumer" - // be:properties = - // - // be:op = B_MIDI_CONNECTED (when source->Connect(sink) happens) - // be:producer = - connector id (0 if not a public object) - // be:consumer = - connectee id (0 if not a public object) - // - // be:op = B_MIDI_DISCONNECTED (when source->Connect(sink) happens) - // be:producer = - connector id (0 if not a public object) - // be:consumer = - 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: - friend class BMidiEndpoint; - friend class BMidiProducer; + friend class BMidiConsumer; + friend class BMidiEndpoint; friend class BMidiLocalProducer; friend class BMidiLocalConsumer; + friend class BMidiProducer; + friend class BMidiRosterKiller; friend class BMidiRosterLooper; - friend class MidiRosterApp; - - BMidiRoster(BMessenger *remote = NULL); + + BMidiRoster(); virtual ~BMidiRoster(); virtual void _Reserved1(); @@ -96,37 +64,15 @@ private: virtual void _Reserved7(); virtual void _Reserved8(); - status_t RemoteConnect(int32 producer, int32 consumer, int32 port); - status_t RemoteDisconnect(int32 producer, int32 consumer); - void RemoteConnected(int32 producer, int32 consumer); - void RemoteDisconnected(int32 producer, int32 consumer); - - BMidiEndpoint* RemoteCreateProducer(int32 producer, const char *name); - BMidiEndpoint* RemoteCreateConsumer(int32 consumer, const char *name, int32 port, int32 latency); - 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; - + void CreateLocal(BMidiEndpoint*); + void DeleteLocal(BMidiEndpoint*); + + status_t SendRequest(BMessage*, BMessage*); + + BMidiRosterLooper* looper; + BMessenger* server; + uint32 _reserved[16]; }; -#endif +#endif // _MIDI_ROSTER_H diff --git a/headers/private/midi/debug.h b/headers/private/midi/debug.h index 5d689f403f..b79c8c79cc 100644 --- a/headers/private/midi/debug.h +++ b/headers/private/midi/debug.h @@ -4,25 +4,36 @@ * Debug macros for the Midi Kit * * @author Matthijs Hollemans - * @author Marcus Overhagen */ #ifndef MIDI_DEBUG_H #define MIDI_DEBUG_H +#include #include -#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; } -#define UNIMPLEMENTED TRACE(("[midi] UNIMPLEMENTED %s\n",__PRETTY_FUNCTION__)) +#ifdef DEBUG + +#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 #define TRACE(args) -#define UNIMPLEMENTED +#define ASSERT(expr) #endif #endif // MIDI_DEBUG_H -