From 67d1cc0cf957d22cb5c6f8b2bf8de4ac02e25f67 Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Wed, 11 Jan 2006 04:28:31 +0000 Subject: [PATCH] Cleanup FF sound. svn-id: r19981 --- simon/sound.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/simon/sound.cpp b/simon/sound.cpp index 000b46d0e43..f7db22de4ba 100644 --- a/simon/sound.cpp +++ b/simon/sound.cpp @@ -462,8 +462,13 @@ void Sound::playSoundData(byte *soundData, uint sound, uint pan, uint vol, bool byte flags; int rate; - if (ambient) { - if (_ambientPaused || sound == _ambientPlaying) + if (ambient == true) { + if (sound == _ambientPlaying) + return; + + _ambientPlaying = sound; + + if (_ambientPaused) return; } else { if (_effectsPaused) @@ -480,10 +485,11 @@ void Sound::playSoundData(byte *soundData, uint sound, uint pan, uint vol, bool byte *buffer = (byte *)malloc(size); memcpy(buffer, soundData + stream.pos(), size); - if (ambient && sound == _ambientPlaying) { - _mixer->playRaw(&_effectsHandle, buffer, size, rate, flags); - } else { + if (ambient == true) { + _mixer->stopHandle(_ambientHandle); _mixer->playRaw(&_ambientHandle, buffer, size, rate, Audio::Mixer::FLAG_LOOP|flags); + } else { + _mixer->playRaw(&_effectsHandle, buffer, size, rate, flags); } }