diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/mohawk/sound.cpp | 12 | ||||
-rw-r--r-- | engines/mohawk/sound.h | 1 |
2 files changed, 5 insertions, 8 deletions
diff --git a/engines/mohawk/sound.cpp b/engines/mohawk/sound.cpp index 41d7000ad8..29a097e591 100644 --- a/engines/mohawk/sound.cpp +++ b/engines/mohawk/sound.cpp @@ -73,10 +73,6 @@ void Sound::initMidi() { Audio::SoundHandle *Sound::playSound(uint16 id, byte volume, bool loop) { debug (0, "Playing sound %d", id); - SndHandle *handle = getHandle(); - handle->type = kUsedHandle; - handle->id = id; - Audio::AudioStream *audStream = NULL; switch (_vm->getGameType()) { @@ -96,8 +92,6 @@ Audio::SoundHandle *Sound::playSound(uint16 id, byte volume, bool loop) { audStream = Audio::makeWAVStream(_vm->getResource(ID_MSND, id), DisposeAfterUse::YES); } else audStream = makeMohawkWaveStream(_vm->getResource(ID_MSND, id)); - - handle->name = _vm->getResourceName(ID_MSND, id); break; case GType_ZOOMBINI: audStream = makeMohawkWaveStream(_vm->getResource(ID_SND, id)); @@ -110,6 +104,10 @@ Audio::SoundHandle *Sound::playSound(uint16 id, byte volume, bool loop) { } if (audStream) { + SndHandle *handle = getHandle(); + handle->type = kUsedHandle; + handle->id = id; + // Set the stream to loop here if it's requested if (loop) audStream = Audio::makeLoopingAudioStream((Audio::RewindableAudioStream *)audStream, 0); @@ -131,7 +129,7 @@ Audio::SoundHandle *Sound::replaceSound(uint16 id, byte volume, bool loop) { // Check if sound is already playing for (uint32 i = 0; i < _handles.size(); i++) { if (_vm->_mixer->isSoundHandleActive(_handles[i].handle) - && name.equals(_handles[i].name)) { + && name.equals(_vm->getResourceName(ID_MSND, _handles[i].id))) { return &_handles[i].handle; } } diff --git a/engines/mohawk/sound.h b/engines/mohawk/sound.h index 340d6fae2f..bbd7f963da 100644 --- a/engines/mohawk/sound.h +++ b/engines/mohawk/sound.h @@ -66,7 +66,6 @@ struct SndHandle { Audio::SoundHandle handle; SndHandleType type; uint16 id; - Common::String name; }; struct SLSTSndHandle { |