AUDIO: Better handle endOfStream() vs endOfData() in LoopingAudioStream
This commit is contained in:
parent
931e2e16f7
commit
82d464367b
2 changed files with 8 additions and 3 deletions
|
@ -98,7 +98,7 @@ LoopingAudioStream::LoopingAudioStream(RewindableAudioStream *stream, uint loops
|
|||
// TODO: Properly indicate error
|
||||
_loops = _completeIterations = 1;
|
||||
}
|
||||
if (stream->endOfData()) {
|
||||
if (stream->endOfStream()) {
|
||||
// Apparently this is an empty stream
|
||||
_loops = _completeIterations = 1;
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ int LoopingAudioStream::readBuffer(int16 *buffer, const int numSamples) {
|
|||
_loops = _completeIterations = 1;
|
||||
return samplesRead;
|
||||
}
|
||||
if (_parent->endOfData()) {
|
||||
if (_parent->endOfStream()) {
|
||||
// Apparently this is an empty stream
|
||||
_loops = _completeIterations = 1;
|
||||
}
|
||||
|
@ -134,7 +134,11 @@ int LoopingAudioStream::readBuffer(int16 *buffer, const int numSamples) {
|
|||
}
|
||||
|
||||
bool LoopingAudioStream::endOfData() const {
|
||||
return (_loops != 0 && (_completeIterations == _loops));
|
||||
return (_loops != 0 && _completeIterations == _loops) || _parent->endOfData();
|
||||
}
|
||||
|
||||
bool LoopingAudioStream::endOfStream() const {
|
||||
return _loops != 0 && _completeIterations == _loops;
|
||||
}
|
||||
|
||||
AudioStream *makeLoopingAudioStream(RewindableAudioStream *stream, uint loops) {
|
||||
|
|
|
@ -118,6 +118,7 @@ public:
|
|||
|
||||
int readBuffer(int16 *buffer, const int numSamples);
|
||||
bool endOfData() const;
|
||||
bool endOfStream() const;
|
||||
|
||||
bool isStereo() const { return _parent->isStereo(); }
|
||||
int getRate() const { return _parent->getRate(); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue