diff options
author | David Corrales | 2007-08-05 19:34:20 +0000 |
---|---|---|
committer | David Corrales | 2007-08-05 19:34:20 +0000 |
commit | 6856535010bd2fa4449bcfde1c88dc06cd46e26f (patch) | |
tree | b81a2234c2beff0312c93e039d6cafda4babeca6 /engines/sword2/music.cpp | |
parent | 1400d28bfb37fc94f3c44dec0a4d0cef65fb8fb7 (diff) | |
parent | ec1803f838d5efc7decf75c05a1fb4a9633751e5 (diff) | |
download | scummvm-rg350-6856535010bd2fa4449bcfde1c88dc06cd46e26f.tar.gz scummvm-rg350-6856535010bd2fa4449bcfde1c88dc06cd46e26f.tar.bz2 scummvm-rg350-6856535010bd2fa4449bcfde1c88dc06cd46e26f.zip |
Merged fsnode with trunk: r27971:28460
svn-id: r28462
Diffstat (limited to 'engines/sword2/music.cpp')
-rw-r--r-- | engines/sword2/music.cpp | 54 |
1 files changed, 31 insertions, 23 deletions
diff --git a/engines/sword2/music.cpp b/engines/sword2/music.cpp index 28427e5d1b..c2374dad9f 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; @@ -659,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); + } } /** @@ -668,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); + } } /** @@ -793,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 |