From bb747c471f454e794200a2ef536d8e0f4803ba27 Mon Sep 17 00:00:00 2001 From: Elyse Date: Mon, 1 Nov 2021 19:05:05 -0600 Subject: AudioServer: Add a 'self_muted' state to each client connection This new state will allow us to ignore muted clients when computing the 'output mix' in the Mixer. --- Userland/Services/AudioServer/AudioServer.ipc | 2 ++ Userland/Services/AudioServer/ClientConnection.cpp | 14 ++++++++++++++ Userland/Services/AudioServer/ClientConnection.h | 2 ++ 3 files changed, 18 insertions(+) (limited to 'Userland/Services/AudioServer') diff --git a/Userland/Services/AudioServer/AudioServer.ipc b/Userland/Services/AudioServer/AudioServer.ipc index 21990774f6..0c7d24ddfc 100644 --- a/Userland/Services/AudioServer/AudioServer.ipc +++ b/Userland/Services/AudioServer/AudioServer.ipc @@ -5,6 +5,8 @@ endpoint AudioServer // Mixer functions set_main_mix_muted(bool muted) => () is_main_mix_muted() => (bool muted) + set_self_muted(bool muted) => () + is_self_muted() => (bool muted) get_main_mix_volume() => (double volume) set_main_mix_volume(double volume) => () get_self_volume() => (double volume) diff --git a/Userland/Services/AudioServer/ClientConnection.cpp b/Userland/Services/AudioServer/ClientConnection.cpp index 5e09395643..825413726e 100644 --- a/Userland/Services/AudioServer/ClientConnection.cpp +++ b/Userland/Services/AudioServer/ClientConnection.cpp @@ -149,4 +149,18 @@ void ClientConnection::set_main_mix_muted(bool muted) { m_mixer.set_muted(muted); } + +Messages::AudioServer::IsSelfMutedResponse ClientConnection::is_self_muted() +{ + if (m_queue) + return m_queue->is_muted(); + + return false; +} + +void ClientConnection::set_self_muted(bool muted) +{ + if (m_queue) + m_queue->set_muted(muted); +} } diff --git a/Userland/Services/AudioServer/ClientConnection.h b/Userland/Services/AudioServer/ClientConnection.h index bdee772a0e..878c4bebd3 100644 --- a/Userland/Services/AudioServer/ClientConnection.h +++ b/Userland/Services/AudioServer/ClientConnection.h @@ -49,6 +49,8 @@ private: virtual Messages::AudioServer::GetPlayingBufferResponse get_playing_buffer() override; virtual Messages::AudioServer::IsMainMixMutedResponse is_main_mix_muted() override; virtual void set_main_mix_muted(bool) override; + virtual Messages::AudioServer::IsSelfMutedResponse is_self_muted() override; + virtual void set_self_muted(bool) override; virtual void set_sample_rate(u32 sample_rate) override; virtual Messages::AudioServer::GetSampleRateResponse get_sample_rate() override; -- cgit v1.2.3