diff options
Diffstat (limited to 'engines/mohawk/sound.cpp')
-rw-r--r-- | engines/mohawk/sound.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/engines/mohawk/sound.cpp b/engines/mohawk/sound.cpp index b84573f011..091bd68021 100644 --- a/engines/mohawk/sound.cpp +++ b/engines/mohawk/sound.cpp @@ -27,12 +27,12 @@ #include "common/util.h" +#include "sound/musicplugin.h" #include "sound/audiostream.h" #include "sound/decoders/mp3.h" #include "sound/decoders/raw.h" #include "sound/decoders/wave.h" - namespace Mohawk { Sound::Sound(MohawkEngine* vm) : _vm(vm) { @@ -79,7 +79,7 @@ void Sound::initMidi() { // Let's get our MIDI parser/driver _midiParser = MidiParser::createParser_SMF(); - _midiDriver = MidiDriver::createMidi(MidiDriver::detectMusicDriver(MDT_ADLIB|MDT_MIDI)); + _midiDriver = MidiDriver::createMidi(MidiDriver::detectDevice(MDT_ADLIB|MDT_MIDI)); // Set up everything! _midiDriver->open(); @@ -233,6 +233,10 @@ void Sound::playSLST(uint16 index, uint16 card) { if (slstRecord.index == index) { playSLST(slstRecord); + delete[] slstRecord.sound_ids; + delete[] slstRecord.volumes; + delete[] slstRecord.balances; + delete[] slstRecord.u2; delete slstStream; return; } @@ -244,6 +248,7 @@ void Sound::playSLST(uint16 index, uint16 card) { } delete slstStream; + // No matching records, assume we need to stop all SLST's stopAllSLST(); } @@ -277,8 +282,11 @@ void Sound::playSLST(SLSTRecord slstRecord) { } void Sound::stopAllSLST() { - for (uint16 i = 0; i < _currentSLSTSounds.size(); i++) + for (uint16 i = 0; i < _currentSLSTSounds.size(); i++) { _vm->_mixer->stopHandle(*_currentSLSTSounds[i].handle); + delete _currentSLSTSounds[i].handle; + } + _currentSLSTSounds.clear(); } @@ -314,6 +322,7 @@ void Sound::playSLSTSound(uint16 id, bool fade, bool loop, uint16 volume, int16 void Sound::stopSLSTSound(uint16 index, bool fade) { // TODO: Fade out, mixer needs to be extended to get volume on a handle _vm->_mixer->stopHandle(*_currentSLSTSounds[index].handle); + delete _currentSLSTSounds[index].handle; _currentSLSTSounds.remove_at(index); } |