|
@@ -1160,6 +1160,19 @@ int Source::streamAtomic(ALuint buffer, love::sound::Decoder *d)
|
|
|
decoded = 0;
|
|
|
}
|
|
|
|
|
|
+ // This shouldn't run after toLoop is calculated in this streamAtomic call,
|
|
|
+ // otherwise it'll decrease too quickly.
|
|
|
+ // TODO: this code is hard to understand, can it be made more clear?
|
|
|
+ // It's meant to reset offsetSamples once OpenAL starts processing the first
|
|
|
+ // queued buffer after a loop.
|
|
|
+ if (toLoop > 0)
|
|
|
+ {
|
|
|
+ if (--toLoop == 0)
|
|
|
+ {
|
|
|
+ offsetSamples = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (decoder->isFinished() && isLooping())
|
|
|
{
|
|
|
int queued, processed;
|
|
@@ -1172,14 +1185,6 @@ int Source::streamAtomic(ALuint buffer, love::sound::Decoder *d)
|
|
|
d->rewind();
|
|
|
}
|
|
|
|
|
|
- if (toLoop > 0)
|
|
|
- {
|
|
|
- if (--toLoop == 0)
|
|
|
- {
|
|
|
- offsetSamples = 0;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
return decoded;
|
|
|
}
|
|
|
|