aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sound/audio.cpp
diff options
context:
space:
mode:
authorMax Horn2010-06-15 12:33:54 +0000
committerMax Horn2010-06-15 12:33:54 +0000
commitd570e10b77887fa163f17de512b14fc824f45f33 (patch)
tree44dbf95c8ad21df54d793cf22b2f3590ccb1ef77 /engines/sci/sound/audio.cpp
parent651e2760a3b2de0c542ccbbf1bf3caa319cc0349 (diff)
downloadscummvm-rg350-d570e10b77887fa163f17de512b14fc824f45f33.tar.gz
scummvm-rg350-d570e10b77887fa163f17de512b14fc824f45f33.tar.bz2
scummvm-rg350-d570e10b77887fa163f17de512b14fc824f45f33.zip
Modify makeAIFFStream to match the other sound decoder factories
svn-id: r49844
Diffstat (limited to 'engines/sci/sound/audio.cpp')
-rw-r--r--engines/sci/sound/audio.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/engines/sci/sound/audio.cpp b/engines/sci/sound/audio.cpp
index b0b9a73e00..8dfbc18976 100644
--- a/engines/sci/sound/audio.cpp
+++ b/engines/sci/sound/audio.cpp
@@ -260,9 +260,11 @@ Audio::RewindableAudioStream *AudioPlayer::getAudioStream(uint32 number, uint32
// Compressed audio made by our tool
byte *compressedData = (byte *)malloc(audioRes->size);
assert(compressedData);
- // We copy over the compressed data in our own buffer. If we don't do this resourcemanager may free the data
- // later. All other compression-types already decompress completely into an additional buffer here.
- // MP3/OGG/FLAC decompression works on-the-fly instead.
+ // We copy over the compressed data in our own buffer. We have to do
+ // this, because ResourceManager may free the original data late.
+ // All other compression types already decompress completely into an
+ // additional buffer here. MP3/OGG/FLAC decompression works on-the-fly
+ // instead.
memcpy(compressedData, audioRes->data, audioRes->size);
Common::MemoryReadStream *compressedStream = new Common::MemoryReadStream(compressedData, audioRes->size, DisposeAfterUse::YES);
@@ -319,8 +321,7 @@ Audio::RewindableAudioStream *AudioPlayer::getAudioStream(uint32 number, uint32
*sampleLen = (waveFlags & Audio::FLAG_16BITS ? waveSize >> 1 : waveSize) * 60 / waveRate;
waveStream->seek(0, SEEK_SET);
- audioStream = Audio::makeAIFFStream(*waveStream);
- delete waveStream; // makeAIFFStream doesn't handle this for us
+ audioStream = Audio::makeAIFFStream(waveStream, DisposeAfterUse::YES);
} else if (audioRes->size > 14 && READ_BE_UINT16(audioRes->data) == 1 && READ_BE_UINT16(audioRes->data + 2) == 1
&& READ_BE_UINT16(audioRes->data + 4) == 5 && READ_BE_UINT32(audioRes->data + 10) == 0x00018051) {
// Mac snd detected