From f4c0b853cc8453acac0c9e6f6901c0056a2288fa Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 15 Jul 2007 19:24:00 +0000 Subject: Fixed sound factory messup caused by my previous commit svn-id: r28111 --- engines/sword2/music.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'engines/sword2') diff --git a/engines/sword2/music.cpp b/engines/sword2/music.cpp index 28427e5d1b..b442b6194f 100644 --- a/engines/sword2/music.cpp +++ b/engines/sword2/music.cpp @@ -139,21 +139,29 @@ static Audio::AudioStream *getAudioStream(SoundFileHandle *fh, const char *base, } fh->file.seek(pos, SEEK_SET); + + Common::MemoryReadStream *tmp = 0; switch (fh->fileType) { case kCLUMode: return makeCLUStream(&fh->file, enc_len); #ifdef USE_MAD case kMP3Mode: - return Audio::makeMP3Stream(&fh->file, enc_len); + tmp = fh->file.readStream(enc_len); + assert(tmp); + return Audio::makeMP3Stream(tmp, true); #endif #ifdef USE_VORBIS case kVorbisMode: - return Audio::makeVorbisStream(&fh->file, enc_len); + tmp = fh->file.readStream(enc_len); + assert(tmp); + return Audio::makeVorbisStream(tmp, true); #endif #ifdef USE_FLAC case kFlacMode: - return Audio::makeFlacStream(&fh->file, enc_len); + tmp = fh->file.readStream(enc_len); + assert(tmp); + return Audio::makeFlacStream(tmp, true); #endif default: return NULL; -- cgit v1.2.3 From b16d398eb1ad11d3c976ae81427d02609584a571 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sat, 21 Jul 2007 14:39:12 +0000 Subject: The mixer no longer allows unpausing channels that aren't paused. So don't. svn-id: r28155 --- engines/sword2/music.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'engines/sword2') diff --git a/engines/sword2/music.cpp b/engines/sword2/music.cpp index b442b6194f..c2374dad9f 100644 --- a/engines/sword2/music.cpp +++ b/engines/sword2/music.cpp @@ -667,8 +667,10 @@ void Sound::muteSpeech(bool mute) { */ void Sound::pauseSpeech() { - _speechPaused = true; - _vm->_mixer->pauseHandle(_soundHandleSpeech, true); + if (!_speechPaused) { + _speechPaused = true; + _vm->_mixer->pauseHandle(_soundHandleSpeech, true); + } } /** @@ -676,8 +678,10 @@ void Sound::pauseSpeech() { */ void Sound::unpauseSpeech() { - _speechPaused = false; - _vm->_mixer->pauseHandle(_soundHandleSpeech, false); + if (_speechPaused) { + _speechPaused = false; + _vm->_mixer->pauseHandle(_soundHandleSpeech, false); + } } /** @@ -801,26 +805,22 @@ int32 Sound::setFxIdVolumePan(int32 id, int vol, int pan) { } void Sound::pauseFx() { - if (_fxPaused) - return; - - for (int i = 0; i < FXQ_LENGTH; i++) { - if (_fxQueue[i].resource) - _vm->_mixer->pauseHandle(_fxQueue[i].handle, true); + if (!_fxPaused) { + for (int i = 0; i < FXQ_LENGTH; i++) { + if (_fxQueue[i].resource) + _vm->_mixer->pauseHandle(_fxQueue[i].handle, true); + } + _fxPaused = true; } - - _fxPaused = true; } void Sound::unpauseFx() { - if (!_fxPaused) - return; - - for (int i = 0; i < FXQ_LENGTH; i++) - if (_fxQueue[i].resource) - _vm->_mixer->pauseHandle(_fxQueue[i].handle, false); - - _fxPaused = false; + if (_fxPaused) { + for (int i = 0; i < FXQ_LENGTH; i++) + if (_fxQueue[i].resource) + _vm->_mixer->pauseHandle(_fxQueue[i].handle, false); + _fxPaused = false; + } } } // End of namespace Sword2 -- cgit v1.2.3