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
commit 107011f119
Notes: sideshowbarker 2024-07-19 11:06:56 +09:00
8 changed files with 72 additions and 15 deletions

View file

@ -32,6 +32,16 @@ bool AClientConnection::try_enqueue(const ABuffer& buffer)
return response->success();
}
bool AClientConnection::get_muted()
{
return send_sync<AudioServer::GetMuted>()->muted();
}
void AClientConnection::set_muted(bool muted)
{
send_sync<AudioServer::SetMuted>(muted);
}
int AClientConnection::get_main_mix_volume()
{
return send_sync<AudioServer::GetMainMixVolume>()->volume();