From 3123753e6b04d7eb3e368dce8f349e61b1831ba9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kleines=20Filmr=C3=B6llchen?= Date: Wed, 13 Jul 2022 10:57:39 +0200 Subject: [PATCH] Piano: Increase AudioPlayerLoop resilience against scheduling weirdness This is a temporary fix until we move AudioPlayerLoop to direct buffer enqueuing. --- Userland/Applications/Piano/AudioPlayerLoop.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Applications/Piano/AudioPlayerLoop.cpp b/Userland/Applications/Piano/AudioPlayerLoop.cpp index 05e14013612..05896d559eb 100644 --- a/Userland/Applications/Piano/AudioPlayerLoop.cpp +++ b/Userland/Applications/Piano/AudioPlayerLoop.cpp @@ -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(); }