mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Move source seeking from Source::playAtomic to prepareAtomic. Fixes love.audio.play(sources) for sources which had seek() called before the play call.
This commit is contained in:
@@ -863,6 +863,9 @@ void Source::prepareAtomic()
|
||||
case TYPE_MAX_ENUM:
|
||||
break;
|
||||
}
|
||||
|
||||
// Seek to the current/pending offset.
|
||||
alSourcef(source, AL_SAMPLE_OFFSET, offsetSamples);
|
||||
}
|
||||
|
||||
void Source::teardownAtomic()
|
||||
@@ -919,16 +922,9 @@ bool Source::playAtomic(ALuint source)
|
||||
// Clear errors.
|
||||
alGetError();
|
||||
|
||||
// Seek to the current/pending offset before playing. If this call happens
|
||||
// immediately after alSourcePlay it could introduce a click depending on
|
||||
// the platform, because the source is asynchronously playing by then.
|
||||
alSourcef(source, AL_SAMPLE_OFFSET, offsetSamples);
|
||||
|
||||
bool success = alGetError() == AL_NO_ERROR;
|
||||
|
||||
alSourcePlay(source);
|
||||
|
||||
success &= alGetError() == AL_NO_ERROR;
|
||||
bool success = alGetError() == AL_NO_ERROR;
|
||||
|
||||
if (sourceType == TYPE_STREAM)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user