mirror of
https://github.com/libretro/scummvm.git
synced 2024-11-27 11:20:40 +00:00
AUDIO: Better handle endOfStream() vs endOfData() in SubLoopingAudioStream
This commit is contained in:
parent
82d464367b
commit
d8ef40879c
@ -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 -
|
||||
|
@ -248,7 +248,8 @@ public:
|
||||
DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES);
|
||||
|
||||
int readBuffer(int16 *buffer, const int numSamples);
|
||||
bool endOfData() const { return _done; }
|
||||
bool endOfData() const;
|
||||
bool endOfStream() const;
|
||||
|
||||
bool isStereo() const { return _parent->isStereo(); }
|
||||
int getRate() const { return _parent->getRate(); }
|
||||
|
Loading…
Reference in New Issue
Block a user