From 55526634b65dc9118cd629a3f6e944a123342865 Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Sun, 21 Nov 2021 01:57:11 +0100 Subject: [PATCH] Piano: Use default sample rate in absence of audio device --- Userland/Applications/Piano/AudioPlayerLoop.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Userland/Applications/Piano/AudioPlayerLoop.cpp b/Userland/Applications/Piano/AudioPlayerLoop.cpp index dc19c69542..85a2768974 100644 --- a/Userland/Applications/Piano/AudioPlayerLoop.cpp +++ b/Userland/Applications/Piano/AudioPlayerLoop.cpp @@ -31,7 +31,11 @@ AudioPlayerLoop::AudioPlayerLoop(TrackManager& track_manager, bool& need_to_writ (void)buffer_id; enqueue_audio(); }; - m_resampler = Audio::ResampleHelper(Music::sample_rate, m_audio_client->get_sample_rate()); + + auto target_sample_rate = m_audio_client->get_sample_rate(); + if (target_sample_rate == 0) + target_sample_rate = Music::sample_rate; + m_resampler = Audio::ResampleHelper(Music::sample_rate, target_sample_rate); } void AudioPlayerLoop::enqueue_audio()