summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorJelle Raaijmakers <jelle@gmta.nl>2021-11-21 01:57:11 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-21 09:27:00 +0100
commit55526634b65dc9118cd629a3f6e944a123342865 (patch)
treee079df1bbf3ed7558b7259e22c9672033a1853a7 /Userland
parent87e4abb4c7af265b5891c9b9e04981bb9b327227 (diff)
downloadserenity-55526634b65dc9118cd629a3f6e944a123342865.zip
Piano: Use default sample rate in absence of audio device
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Applications/Piano/AudioPlayerLoop.cpp6
1 files changed, 5 insertions, 1 deletions
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<double>(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<double>(Music::sample_rate, target_sample_rate);
}
void AudioPlayerLoop::enqueue_audio()