diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index c13a5b396..3f7cd7546 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -3203,6 +3203,32 @@ float linphone_call_get_record_volume(LinphoneCall *call){ return LINPHONE_VOLUME_DB_LOWEST; } +double linphone_call_get_play_percent_volume(const LinphoneCall *call) { + if(call->audiostream) return audio_stream_get_output_volume(call->audiostream); + else { + ms_error("Could not get playback volume: no audio stream"); + return -1.0; + } +} + +void linphone_call_set_play_percent_volume(LinphoneCall *call, double volume) { + if(call->audiostream) audio_stream_set_output_volume(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); + else { + ms_error("Could not get record volume: no audio stream"); + return -1.0; + } +} + +void linphone_call_set_record_percent_volume(LinphoneCall *call, double volume) { + if(call->audiostream) audio_stream_set_input_volume(call->audiostream, volume); + else ms_error("Could not set record volume: no audio stream"); +} + /** * Obtain real-time quality rating of the call * diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 25bc56821..e7c9c439c 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -721,6 +721,43 @@ LINPHONE_PUBLIC const char *linphone_call_get_remote_user_agent(LinphoneCall *ca LINPHONE_PUBLIC const char *linphone_call_get_remote_contact(LinphoneCall *call); LINPHONE_PUBLIC float linphone_call_get_play_volume(LinphoneCall *call); LINPHONE_PUBLIC float linphone_call_get_record_volume(LinphoneCall *call); + +/** + * @brief Get playback volume. + * + * @param call The call. + * @return double Percenatge of the max supported volume. 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); + +/** + * @brief Set playback volume. + * + * @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 + */ +LINPHONE_PUBLIC void linphone_call_set_play_percent_volume(LinphoneCall *call, double volume); + +/** + * @brief Get record volume. + * + * @param call The call. + * @return double Percenatge of the max supported volume. 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); + +/** + * @brief Set record volume. + * + * @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 + */ +LINPHONE_PUBLIC void linphone_call_set_record_percent_volume(LinphoneCall *call, double volume); + LINPHONE_PUBLIC float linphone_call_get_current_quality(LinphoneCall *call); LINPHONE_PUBLIC float linphone_call_get_average_quality(LinphoneCall *call); LINPHONE_PUBLIC const char* linphone_call_get_authentication_token(LinphoneCall *call);