diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 3f7cd7546..c6491e788 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -3204,7 +3204,7 @@ float linphone_call_get_record_volume(LinphoneCall *call){ } double linphone_call_get_play_percent_volume(const LinphoneCall *call) { - if(call->audiostream) return audio_stream_get_output_volume(call->audiostream); + if(call->audiostream) return audio_stream_get_sound_card_output_gain(call->audiostream); else { ms_error("Could not get playback volume: no audio stream"); return -1.0; @@ -3212,12 +3212,12 @@ double linphone_call_get_play_percent_volume(const LinphoneCall *call) { } void linphone_call_set_play_percent_volume(LinphoneCall *call, double volume) { - if(call->audiostream) audio_stream_set_output_volume(call->audiostream, volume); + if(call->audiostream) audio_stream_set_sound_card_output_gain(call->audiostream, volume); else ms_error("Could not set playback volume: no audio stream"); } double linphone_call_get_record_percent_volume(const LinphoneCall *call) { - if(call->audiostream) return audio_stream_get_input_volume(call->audiostream); + if(call->audiostream) return audio_stream_get_sound_card_input_gain(call->audiostream); else { ms_error("Could not get record volume: no audio stream"); return -1.0; @@ -3225,7 +3225,7 @@ double linphone_call_get_record_percent_volume(const LinphoneCall *call) { } void linphone_call_set_record_percent_volume(LinphoneCall *call, double volume) { - if(call->audiostream) audio_stream_set_input_volume(call->audiostream, volume); + if(call->audiostream) audio_stream_set_sound_card_input_gain(call->audiostream, volume); else ms_error("Could not set record volume: no audio stream"); } diff --git a/gtk/incall_view.c b/gtk/incall_view.c index cb7d1ac0c..4d4fb9d80 100644 --- a/gtk/incall_view.c +++ b/gtk/incall_view.c @@ -371,7 +371,6 @@ void linphone_gtk_create_in_call_view(LinphoneCall *call){ GtkWidget *button; GtkWidget *image; - if (ms_list_size(linphone_core_get_calls(linphone_gtk_get_core()))==1){ /*this is the only call at this time */ call_index=1; @@ -634,22 +633,45 @@ void linphone_gtk_uninit_audio_meter(GtkWidget *w){ } } +typedef enum { VOLUME_CTRL_PLAYBACK, VOLUME_CTRL_RECORD } VolumeControlType; + +static void volume_control_value_changed(GtkScaleButton *button, gdouble value, gpointer user_data) { + LinphoneCall *call = (LinphoneCall *)g_object_get_data(G_OBJECT(button), "call"); + VolumeControlType method = (VolumeControlType)g_object_get_data(G_OBJECT(button), "method"); + + if(method == VOLUME_CTRL_PLAYBACK) { + linphone_call_set_play_percent_volume(call, value); + } else if(method == VOLUME_CTRL_RECORD) { + linphone_call_set_record_percent_volume(call, value); + } +} + +static void volume_control_init(GtkWidget *vol_ctrl, VolumeControlType type, LinphoneCall *call) { + g_object_set_data(G_OBJECT(vol_ctrl), "call", call); + g_object_set_data(G_OBJECT(vol_ctrl), "type", (gpointer)type); + + if(type == VOLUME_CTRL_PLAYBACK) { + gtk_scale_button_set_value(GTK_SCALE_BUTTON(vol_ctrl), linphone_call_get_play_volume(call)); + } else if(type == VOLUME_CTRL_RECORD) { + gtk_scale_button_set_value(GTK_SCALE_BUTTON(vol_ctrl), linphone_call_get_record_percent_volume(call)); + } + + g_signal_connect(G_OBJECT(vol_ctrl), "value-changed", G_CALLBACK(volume_control_value_changed), NULL); +} + void linphone_gtk_in_call_view_enable_audio_view(LinphoneCall *call, gboolean val){ GtkWidget *callview=(GtkWidget*)linphone_call_get_user_pointer(call); GtkWidget *audio_view=linphone_gtk_get_widget(callview,"incall_audioview"); - GtkWidget *mic=linphone_gtk_get_widget(callview,"incall_mic_icon"); - GtkWidget *spk=linphone_gtk_get_widget(callview,"incall_spk_icon"); GtkWidget *mic_level=linphone_gtk_get_widget(callview,"mic_audiolevel"); GtkWidget *spk_level=linphone_gtk_get_widget(callview,"spk_audiolevel"); - GdkPixbuf *pbuf; + GtkWidget *spk_vol_ctrl = linphone_gtk_get_widget(callview, "incall_spk_vol_ctrl_button"); + GtkWidget *mic_vol_ctrl = linphone_gtk_get_widget(callview, "incall_mic_vol_ctrl_button"); - gtk_image_set_from_pixbuf(GTK_IMAGE(mic),(pbuf=create_pixbuf("mic_active.png"))); - g_object_unref(pbuf); if (val){ - gtk_image_set_from_pixbuf(GTK_IMAGE(spk),(pbuf=create_pixbuf("speaker.png"))); - g_object_unref(pbuf); linphone_gtk_init_audio_meter(mic_level,(get_volume_t)linphone_call_get_record_volume,call); linphone_gtk_init_audio_meter(spk_level,(get_volume_t)linphone_call_get_play_volume,call); + volume_control_init(spk_vol_ctrl, VOLUME_CTRL_PLAYBACK, call); + volume_control_init(mic_vol_ctrl, VOLUME_CTRL_RECORD, call); gtk_widget_show_all(audio_view); }else{ linphone_gtk_uninit_audio_meter(mic_level); @@ -709,8 +731,6 @@ char *linphone_gtk_address(const LinphoneAddress *addr){ return ms_strdup(displayname); } - - void linphone_gtk_in_call_view_set_in_call(LinphoneCall *call){ GtkWidget *callview=(GtkWidget*)linphone_call_get_user_pointer(call); GtkWidget *status=linphone_gtk_get_widget(callview,"in_call_status"); diff --git a/gtk/main.ui b/gtk/main.ui index 0ec701ace..f3f1461d3 100644 --- a/gtk/main.ui +++ b/gtk/main.ui @@ -402,67 +402,104 @@ + True False - True - + True False - gtk-missing-image - 1 + + + True + True + True + True + none + False + vertical + audio-volume-muted +audio-volume-high +audio-volume-low +audio-volume-medium + + + False + False + 5 + 0 + + + + + True + False + + + False + False + 5 + 1 + + - False + True False + 10 0 - - 90 - 10 + True False + + + True + True + True + True + Click here to set the speakers volume + none + False + vertical + audio-volume-muted +audio-volume-high +audio-volume-low +audio-volume-medium + + + False + False + 5 + 0 + + + + + True + False + + + False + False + 5 + 1 + + - False + True False + 10 1 - - - True - False - gtk-missing-image - 0 - - - False - False - 2 - - - - - 90 - 10 - True - False - - - False - False - 1 - end - 3 - - False False - 2 + 5 3 diff --git a/mediastreamer2 b/mediastreamer2 index 224b2994c..81bfe4db9 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 224b2994c27f22129a7cf77838c10d60b823c08f +Subproject commit 81bfe4db9f1039e80017c8ba9505aa94f193b659