]> sjero.net Git - linphone/blobdiff - coreapi/linphonecore.c
Merge branch 'dev_sal' of belledonne-communications.com:linphone-private into dev_sal
[linphone] / coreapi / linphonecore.c
index 2c163d490e28fe35e1f86d86dd8e9aaffb7dffef..e6e65930e63e916def24766e4e7ef5656f61b997 100644 (file)
@@ -490,6 +490,7 @@ static void sound_config_read(LinphoneCore *lc)
        /*int tmp;*/
        const char *tmpbuf;
        const char *devid;
+       float gain=0;
 #ifdef __linux
        /*alsadev let the user use custom alsa device within linphone*/
        devid=lp_config_get_string(lc->config,"sound","alsadev",NULL);
@@ -555,6 +556,9 @@ static void sound_config_read(LinphoneCore *lc)
                lp_config_get_int(lc->config,"sound","echolimiter",0));
        linphone_core_enable_agc(lc,
                lp_config_get_int(lc->config,"sound","agc",0));
+
+       gain=lp_config_get_float(lc->config,"sound","soft_play_lev",0);
+               linphone_core_set_soft_play_level(lc,gain);
 }
 
 static void sip_config_read(LinphoneCore *lc)
@@ -1977,6 +1981,10 @@ static void post_configure_audio_streams(LinphoneCore *lc){
        float gain=lp_config_get_float(lc->config,"sound","mic_gain",-1);
        if (gain!=-1)
                audio_stream_set_mic_gain(st,gain);
+       float recv_gain = lc->sound_conf.soft_play_lev;
+       if (recv_gain != 0) {
+               linphone_core_set_soft_play_level(lc,recv_gain);
+       }
        if (linphone_core_echo_limiter_enabled(lc)){
                float speed=lp_config_get_float(lc->config,"sound","el_speed",-1);
                float thres=lp_config_get_float(lc->config,"sound","el_thres",-1);
@@ -2364,6 +2372,27 @@ void linphone_core_set_ring_level(LinphoneCore *lc, int level){
        if (sndcard) ms_snd_card_set_level(sndcard,MS_SND_CARD_PLAYBACK,level);
 }
 
+
+void linphone_core_set_soft_play_level(LinphoneCore *lc, float level){
+       float gain=level;
+       lc->sound_conf.soft_play_lev=level;
+       AudioStream *st=lc->audiostream;
+       if (!st) return; /*just return*/
+
+       if (st->volrecv){
+               ms_filter_call_method(st->volrecv,MS_VOLUME_SET_DB_GAIN,&gain);
+       }else ms_warning("Could not apply gain: gain control wasn't activated.");
+}
+float linphone_core_get_soft_play_level(LinphoneCore *lc) {
+       float gain=0;
+       AudioStream *st=lc->audiostream;
+       if (st->volrecv){
+               ms_filter_call_method(st->volrecv,MS_VOLUME_GET,&gain);
+       }else ms_warning("Could not get gain: gain control wasn't activated.");
+
+       return gain;
+}
+
 /**
  * Set sound playback level in 0-100 scale
  *