From e4b1a7e709be3baac54b47dc805deec7faee847b Mon Sep 17 00:00:00 2001 From: Jamieson Christian Date: Sat, 21 Dec 2002 21:32:45 +0000 Subject: MidiStreamer no longer derives from MidiDriver. Removed MidiStreamer methods that weren't actually needed. That's one layer of indirection removed from Simon music. svn-id: r6050 --- simon/midi.cpp | 2 +- sound/mididrv.h | 12 ------------ sound/midistreamer.cpp | 4 ++-- sound/midistreamer.h | 30 +++++++++++++++--------------- 4 files changed, 18 insertions(+), 30 deletions(-) diff --git a/simon/midi.cpp b/simon/midi.cpp index 1dbd4db623..4437947144 100644 --- a/simon/midi.cpp +++ b/simon/midi.cpp @@ -274,7 +274,7 @@ bool MidiPlayer::fill_helper(NoteRec *nr, MidiEvent *me) // _midi_var8 = (_currentSong->ppqn * 60000) / tempo; me->delta = b; - me->event = (MidiDriver::ME_TEMPO << 24) | tempo; + me->event = (MidiStreamer::ME_TEMPO << 24) | tempo; return true; } diff --git a/sound/mididrv.h b/sound/mididrv.h index ea9f1210b2..a4373ff3b3 100644 --- a/sound/mididrv.h +++ b/sound/mididrv.h @@ -27,22 +27,10 @@ class MidiChannel; -struct MidiEvent { - uint32 delta; - uint32 event; -}; - // Abstract MIDI Driver Class class MidiDriver { public: - // Special events that can be inserted in a MidiEvent. - // event = (ME_xxx<<24) | <24-bit data associated with event> - enum { - ME_NONE = 0, - ME_TEMPO = 1, - }; - // Error codes returned by open. // Can be converted to a string with getErrorName() enum { diff --git a/sound/midistreamer.cpp b/sound/midistreamer.cpp index c8863028ab..fef0faf268 100644 --- a/sound/midistreamer.cpp +++ b/sound/midistreamer.cpp @@ -86,7 +86,7 @@ int MidiStreamer::open() close(); int res = _target->open(); - if (res && res != MERR_ALREADY_OPEN) + if (res && res != MidiDriver::MERR_ALREADY_OPEN) return res; _event_index = _event_count = _delay = 0; @@ -121,7 +121,7 @@ uint32 MidiStreamer::property (int prop, uint32 param) switch (prop) { // 16-bit time division according to standard midi specification - case PROP_TIMEDIV: + case MidiDriver::PROP_TIMEDIV: _ticks_per_beat = (uint16)param; return 1; } diff --git a/sound/midistreamer.h b/sound/midistreamer.h index f1158e8b45..6e598104b2 100644 --- a/sound/midistreamer.h +++ b/sound/midistreamer.h @@ -26,16 +26,25 @@ class MidiStreamer; #include "mididrv.h" -class MidiStreamer : public MidiDriver { +struct MidiEvent { + uint32 delta; + uint32 event; +}; + +class MidiStreamer { public: - /* called whenever the midi driver is in streaming mode, - * and more midi commands need to be generated - * return 0 to tell the mididriver that the end of stream was reached - */ + // Called whenever more MIDI commands need to be generated. + // Return 0 to tell MidiStreamer that end of stream was reached. typedef int StreamCallback (void *param, MidiEvent * ev, int num); -private: + // Special events that can be inserted in a MidiEvent. + // event = (ME_xxx<<24) | <24-bit data associated with event> + enum { + ME_NONE = 0, + ME_TEMPO = 1, + }; +private: MidiDriver *_target; StreamCallback *_stream_proc; void *_stream_param; @@ -55,23 +64,14 @@ private: void on_timer(); public: - MidiStreamer (MidiDriver *target); int open(); void close(); void send(uint32 b) { if (_isOpen) _target->send (b); } uint32 property(int prop, uint32 param); - void setPitchBendRange (byte channel, uint range) { _target->setPitchBendRange (channel, range); } - void pause(bool p) { _paused = p; } void set_stream_callback(void *param, StreamCallback *sc); - - void setTimerCallback (void *timer_param, void (*timer_proc) (void *)) { } - uint32 getBaseTempo (void) { return _target->getBaseTempo(); } - - MidiChannel *allocateChannel() { return NULL; } - MidiChannel *getPercussionChannel() { return NULL; } }; #endif -- cgit v1.2.3