paused stream setTime fix

This commit is contained in:
MihailRis 2024-03-06 23:29:08 +03:00
parent 7cca53fca3
commit a58fbd7df2

View File

@ -169,11 +169,15 @@ void ALStream::setTime(duration_t time) {
source->seek(sample);
auto alspeaker = dynamic_cast<ALSpeaker*>(audio::get_speaker(this->speaker));
if (alspeaker) {
bool paused = alspeaker->isPaused();
AL_CHECK(alSourceStop(alspeaker->source));
unqueueBuffers(alspeaker->source);
totalPlayedSamples = sample;
enqueueBuffers(alspeaker->source);
AL_CHECK(alSourcePlay(alspeaker->source));
if (paused) {
AL_CHECK(alSourcePause(alspeaker->source));
}
} else {
totalPlayedSamples = sample;
}