Piano: Increase AudioPlayerLoop resilience against scheduling weirdness

This is a temporary fix until we move AudioPlayerLoop to direct buffer
enqueuing.
This commit is contained in:
kleines Filmröllchen 2022-07-13 10:57:39 +02:00 committed by Linus Groh
parent 4941cffdd0
commit 3123753e6b
Notes: sideshowbarker 2024-07-17 21:16:31 +09:00

View File

@ -31,12 +31,12 @@ AudioPlayerLoop::AudioPlayerLoop(TrackManager& track_manager, bool& need_to_writ
// FIXME: I said I would never write such a hack again, but here we are.
// This code should die as soon as possible anyways, so it doesn't matter.
// Please don't use this as an example to write good audio code; it's just here as a temporary hack.
Core::EventLoop::register_timer(*this, 10, true, Core::TimerShouldFireWhenNotVisible::Yes);
Core::EventLoop::register_timer(*this, 5, true, Core::TimerShouldFireWhenNotVisible::Yes);
}
void AudioPlayerLoop::timer_event(Core::TimerEvent&)
{
if (m_audio_client->remaining_samples() < sample_count)
while (m_audio_client->remaining_samples() < sample_count)
enqueue_audio();
}