From 3639e8070c608af1f9977291de96515783a26859 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Thu, 30 Jul 2015 12:02:32 +0200 Subject: [PATCH] Change volume percentage variable type from double to float --- coreapi/linphonecall.c | 12 ++++++------ coreapi/linphonecore.h | 32 ++++++++++++++++++-------------- gtk/incall_view.c | 8 ++++---- mediastreamer2 | 2 +- 4 files changed, 29 insertions(+), 25 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index c6491e788..83e146f1d 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -3203,28 +3203,28 @@ float linphone_call_get_record_volume(LinphoneCall *call){ return LINPHONE_VOLUME_DB_LOWEST; } -double linphone_call_get_play_percent_volume(const LinphoneCall *call) { +float linphone_call_get_speaker_volume_gain(const LinphoneCall *call) { 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; + return -1.0f; } } -void linphone_call_set_play_percent_volume(LinphoneCall *call, double volume) { +void linphone_call_set_speaker_volume_gain(LinphoneCall *call, float 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) { +float linphone_call_get_microphone_volume_gain(const LinphoneCall *call) { 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; + return -1.0f; } } -void linphone_call_set_record_percent_volume(LinphoneCall *call, double volume) { +void linphone_call_set_microphone_volume_gain(LinphoneCall *call, float 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/coreapi/linphonecore.h b/coreapi/linphonecore.h index e7c9c439c..669e322bf 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -723,40 +723,44 @@ LINPHONE_PUBLIC float linphone_call_get_play_volume(LinphoneCall *call); LINPHONE_PUBLIC float linphone_call_get_record_volume(LinphoneCall *call); /** - * @brief Get playback volume. + * @brief Get speaker volume gain. + * If the sound backend supports it, the returned gain is equal to the gain set + * with the system mixer. * * @param call The call. - * @return double Percenatge of the max supported volume. Valid values are in [ 0.0 : 1.0 ]. + * @return Percenatge of the max supported volume gain. Valid values are in [ 0.0 : 1.0 ]. * In case of failure, a negative value is returned */ -LINPHONE_PUBLIC double linphone_call_get_play_percent_volume(const LinphoneCall *call); +LINPHONE_PUBLIC float linphone_call_get_speaker_volume_gain(const LinphoneCall *call); /** - * @brief Set playback volume. + * @brief Set speaker volume gain. + * If the sound backend supports it, the new gain will synchronized with the system mixer. * * @param call The call. - * @param volume New volume in percentage of the max supported volume. Valid values are in [ 0.0 : 1.0 ]. - * @return void + * @param volume Percentage of the max supported gain. Valid values are in [ 0.0 : 1.0 ]. */ -LINPHONE_PUBLIC void linphone_call_set_play_percent_volume(LinphoneCall *call, double volume); +LINPHONE_PUBLIC void linphone_call_set_speaker_volume_gain(LinphoneCall *call, float volume); /** - * @brief Get record volume. + * @brief Get microphone volume gain. + * If the sound backend supports it, the returned gain is equal to the gain set + * with the system mixer. * * @param call The call. - * @return double Percenatge of the max supported volume. Valid values are in [ 0.0 : 1.0 ]. + * @return double Percenatge of the max supported volume gain. Valid values are in [ 0.0 : 1.0 ]. * In case of failure, a negative value is returned */ -LINPHONE_PUBLIC double linphone_call_get_record_percent_volume(const LinphoneCall *call); +LINPHONE_PUBLIC float linphone_call_get_microphone_volume_gain(const LinphoneCall *call); /** - * @brief Set record volume. + * @brief Set microphone volume gain. + * If the sound backend supports it, the new gain will synchronized with the system mixer. * * @param call The call. - * @param volume New volume in percentage of the max supported volume. Valid values are in [ 0.0 : 1.0 ]. - * @return void + * @param volume Percentage of the max supported gain. Valid values are in [ 0.0 : 1.0 ]. */ -LINPHONE_PUBLIC void linphone_call_set_record_percent_volume(LinphoneCall *call, double volume); +LINPHONE_PUBLIC void linphone_call_set_microphone_volume_gain(LinphoneCall *call, float volume); LINPHONE_PUBLIC float linphone_call_get_current_quality(LinphoneCall *call); LINPHONE_PUBLIC float linphone_call_get_average_quality(LinphoneCall *call); diff --git a/gtk/incall_view.c b/gtk/incall_view.c index 4d4fb9d80..8056bb1de 100644 --- a/gtk/incall_view.c +++ b/gtk/incall_view.c @@ -640,9 +640,9 @@ static void volume_control_value_changed(GtkScaleButton *button, gdouble value, VolumeControlType method = (VolumeControlType)g_object_get_data(G_OBJECT(button), "method"); if(method == VOLUME_CTRL_PLAYBACK) { - linphone_call_set_play_percent_volume(call, value); + linphone_call_set_speaker_volume_gain(call, value); } else if(method == VOLUME_CTRL_RECORD) { - linphone_call_set_record_percent_volume(call, value); + linphone_call_set_microphone_volume_gain(call, value); } } @@ -651,9 +651,9 @@ static void volume_control_init(GtkWidget *vol_ctrl, VolumeControlType type, Lin 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)); + gtk_scale_button_set_value(GTK_SCALE_BUTTON(vol_ctrl), linphone_call_get_speaker_volume_gain(call)); } else if(type == VOLUME_CTRL_RECORD) { - gtk_scale_button_set_value(GTK_SCALE_BUTTON(vol_ctrl), linphone_call_get_record_percent_volume(call)); + gtk_scale_button_set_value(GTK_SCALE_BUTTON(vol_ctrl), linphone_call_get_microphone_volume_gain(call)); } g_signal_connect(G_OBJECT(vol_ctrl), "value-changed", G_CALLBACK(volume_control_value_changed), NULL); diff --git a/mediastreamer2 b/mediastreamer2 index aa8c0587e..65ed768f7 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit aa8c0587e8c8e8e86d642a5e5d01866d3c881f94 +Subproject commit 65ed768f7dde2571ffa731ad5264a93dbdc51cc1