1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:57:34 +00:00

AudioServer: Allow muting the system audio

This patch adds muting to ASMixer, which works by substituting what we
would normally send to the sound card with zero-filled memory instead.
We do it this way to ensure that the queued sample buffers keep getting
played (silently.)

This is obviously not the perfect way of doing this, and in the future
we should improve on this, and also find a way to utilize any hardware
mixing functions in the sound card.
This commit is contained in:
Andreas Kling 2019-11-22 21:44:02 +01:00
parent 2b9ec22576
commit 107011f119
8 changed files with 72 additions and 15 deletions

View file

@ -87,6 +87,9 @@ public:
int main_volume() const { return m_main_volume; }
void set_main_volume(int volume) { m_main_volume = volume; }
bool is_muted() const { return m_muted; }
void set_muted(bool);
private:
Vector<NonnullRefPtr<ASBufferQueue>> m_pending_mixing;
@ -95,7 +98,10 @@ private:
LibThread::Thread m_sound_thread;
bool m_muted { false };
int m_main_volume { 100 };
u8* m_zero_filled_buffer { nullptr };
void mix();
};