Change volume percentage variable type from double to float

This commit is contained in:
François Grisez 2015-07-30 12:02:32 +02:00
parent 0ef601b5bf
commit 3639e8070c
4 changed files with 29 additions and 25 deletions

View file

@ -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");
}

View file

@ -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);

View file

@ -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);

@ -1 +1 @@
Subproject commit aa8c0587e8c8e8e86d642a5e5d01866d3c881f94
Subproject commit 65ed768f7dde2571ffa731ad5264a93dbdc51cc1