From b22c84096381a9b56556eeb2605e4b902aba25d3 Mon Sep 17 00:00:00 2001 From: Alex Chronopoulos Date: Wed, 9 Nov 2022 22:13:59 +0100 Subject: [PATCH] AudioServer: Stop glitching when toggling mute Initialize the `AudioServer::Mixer::m_zero_filled_buffer` to zero. The garbage memory inside that buffer was causing a glitch sound when the user was toggling the mute checkbox or was moving the volume slider on and off zero. Glitching was more obvious if the toggling was happening without any sound being played in parallel. In addition to that, the `m_zero_filled_buffer` turned to `const` since there is no intention to modify its content. --- Userland/Services/AudioServer/Mixer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Services/AudioServer/Mixer.h b/Userland/Services/AudioServer/Mixer.h index 2d20f6e866..2954320f60 100644 --- a/Userland/Services/AudioServer/Mixer.h +++ b/Userland/Services/AudioServer/Mixer.h @@ -133,7 +133,7 @@ private: NonnullRefPtr m_config; RefPtr m_config_write_timer; - Array m_zero_filled_buffer; + Array const m_zero_filled_buffer {}; void mix(); };