mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:18:11 +00:00
Everywhere: Refactor 'muted' to 'main_mix_muted' in all AudioConnections
The 'muted' methods referred to the 'main mix muted' but it wasn't really clear from the name. This change will be useful because in the next commit, a 'self muted' state will be added to each audio client connection.
This commit is contained in:
parent
60fa8ac109
commit
c78a8b94c5
9 changed files with 22 additions and 22 deletions
|
@ -30,9 +30,9 @@ public:
|
||||||
, m_show_percent(Config::read_bool("AudioApplet", "Applet", "ShowPercent", false))
|
, m_show_percent(Config::read_bool("AudioApplet", "Applet", "ShowPercent", false))
|
||||||
{
|
{
|
||||||
m_audio_volume = static_cast<int>(m_audio_client->get_main_mix_volume() * 100);
|
m_audio_volume = static_cast<int>(m_audio_client->get_main_mix_volume() * 100);
|
||||||
m_audio_muted = m_audio_client->get_muted();
|
m_audio_muted = m_audio_client->is_main_mix_muted();
|
||||||
|
|
||||||
m_audio_client->on_muted_state_change = [this](bool muted) {
|
m_audio_client->on_main_mix_muted_state_change = [this](bool muted) {
|
||||||
if (m_audio_muted == muted)
|
if (m_audio_muted == muted)
|
||||||
return;
|
return;
|
||||||
m_mute_box->set_checked(!m_audio_muted);
|
m_mute_box->set_checked(!m_audio_muted);
|
||||||
|
@ -104,7 +104,7 @@ public:
|
||||||
m_mute_box->set_tooltip(m_audio_muted ? "Unmute" : "Mute");
|
m_mute_box->set_tooltip(m_audio_muted ? "Unmute" : "Mute");
|
||||||
m_mute_box->on_checked = [&](bool is_muted) {
|
m_mute_box->on_checked = [&](bool is_muted) {
|
||||||
m_mute_box->set_tooltip(is_muted ? "Unmute" : "Mute");
|
m_mute_box->set_tooltip(is_muted ? "Unmute" : "Mute");
|
||||||
m_audio_client->set_muted(is_muted);
|
m_audio_client->set_main_mix_muted(is_muted);
|
||||||
GUI::Application::the()->hide_tooltip();
|
GUI::Application::the()->hide_tooltip();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ private:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.button() == GUI::MouseButton::Secondary) {
|
if (event.button() == GUI::MouseButton::Secondary) {
|
||||||
m_audio_client->set_muted(!m_audio_muted);
|
m_audio_client->set_main_mix_muted(!m_audio_muted);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,10 +45,10 @@ void ClientConnection::finished_playing_buffer(i32 buffer_id)
|
||||||
on_finish_playing_buffer(buffer_id);
|
on_finish_playing_buffer(buffer_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientConnection::muted_state_changed(bool muted)
|
void ClientConnection::main_mix_muted_state_changed(bool muted)
|
||||||
{
|
{
|
||||||
if (on_muted_state_change)
|
if (on_main_mix_muted_state_change)
|
||||||
on_muted_state_change(muted);
|
on_main_mix_muted_state_change(muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientConnection::main_mix_volume_changed(double volume)
|
void ClientConnection::main_mix_volume_changed(double volume)
|
||||||
|
|
|
@ -24,7 +24,7 @@ public:
|
||||||
void async_enqueue(Buffer const&);
|
void async_enqueue(Buffer const&);
|
||||||
|
|
||||||
Function<void(i32 buffer_id)> on_finish_playing_buffer;
|
Function<void(i32 buffer_id)> on_finish_playing_buffer;
|
||||||
Function<void(bool muted)> on_muted_state_change;
|
Function<void(bool muted)> on_main_mix_muted_state_change;
|
||||||
Function<void(double volume)> on_main_mix_volume_change;
|
Function<void(double volume)> on_main_mix_volume_change;
|
||||||
Function<void(double volume)> on_client_volume_change;
|
Function<void(double volume)> on_client_volume_change;
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ private:
|
||||||
ClientConnection();
|
ClientConnection();
|
||||||
|
|
||||||
virtual void finished_playing_buffer(i32) override;
|
virtual void finished_playing_buffer(i32) override;
|
||||||
virtual void muted_state_changed(bool) override;
|
virtual void main_mix_muted_state_changed(bool) override;
|
||||||
virtual void main_mix_volume_changed(double) override;
|
virtual void main_mix_volume_changed(double) override;
|
||||||
virtual void client_volume_changed(double) override;
|
virtual void client_volume_changed(double) override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
endpoint AudioClient
|
endpoint AudioClient
|
||||||
{
|
{
|
||||||
finished_playing_buffer(i32 buffer_id) =|
|
finished_playing_buffer(i32 buffer_id) =|
|
||||||
muted_state_changed(bool muted) =|
|
main_mix_muted_state_changed(bool muted) =|
|
||||||
main_mix_volume_changed(double volume) =|
|
main_mix_volume_changed(double volume) =|
|
||||||
client_volume_changed(double volume) =|
|
client_volume_changed(double volume) =|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
endpoint AudioServer
|
endpoint AudioServer
|
||||||
{
|
{
|
||||||
// Mixer functions
|
// Mixer functions
|
||||||
set_muted(bool muted) => ()
|
set_main_mix_muted(bool muted) => ()
|
||||||
get_muted() => (bool muted)
|
is_main_mix_muted() => (bool muted)
|
||||||
get_main_mix_volume() => (double volume)
|
get_main_mix_volume() => (double volume)
|
||||||
set_main_mix_volume(double volume) => ()
|
set_main_mix_volume(double volume) => ()
|
||||||
get_self_volume() => (double volume)
|
get_self_volume() => (double volume)
|
||||||
|
|
|
@ -43,9 +43,9 @@ void ClientConnection::did_finish_playing_buffer(Badge<ClientAudioStream>, int b
|
||||||
async_finished_playing_buffer(buffer_id);
|
async_finished_playing_buffer(buffer_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientConnection::did_change_muted_state(Badge<Mixer>, bool muted)
|
void ClientConnection::did_change_main_mix_muted_state(Badge<Mixer>, bool muted)
|
||||||
{
|
{
|
||||||
async_muted_state_changed(muted);
|
async_main_mix_muted_state_changed(muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientConnection::did_change_main_mix_volume(Badge<Mixer>, double volume)
|
void ClientConnection::did_change_main_mix_volume(Badge<Mixer>, double volume)
|
||||||
|
@ -140,12 +140,12 @@ Messages::AudioServer::GetPlayingBufferResponse ClientConnection::get_playing_bu
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
Messages::AudioServer::GetMutedResponse ClientConnection::get_muted()
|
Messages::AudioServer::IsMainMixMutedResponse ClientConnection::is_main_mix_muted()
|
||||||
{
|
{
|
||||||
return m_mixer.is_muted();
|
return m_mixer.is_muted();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientConnection::set_muted(bool muted)
|
void ClientConnection::set_main_mix_muted(bool muted)
|
||||||
{
|
{
|
||||||
m_mixer.set_muted(muted);
|
m_mixer.set_muted(muted);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ public:
|
||||||
|
|
||||||
void did_finish_playing_buffer(Badge<ClientAudioStream>, int buffer_id);
|
void did_finish_playing_buffer(Badge<ClientAudioStream>, int buffer_id);
|
||||||
void did_change_client_volume(Badge<ClientAudioStream>, double volume);
|
void did_change_client_volume(Badge<ClientAudioStream>, double volume);
|
||||||
void did_change_muted_state(Badge<Mixer>, bool muted);
|
void did_change_main_mix_muted_state(Badge<Mixer>, bool muted);
|
||||||
void did_change_main_mix_volume(Badge<Mixer>, double volume);
|
void did_change_main_mix_volume(Badge<Mixer>, double volume);
|
||||||
|
|
||||||
virtual void die() override;
|
virtual void die() override;
|
||||||
|
@ -47,8 +47,8 @@ private:
|
||||||
virtual void set_paused(bool) override;
|
virtual void set_paused(bool) override;
|
||||||
virtual void clear_buffer(bool) override;
|
virtual void clear_buffer(bool) override;
|
||||||
virtual Messages::AudioServer::GetPlayingBufferResponse get_playing_buffer() override;
|
virtual Messages::AudioServer::GetPlayingBufferResponse get_playing_buffer() override;
|
||||||
virtual Messages::AudioServer::GetMutedResponse get_muted() override;
|
virtual Messages::AudioServer::IsMainMixMutedResponse is_main_mix_muted() override;
|
||||||
virtual void set_muted(bool) override;
|
virtual void set_main_mix_muted(bool) override;
|
||||||
virtual void set_sample_rate(u32 sample_rate) override;
|
virtual void set_sample_rate(u32 sample_rate) override;
|
||||||
virtual Messages::AudioServer::GetSampleRateResponse get_sample_rate() override;
|
virtual Messages::AudioServer::GetSampleRateResponse get_sample_rate() override;
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ void Mixer::set_muted(bool muted)
|
||||||
request_setting_sync();
|
request_setting_sync();
|
||||||
|
|
||||||
ClientConnection::for_each([muted](ClientConnection& client) {
|
ClientConnection::for_each([muted](ClientConnection& client) {
|
||||||
client.did_change_muted_state({}, muted);
|
client.did_change_main_mix_muted_state({}, muted);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AudioVariable::Mute: {
|
case AudioVariable::Mute: {
|
||||||
bool muted = audio_client->get_muted();
|
bool muted = audio_client->is_main_mix_muted();
|
||||||
if (human_mode)
|
if (human_mode)
|
||||||
outln("Muted: {}", muted ? "Yes" : "No");
|
outln("Muted: {}", muted ? "Yes" : "No");
|
||||||
else
|
else
|
||||||
|
@ -151,7 +151,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
}
|
}
|
||||||
case AudioVariable::Mute: {
|
case AudioVariable::Mute: {
|
||||||
bool& mute = to_set.value.get<bool>();
|
bool& mute = to_set.value.get<bool>();
|
||||||
audio_client->set_muted(mute);
|
audio_client->set_main_mix_muted(mute);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AudioVariable::SampleRate: {
|
case AudioVariable::SampleRate: {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue