Stop SubLoopingAudioStream playback, in case reading from the parent stream fails.
svn-id: r48021
This commit is contained in:
parent
6a624df560
commit
b097e8635c
1 changed files with 6 additions and 1 deletions
|
@ -187,7 +187,11 @@ int SubLoopingAudioStream::readBuffer(int16 *buffer, const int numSamples) {
|
||||||
int framesRead = _parent->readBuffer(buffer, framesLeft);
|
int framesRead = _parent->readBuffer(buffer, framesLeft);
|
||||||
_pos = _pos.addFrames(framesRead);
|
_pos = _pos.addFrames(framesRead);
|
||||||
|
|
||||||
if (_pos == _loopEnd) {
|
if (framesRead < framesLeft) {
|
||||||
|
// TODO: Proper error indication.
|
||||||
|
_done = true;
|
||||||
|
return framesRead;
|
||||||
|
} else if (_pos == _loopEnd) {
|
||||||
if (_loops != 0) {
|
if (_loops != 0) {
|
||||||
--_loops;
|
--_loops;
|
||||||
if (!_loops) {
|
if (!_loops) {
|
||||||
|
@ -197,6 +201,7 @@ int SubLoopingAudioStream::readBuffer(int16 *buffer, const int numSamples) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_parent->seek(_loopStart)) {
|
if (!_parent->seek(_loopStart)) {
|
||||||
|
// TODO: Proper error indication.
|
||||||
_done = true;
|
_done = true;
|
||||||
return framesRead;
|
return framesRead;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue