aboutsummaryrefslogtreecommitdiff
path: root/engines/groovie
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/groovie
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/groovie')
-rw-r--r--engines/groovie/music.cpp36
-rw-r--r--engines/groovie/music.h8
2 files changed, 3 insertions, 41 deletions
diff --git a/engines/groovie/music.cpp b/engines/groovie/music.cpp
index 7651576828..1921d65b41 100644
--- a/engines/groovie/music.cpp
+++ b/engines/groovie/music.cpp
@@ -264,12 +264,6 @@ int MusicPlayerMidi::open() {
return 0;
}
-bool MusicPlayerMidi::isOpen() const {
- return _driver && _driver->isOpen();
-}
-
-void MusicPlayerMidi::close() {}
-
void MusicPlayerMidi::send(uint32 b) {
if ((b & 0xFFF0) == 0x07B0) { // Volume change
// Save the specific channel volume
@@ -298,32 +292,6 @@ void MusicPlayerMidi::metaEvent(byte type, byte *data, uint16 length) {
}
}
-void MusicPlayerMidi::setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc) {
- if (_driver)
- _driver->setTimerCallback(timer_param, timer_proc);
-}
-
-uint32 MusicPlayerMidi::getBaseTempo() {
- if (_driver)
- return _driver->getBaseTempo();
- else
- return 0;
-}
-
-MidiChannel *MusicPlayerMidi::allocateChannel() {
- if (_driver)
- return _driver->allocateChannel();
- else
- return 0;
-}
-
-MidiChannel *MusicPlayerMidi::getPercussionChannel() {
- if (_driver)
- return _driver->getPercussionChannel();
- else
- return 0;
-}
-
void MusicPlayerMidi::updateChanVolume(byte channel) {
// Generate a MIDI Control change message for the volume
uint32 b = 0x7B0;
@@ -406,7 +374,7 @@ MusicPlayerXMI::MusicPlayerXMI(GroovieEngine *vm, const Common::String &gtlName)
// Create the driver
MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_GM);
- _driver = createMidi(dev);
+ _driver = MidiDriver::createMidi(dev);
this->open();
// Set the parser's driver
@@ -706,7 +674,7 @@ MusicPlayerMac::MusicPlayerMac(GroovieEngine *vm) : MusicPlayerMidi(vm) {
// Create the driver
MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_GM);
- _driver = createMidi(dev);
+ _driver = MidiDriver::createMidi(dev);
this->open();
// Set the parser's driver
diff --git a/engines/groovie/music.h b/engines/groovie/music.h
index e45e130a70..870fd10b06 100644
--- a/engines/groovie/music.h
+++ b/engines/groovie/music.h
@@ -88,21 +88,15 @@ protected:
virtual void unload();
};
-class MusicPlayerMidi : public MusicPlayer, public MidiDriver {
+class MusicPlayerMidi : public MusicPlayer, public MidiDriver_BASE {
public:
MusicPlayerMidi(GroovieEngine *vm);
~MusicPlayerMidi();
// MidiDriver interface
virtual int open();
- virtual bool isOpen() const;
- virtual void close();
virtual void send(uint32 b);
virtual void metaEvent(byte type, byte *data, uint16 length);
- virtual void setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc);
- virtual uint32 getBaseTempo();
- virtual MidiChannel *allocateChannel();
- virtual MidiChannel *getPercussionChannel();
private:
// Channel volumes