1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 23:37:35 +00:00

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.
This commit is contained in:
Alex Chronopoulos 2022-11-09 22:13:59 +01:00 committed by Andrew Kaster
parent 9baa521b04
commit b22c840963

View file

@ -133,7 +133,7 @@ private:
NonnullRefPtr<Core::ConfigFile> m_config;
RefPtr<Core::Timer> m_config_write_timer;
Array<u8, HARDWARE_BUFFER_SIZE_BYTES> m_zero_filled_buffer;
Array<u8, HARDWARE_BUFFER_SIZE_BYTES> const m_zero_filled_buffer {};
void mix();
};