aboutsummaryrefslogtreecommitdiff
path: root/audio/audiostream.cpp
diff options
context:
space:
mode:
authorMatthew Hoops2014-08-01 01:39:46 -0400
committerMatthew Hoops2014-08-01 01:39:46 -0400
commitd8ef40879ca8f9d05384135ad2383f3677cb38cf (patch)
tree49754c61987092e4c65375a2ebf8d09bb34474b2 /audio/audiostream.cpp
parent82d464367b1060003886b1a331a03f5ca099499f (diff)
downloadscummvm-rg350-d8ef40879ca8f9d05384135ad2383f3677cb38cf.tar.gz
scummvm-rg350-d8ef40879ca8f9d05384135ad2383f3677cb38cf.tar.bz2
scummvm-rg350-d8ef40879ca8f9d05384135ad2383f3677cb38cf.zip
AUDIO: Better handle endOfStream() vs endOfData() in SubLoopingAudioStream
Diffstat (limited to 'audio/audiostream.cpp')
-rw-r--r--audio/audiostream.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/audio/audiostream.cpp b/audio/audiostream.cpp
index fbf672ca22..c413edb73d 100644
--- a/audio/audiostream.cpp
+++ b/audio/audiostream.cpp
@@ -193,7 +193,7 @@ int SubLoopingAudioStream::readBuffer(int16 *buffer, const int numSamples) {
int framesRead = _parent->readBuffer(buffer, framesLeft);
_pos = _pos.addFrames(framesRead);
- if (framesRead < framesLeft && _parent->endOfData()) {
+ if (framesRead < framesLeft && _parent->endOfStream()) {
// TODO: Proper error indication.
_done = true;
return framesRead;
@@ -220,6 +220,18 @@ int SubLoopingAudioStream::readBuffer(int16 *buffer, const int numSamples) {
}
}
+bool SubLoopingAudioStream::endOfData() const {
+ // We're out of data if this stream is finished or the parent
+ // has run out of data for now.
+ return _done || _parent->endOfData();
+}
+
+bool SubLoopingAudioStream::endOfStream() const {
+ // The end of the stream has been reached only when we've gone
+ // through all the iterations.
+ return _done;
+}
+
#pragma mark -
#pragma mark --- SubSeekableAudioStream ---
#pragma mark -