Commit 7f09d228 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

#8762: update mute for mic only, fix remove slide for pulseaudio

parent 12d0751c
......@@ -432,6 +432,7 @@ void PulseLayer::readFromMic()
converter_->resample((SFLDataFormat*)data, mic_buffer_, mainBufferSampleRate, audioSampleRate_, samples);
dcblocker_.process(mic_buffer_, resample ? mic_buffer_ : (SFLDataFormat*)data, samples);
applyGain(mic_buffer_, bytes / sizeof(SFLDataFormat), getCaptureGain());
Manager::instance().getMainBuffer()->putData(mic_buffer_, bytes);
if (pa_stream_drop(record_->pulseStream()) < 0)
......
......@@ -942,7 +942,7 @@ sflphone_mute_call()
{
DEBUG("Actions: Mute call");
toggle_slider_mute();
toggle_slider_mute_microphone();
}
void sflphone_fill_codec_list()
......
......@@ -601,15 +601,16 @@ select_audio_manager(void)
dbus_set_audio_manager(PULSEAUDIO_API_STR);
gtk_container_remove(GTK_CONTAINER(alsa_conf) , alsabox);
gtk_widget_hide(alsa_conf);
if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(volumeToggle_))) {
main_window_volume_controls(FALSE);
eel_gconf_set_integer(SHOW_VOLUME_CONTROLS, FALSE);
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(volumeToggle_), FALSE);
}
gtk_action_set_sensitive(volumeToggle_, FALSE);
}
if (gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(volumeToggle_))) {
main_window_volume_controls(FALSE);
eel_gconf_set_integer(SHOW_VOLUME_CONTROLS, FALSE);
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(volumeToggle_), FALSE);
}
}
void
......
......@@ -242,15 +242,21 @@ create_main_window()
gtk_box_pack_start(GTK_BOX(vbox), subvbox, FALSE /*expand*/,
FALSE /*fill*/, 0 /*padding*/);
speaker_control = create_slider("speaker");
mic_control = create_slider("mic");
g_object_ref(speaker_control);
g_object_ref(mic_control);
if (SHOW_VOLUME) {
speaker_control = create_slider("speaker");
gtk_box_pack_end(GTK_BOX(subvbox), speaker_control, FALSE /*expand*/,
TRUE /*fill*/, 0 /*padding*/);
gtk_widget_show_all(speaker_control);
mic_control = create_slider("mic");
TRUE /*fill*/, 0 /*padding*/);
gtk_box_pack_end(GTK_BOX(subvbox), mic_control, FALSE /*expand*/,
TRUE /*fill*/, 0 /*padding*/);
gtk_widget_show_all(speaker_control);
gtk_widget_show_all(mic_control);
} else {
gtk_widget_hide(speaker_control);
gtk_widget_hide(mic_control);
}
if (eel_gconf_get_boolean(CONF_SHOW_DIALPAD)) {
......@@ -315,11 +321,11 @@ void
main_window_volume_controls(gboolean state)
{
if (state) {
speaker_control = create_slider("speaker");
// speaker_control = create_slider("speaker");
gtk_box_pack_end(GTK_BOX(subvbox), speaker_control, FALSE /*expand*/,
TRUE /*fill*/, 0 /*padding*/);
gtk_widget_show_all(speaker_control);
mic_control = create_slider("mic");
// mic_control = create_slider("mic");
gtk_box_pack_end(GTK_BOX(subvbox), mic_control, FALSE /*expand*/,
TRUE /*fill*/, 0 /*padding*/);
gtk_widget_show_all(mic_control);
......
......@@ -140,7 +140,7 @@
/** Behaviour of the main window on incoming calls */
#define __POPUP_WINDOW (eel_gconf_get_integer (POPUP_ON_CALL))
/** Show/Hide the volume controls */
#define SHOW_VOLUME (eel_gconf_get_integer (SHOW_VOLUME_CONTROLS))
#define SHOW_VOLUME (eel_gconf_get_integer (SHOW_VOLUME_CONTROLS) && must_show_alsa_conf())
/** DTMF type */
#define OVERRTP "overrtp"
......
......@@ -168,20 +168,17 @@ void set_slider_no_update (const gchar * device, gdouble newval)
update_icons(dev);
}
void toggle_slider_mute(void)
void toggle_slider_mute_microphone(void)
{
DEBUG("Slider: Mute/Unmute toggle");
switch(device_state) {
case DEVICE_STATE_ACTIVE:
// value[DEVICE_SPEAKER] = gtk_range_get_value(GTK_RANGE(slider[DEVICE_SPEAKER]));
value[DEVICE_MIC] = gtk_range_get_value(GTK_RANGE(slider[DEVICE_MIC]));
// dbus_set_volume("speaker", 0.0);
dbus_set_volume("mic", 0.0);
device_state = DEVICE_STATE_MUTED;
break;
case DEVICE_STATE_MUTED:
// dbus_set_volume("speaker", value[DEVICE_SPEAKER]);
dbus_set_volume("mic", value[DEVICE_MIC]);
device_state = DEVICE_STATE_ACTIVE;
break;
......
......@@ -68,7 +68,7 @@ void set_slider_no_update (const gchar * device, gdouble value);
/**
* Mute the audio device setting the sliders to 0
*/
void toggle_slider_mute(void);
void toggle_slider_mute_microphone(void);
/**
* Returns the mute/unmute state
......
......@@ -1662,7 +1662,7 @@ create_menus(GtkUIManager *ui_manager)
// Set the toggle buttons
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(gtk_ui_manager_get_action(ui_manager, "/MenuBar/ViewMenu/Dialpad")), eel_gconf_get_boolean(CONF_SHOW_DIALPAD));
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(volumeToggle_),(gboolean) SHOW_VOLUME);
gtk_action_set_sensitive(volumeToggle_, TRUE);
gtk_action_set_sensitive(volumeToggle_, must_show_alsa_conf());
gtk_action_set_sensitive(gtk_ui_manager_get_action(ui_manager, "/MenuBar/ViewMenu/Toolbar"), FALSE);
/* 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