aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sound
diff options
context:
space:
mode:
authorColin Snover2017-07-17 23:52:12 -0500
committerColin Snover2017-07-17 23:56:21 -0500
commitdcb6c3221523b19857d0f5fcbb7409140a80e903 (patch)
tree170acf8e50e2d742fbd83bef0ecdcf93d9fc70a4 /engines/sci/sound
parent64d090dcb82377daa09587f92b7c00c8f96b3a0c (diff)
downloadscummvm-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.
Diffstat (limited to 'engines/sci/sound')
-rw-r--r--engines/sci/sound/audio32.cpp10
-rw-r--r--engines/sci/sound/audio32.h5
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.