aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/sound_midi.cpp
diff options
context:
space:
mode:
authorMax Horn2011-03-23 15:23:26 +0100
committerMax Horn2011-03-23 15:25:47 +0100
commit29847ea42da3e597d3496972c80ce49bea76da20 (patch)
tree654596bc11032f28d9b2a776571fdb7623ceb5c6 /engines/kyra/sound_midi.cpp
parentc70c8864f131bfe42437b05d03f77ab198f59247 (diff)
downloadscummvm-rg350-29847ea42da3e597d3496972c80ce49bea76da20.tar.gz
scummvm-rg350-29847ea42da3e597d3496972c80ce49bea76da20.tar.bz2
scummvm-rg350-29847ea42da3e597d3496972c80ce49bea76da20.zip
AUDIO: Change several fake MidiDrivers to MidiDriver_BASE subclasses
Many engines follow the advice in audio/midiparser.h and create a "pseudo-MidiDriver" subclass. But MidiParser really only needs a tiny subset of the MidiDriver capabilities, namely those found in MidiDriver_BASE. So we try to subclass from that whenever possible; this allows us to remove many stub methods, and enables further future simplifications.
Diffstat (limited to 'engines/kyra/sound_midi.cpp')
-rw-r--r--engines/kyra/sound_midi.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/engines/kyra/sound_midi.cpp b/engines/kyra/sound_midi.cpp
index 903375c362..02ba735a70 100644
--- a/engines/kyra/sound_midi.cpp
+++ b/engines/kyra/sound_midi.cpp
@@ -33,7 +33,7 @@
namespace Kyra {
-class MidiOutput : public MidiDriver {
+class MidiOutput : public MidiDriver_BASE {
public:
MidiOutput(OSystem *system, MidiDriver *output, bool isMT32, bool defaultMT32);
~MidiOutput();
@@ -46,20 +46,16 @@ public:
void setSoundSource(int source) { _curSource = source; }
- void send(uint32 b);
- void sysEx(const byte *msg, uint16 length);
- void metaEvent(byte type, byte *data, uint16 length);
+ // MidiDriver_BASE interface
+ virtual void send(uint32 b);
+ virtual void sysEx(const byte *msg, uint16 length);
+ virtual void metaEvent(byte type, byte *data, uint16 length);
+ // TODO: Get rid of the following two methods
void setTimerCallback(void *timerParam, void (*timerProc)(void *)) { _output->setTimerCallback(timerParam, timerProc); }
uint32 getBaseTempo() { return _output->getBaseTempo(); }
- // DUMMY
- int open() { return 0; }
- bool isOpen() const { return true; }
- void close() {}
- MidiChannel *allocateChannel() { return 0; }
- MidiChannel *getPercussionChannel() { return 0; }
private:
void sendIntern(const byte event, const byte channel, byte param1, const byte param2);
void sendSysEx(const byte p1, const byte p2, const byte p3, const byte *buffer, const int size);
@@ -266,7 +262,7 @@ void MidiOutput::sendIntern(const byte event, const byte channel, byte param1, c
if (event == 0xC0) {
// MT32 -> GM conversion
if (!_isMT32 && _defaultMT32)
- param1 = _mt32ToGm[param1];
+ param1 = MidiDriver::_mt32ToGm[param1];
}
_output->send(event | channel, param1, param2);