diff options
author | Filippos Karapetis | 2009-08-17 11:06:27 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-08-17 11:06:27 +0000 |
commit | 3dfb1c3a96efc5dcd6e220ff5d8698d90c8be4de (patch) | |
tree | 01c1c40846f201a7d44eb1e900bbb2e47ab25128 | |
parent | b0a5ec8947be27ba8fb99a17f0da905994bd7cd6 (diff) | |
download | scummvm-rg350-3dfb1c3a96efc5dcd6e220ff5d8698d90c8be4de.tar.gz scummvm-rg350-3dfb1c3a96efc5dcd6e220ff5d8698d90c8be4de.tar.bz2 scummvm-rg350-3dfb1c3a96efc5dcd6e220ff5d8698d90c8be4de.zip |
Made sound effect playing code consistent for compressed and uncompressed sounds. MemoryReadStream is used again instead of SeekableSubReadStream, as there will be issues when multiple sound effects or voices are played simultaneously
svn-id: r43466
-rw-r--r-- | engines/saga/sndres.cpp | 6 | ||||
-rw-r--r-- | engines/saga/sound.cpp | 11 | ||||
-rw-r--r-- | engines/saga/sound.h | 1 |
3 files changed, 9 insertions, 9 deletions
diff --git a/engines/saga/sndres.cpp b/engines/saga/sndres.cpp index b2744482bd..b2ffe55e5b 100644 --- a/engines/saga/sndres.cpp +++ b/engines/saga/sndres.cpp @@ -365,9 +365,13 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff buffer.size = soundResourceLength; buffer.soundType = resourceType; - buffer.soundFile = context->getFile(resourceData); buffer.fileOffset = resourceData->offset + 9; // skip compressed sfx header: byte + uint16 + uint32 + byte + byte + if (!onlyHeader) { + buffer.buffer = (byte *)malloc(buffer.size); + readS.read(buffer.buffer, buffer.size); + } + result = true; break; default: diff --git a/engines/saga/sound.cpp b/engines/saga/sound.cpp index 41d3b522b7..202ce918de 100644 --- a/engines/saga/sound.cpp +++ b/engines/saga/sound.cpp @@ -91,25 +91,22 @@ void Sound::playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int _mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer.buffer, buffer.size, buffer.frequency, flags, -1, volume); } else { - Audio::AudioStream *stream = NULL; - Common::SeekableSubReadStream *soundStream = - new Common::SeekableSubReadStream(buffer.soundFile, (uint32)buffer.fileOffset + 9, - (uint32)buffer.fileOffset + buffer.size - 9); + Audio::AudioStream *stream = 0; switch (buffer.soundType) { #ifdef USE_MAD case kSoundMP3: - stream = Audio::makeMP3Stream(soundStream, true); + stream = Audio::makeMP3Stream(new Common::MemoryReadStream(buffer.buffer, buffer.size, true), true); break; #endif #ifdef USE_VORBIS case kSoundOGG: - stream = Audio::makeVorbisStream(soundStream, true); + stream = Audio::makeVorbisStream(new Common::MemoryReadStream(buffer.buffer, buffer.size, true), true); break; #endif #ifdef USE_FLAC case kSoundFLAC: - stream = Audio::makeFlacStream(soundStream, true); + stream = Audio::makeFlacStream(new Common::MemoryReadStream(buffer.buffer, buffer.size, true), true); break; #endif default: diff --git a/engines/saga/sound.h b/engines/saga/sound.h index b61cbbbe90..7650357a78 100644 --- a/engines/saga/sound.h +++ b/engines/saga/sound.h @@ -54,7 +54,6 @@ struct SoundBuffer { size_t originalSize; bool isBigEndian; GameSoundTypes soundType; - Common::File *soundFile; size_t fileOffset; }; |