Rearranged comparison to prevent underflow.
This commit is contained in:
parent
d8df7afcbb
commit
876efcde38
1 changed files with 9 additions and 9 deletions
|
@ -370,14 +370,14 @@ audio_linear_round(unsigned int bits,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_framesDecoded + (sampleCount - startingSample) > totalFrames - _endPadding) {
|
if (_framesDecoded + sampleCount + _endPadding > totalFrames + startingSample ) {
|
||||||
sampleCount = totalFrames - _endPadding - _framesDecoded + startingSample;
|
|
||||||
// NSLog(@"End of file. %li", totalFrames - _endPadding - _framesDecoded);
|
// NSLog(@"End of file. %li", totalFrames - _endPadding - _framesDecoded);
|
||||||
|
sampleCount = totalFrames + startingSample - _endPadding - _framesDecoded;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startingSample > sampleCount) {
|
if (startingSample > sampleCount) {
|
||||||
_framesDecoded += _synth.pcm.length;
|
|
||||||
// NSLog(@"Skipping entire sample");
|
// NSLog(@"Skipping entire sample");
|
||||||
|
_framesDecoded += _synth.pcm.length;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue