diff options
author | Colin Snover | 2017-07-17 23:52:12 -0500 |
---|---|---|
committer | Colin Snover | 2017-07-17 23:56:21 -0500 |
commit | dcb6c3221523b19857d0f5fcbb7409140a80e903 (patch) | |
tree | 170acf8e50e2d742fbd83bef0ecdcf93d9fc70a4 | |
parent | 64d090dcb82377daa09587f92b7c00c8f96b3a0c (diff) | |
download | scummvm-rg350-dcb6c3221523b19857d0f5fcbb7409140a80e903.tar.gz scummvm-rg350-dcb6c3221523b19857d0f5fcbb7409140a80e903.tar.bz2 scummvm-rg350-dcb6c3221523b19857d0f5fcbb7409140a80e903.zip |
SCI32: Destroy audio streams in Audio32 using DisposeAfterUse flag
Since Resource::makeStream returns a MemoryReadStream which will
not attempt to free the resource memory, it is fine to always
dispose those streams and get rid of the separate resourceStream
property, which was a holdover from some past WIP resource design
which no longer exists.
-rw-r--r-- | engines/sci/sound/audio32.cpp | 10 | ||||
-rw-r--r-- | engines/sci/sound/audio32.h | 5 |
2 files changed, 4 insertions, 11 deletions
diff --git a/engines/sci/sound/audio32.cpp b/engines/sci/sound/audio32.cpp index 0bef60b465..04d1a47ece 100644 --- a/engines/sci/sound/audio32.cpp +++ b/engines/sci/sound/audio32.cpp @@ -557,8 +557,6 @@ void Audio32::freeChannel(const int16 channelIndex) { channel.resource = nullptr; delete channel.stream; channel.stream = nullptr; - delete channel.resourceStream; - channel.resourceStream = nullptr; } delete channel.converter; @@ -797,14 +795,14 @@ uint16 Audio32::play(int16 channelIndex, const ResourceId resourceId, const bool _monitoredChannelIndex = channelIndex; } - Common::SeekableReadStream *dataStream = channel.resourceStream = resource->makeStream(); + Common::SeekableReadStream *dataStream = resource->makeStream(); Audio::RewindableAudioStream *audioStream; if (detectSolAudio(*dataStream)) { - audioStream = makeSOLStream(dataStream, DisposeAfterUse::NO); + audioStream = makeSOLStream(dataStream, DisposeAfterUse::YES); } else if (detectWaveAudio(*dataStream)) { - audioStream = Audio::makeWAVStream(dataStream, DisposeAfterUse::NO); + audioStream = Audio::makeWAVStream(dataStream, DisposeAfterUse::YES); } else { byte flags = Audio::FLAG_LITTLE_ENDIAN; if (_globalBitDepth == 16) { @@ -817,7 +815,7 @@ uint16 Audio32::play(int16 channelIndex, const ResourceId resourceId, const bool flags |= Audio::FLAG_STEREO; } - audioStream = Audio::makeRawStream(dataStream, _globalSampleRate, flags, DisposeAfterUse::NO); + audioStream = Audio::makeRawStream(dataStream, _globalSampleRate, flags, DisposeAfterUse::YES); } channel.stream = new MutableLoopAudioStream(audioStream, loop); diff --git a/engines/sci/sound/audio32.h b/engines/sci/sound/audio32.h index 59f96a85de..a994113e32 100644 --- a/engines/sci/sound/audio32.h +++ b/engines/sci/sound/audio32.h @@ -52,11 +52,6 @@ struct AudioChannel { Resource *resource; /** - * Data stream containing the raw audio for the channel. - */ - Common::SeekableReadStream *resourceStream; - - /** * The audio stream loaded into this channel. Can cast * to `SeekableAudioStream` for normal channels and * `RobotAudioStream` for robot channels. |