diff options
author | Max Horn | 2011-03-23 16:14:39 +0100 |
---|---|---|
committer | Max Horn | 2011-03-23 16:49:41 +0100 |
commit | e70fd59b3505619cccb6f3280a4cf0fb57aefa97 (patch) | |
tree | 055c9719a41c4706baa4e5c4837e5fd31da95486 /engines/hugo | |
parent | 29847ea42da3e597d3496972c80ce49bea76da20 (diff) | |
download | scummvm-rg350-e70fd59b3505619cccb6f3280a4cf0fb57aefa97.tar.gz scummvm-rg350-e70fd59b3505619cccb6f3280a4cf0fb57aefa97.tar.bz2 scummvm-rg350-e70fd59b3505619cccb6f3280a4cf0fb57aefa97.zip |
ENGINES: Further simplify pseudo MidiDrivers; fix some regressions
The regression affected AGOS and maybe some others; specifically,
the real MidiDriver would have been deleted twice -- I previously
missed that the Engine instances takes care of freeing the real
MidiDriver, not the MidiPlayer wrapping it.
This commit should clarify the ownership of the real MidiDriver for
most pseudo MidiDrivers.
Diffstat (limited to 'engines/hugo')
-rw-r--r-- | engines/hugo/sound.cpp | 24 | ||||
-rw-r--r-- | engines/hugo/sound.h | 9 |
2 files changed, 14 insertions, 19 deletions
diff --git a/engines/hugo/sound.cpp b/engines/hugo/sound.cpp index daa467f517..f80faea5aa 100644 --- a/engines/hugo/sound.cpp +++ b/engines/hugo/sound.cpp @@ -60,7 +60,16 @@ MidiPlayer::MidiPlayer(MidiDriver *driver) } MidiPlayer::~MidiPlayer() { - close(); + stop(); + + Common::StackLock lock(_mutex); + _driver->setTimerCallback(0, 0); + _driver->close(); + delete _driver; + _driver = 0; + if (_parser) + _parser->setMidiDriver(0); + delete _parser; } bool MidiPlayer::isPlaying() const { @@ -179,19 +188,6 @@ int MidiPlayer::open() { return 0; } -void MidiPlayer::close() { - stop(); - - Common::StackLock lock(_mutex); - _driver->setTimerCallback(0, 0); - _driver->close(); - delete _driver; - _driver = 0; - if (_parser) - _parser->setMidiDriver(0); - delete _parser; -} - void MidiPlayer::send(uint32 b) { byte volume, ch = (byte)(b & 0xF); debugC(9, kDebugMusic, "MidiPlayer::send, channel %d (volume is %d)", ch, _channelsVolume[ch]); diff --git a/engines/hugo/sound.h b/engines/hugo/sound.h index c8f4ae50da..cdde8cc130 100644 --- a/engines/hugo/sound.h +++ b/engines/hugo/sound.h @@ -58,12 +58,11 @@ public: void syncVolume(); void updateTimer(); - // MidiDriver interface - int open(); - void close(); - void metaEvent(byte type, byte *data, uint16 length); - void send(uint32 b); + // MidiDriver_BASE interface + virtual void metaEvent(byte type, byte *data, uint16 length); + virtual void send(uint32 b); + int open(); uint32 getBaseTempo(); private: |