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/saga/sound.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/saga/sound.cpp')
-rw-r--r-- | engines/saga/sound.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/engines/saga/sound.cpp b/engines/saga/sound.cpp index 6c2516c8a3..621b3ed310 100644 --- a/engines/saga/sound.cpp +++ b/engines/saga/sound.cpp @@ -83,31 +83,40 @@ void Sound::playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int if (!(_vm->getFeatures() & GF_COMPRESSED_SOUNDS)) { _mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer.buffer, buffer.size, buffer.frequency, flags, -1, volume); } else { - buffer.soundFile->seek((long)buffer.fileOffset, SEEK_SET); Audio::AudioStream *stream = NULL; + Common::MemoryReadStream *tmp = NULL; switch (buffer.soundType) { #ifdef USE_MAD case kSoundMP3: debug(1, "Playing MP3 compressed sound"); - stream = Audio::makeMP3Stream(buffer.soundFile, buffer.size); + buffer.soundFile->seek((long)buffer.fileOffset, SEEK_SET); + tmp = buffer.soundFile->readStream(buffer.size); + assert(tmp); + stream = Audio::makeMP3Stream(tmp, true); break; #endif #ifdef USE_VORBIS case kSoundOGG: debug(1, "Playing OGG compressed sound"); - stream = Audio::makeVorbisStream(buffer.soundFile, buffer.size); + buffer.soundFile->seek((long)buffer.fileOffset, SEEK_SET); + tmp = buffer.soundFile->readStream(buffer.size); + assert(tmp); + stream = Audio::makeVorbisStream(tmp, true); break; #endif #ifdef USE_FLAC case kSoundFLAC: debug(1, "Playing FLAC compressed sound"); - stream = Audio::makeFlacStream(buffer.soundFile, buffer.size); + buffer.soundFile->seek((long)buffer.fileOffset, SEEK_SET); + tmp = buffer.soundFile->readStream(buffer.size); + assert(tmp); + stream = Audio::makeFlacStream(tmp, true); break; #endif default: - // Unknown compression - error("Trying to play a compressed sound, but the compression is not known"); + // No compression, play it as raw sound + _mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer.buffer, buffer.size, buffer.frequency, flags, -1, volume); break; } |