Commit 6b1a485d authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #29271: pulse: add/fix volume and mute controls

parent 2eeb667b
...@@ -529,6 +529,8 @@ void PulseLayer::readFromMic() ...@@ -529,6 +529,8 @@ void PulseLayer::readFromMic()
unsigned int mainBufferSampleRate = Manager::instance().getMainBuffer().getInternalSamplingRate(); unsigned int mainBufferSampleRate = Manager::instance().getMainBuffer().getInternalSamplingRate();
bool resample = sampleRate_ != mainBufferSampleRate; bool resample = sampleRate_ != mainBufferSampleRate;
in.applyGain(captureGain_);
AudioBuffer * out = ∈ AudioBuffer * out = ∈
if (resample) { if (resample) {
......
...@@ -777,7 +777,13 @@ select_audio_manager(GtkWidget *alsa_button, SFLPhoneClient *client) ...@@ -777,7 +777,13 @@ select_audio_manager(GtkWidget *alsa_button, SFLPhoneClient *client)
gtk_container_add(GTK_CONTAINER(alsa_conf), alsabox); gtk_container_add(GTK_CONTAINER(alsa_conf), alsabox);
gtk_widget_show(alsa_conf); gtk_widget_show(alsa_conf);
gtk_widget_set_sensitive(alsa_conf, TRUE); gtk_widget_set_sensitive(alsa_conf, TRUE);
gtk_action_set_sensitive(volumeToggle_, TRUE);
if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(volumeToggle_))) {
main_window_volume_controls(FALSE);
g_settings_set_boolean(client->settings, "show-volume-controls", FALSE);
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(volumeToggle_), FALSE);
}
} else if (must_show_alsa_conf() && !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(alsa_button))) { } else if (must_show_alsa_conf() && !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(alsa_button))) {
dbus_set_audio_manager(PULSEAUDIO_API_STR); dbus_set_audio_manager(PULSEAUDIO_API_STR);
gtk_container_remove(GTK_CONTAINER(alsa_conf), alsabox); gtk_container_remove(GTK_CONTAINER(alsa_conf), alsabox);
...@@ -787,7 +793,6 @@ select_audio_manager(GtkWidget *alsa_button, SFLPhoneClient *client) ...@@ -787,7 +793,6 @@ select_audio_manager(GtkWidget *alsa_button, SFLPhoneClient *client)
gtk_container_add(GTK_CONTAINER(pulse_conf), pulsebox); gtk_container_add(GTK_CONTAINER(pulse_conf), pulsebox);
gtk_widget_show(pulse_conf); gtk_widget_show(pulse_conf);
gtk_widget_set_sensitive(pulse_conf, TRUE); gtk_widget_set_sensitive(pulse_conf, TRUE);
gtk_action_set_sensitive(volumeToggle_, TRUE);
if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(volumeToggle_))) { if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(volumeToggle_))) {
main_window_volume_controls(FALSE); main_window_volume_controls(FALSE);
...@@ -795,7 +800,6 @@ select_audio_manager(GtkWidget *alsa_button, SFLPhoneClient *client) ...@@ -795,7 +800,6 @@ select_audio_manager(GtkWidget *alsa_button, SFLPhoneClient *client)
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(volumeToggle_), FALSE); gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(volumeToggle_), FALSE);
} }
gtk_action_set_sensitive(volumeToggle_, FALSE);
} else } else
g_warning("Unexpected audio API state"); g_warning("Unexpected audio API state");
} }
...@@ -973,5 +977,5 @@ gboolean must_show_alsa_conf() ...@@ -973,5 +977,5 @@ gboolean must_show_alsa_conf()
gboolean gboolean
must_show_volume(SFLPhoneClient *client) must_show_volume(SFLPhoneClient *client)
{ {
return g_settings_get_boolean(client->settings, "show-volume-controls") && must_show_alsa_conf(); return g_settings_get_boolean(client->settings, "show-volume-controls");
} }
...@@ -1673,7 +1673,7 @@ create_menus(GtkUIManager *ui, SFLPhoneClient *client) ...@@ -1673,7 +1673,7 @@ create_menus(GtkUIManager *ui, SFLPhoneClient *client)
// Set the toggle buttons // Set the toggle buttons
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(get_action(ui, "/MenuBar/ViewMenu/Dialpad")), g_settings_get_boolean(client->settings, "show-dialpad")); gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(get_action(ui, "/MenuBar/ViewMenu/Dialpad")), g_settings_get_boolean(client->settings, "show-dialpad"));
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(volumeToggle_), must_show_volume(client)); gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(volumeToggle_), must_show_volume(client));
gtk_action_set_sensitive(volumeToggle_, must_show_alsa_conf()); gtk_action_set_sensitive(volumeToggle_, TRUE);
gtk_action_set_sensitive(get_action(ui, "/MenuBar/ViewMenu/Toolbar"), FALSE); gtk_action_set_sensitive(get_action(ui, "/MenuBar/ViewMenu/Toolbar"), FALSE);
/* Add the loading icon at the right of the toolbar. It is used for addressbook searches. */ /* Add the loading icon at the right of the toolbar. It is used for addressbook searches. */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment