Commit 00eaddcf authored by jehan's avatar jehan
Browse files

add linphone_core_set/get_soft_play_lev

parent bcd737a4
......@@ -125,7 +125,7 @@ static void call_ringing(SalOp *h){
}
}else{
/*accept early media */
if (lc->audiostream->ticker!=NULL){
if (lc->audiostream && lc->audiostream->ticker!=NULL){
/*streams already started */
ms_message("Early media already started.");
return;
......
......@@ -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)
......@@ -1962,6 +1966,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);
......@@ -2351,6 +2359,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
*
......
......@@ -607,6 +607,18 @@ int linphone_core_get_play_level(LinphoneCore *lc);
int linphone_core_get_rec_level(LinphoneCore *lc);
void linphone_core_set_ring_level(LinphoneCore *lc, int level);
void linphone_core_set_play_level(LinphoneCore *lc, int level);
/**
* Allow to control play level before entering sound card: level in db
*
* @ingroup media_parameters
**/
void linphone_core_set_soft_play_level(LinphoneCore *lc, float level);
/**
* get play level before entering sound card: level in db
*
* @ingroup media_parameters
**/
float linphone_core_get_soft_play_level(LinphoneCore *lc);
void linphone_core_set_rec_level(LinphoneCore *lc, int level);
const char * linphone_core_get_ringer_device(LinphoneCore *lc);
const char * linphone_core_get_playback_device(LinphoneCore *lc);
......
......@@ -268,6 +268,18 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setNetworkStateReachable
linphone_core_set_network_reachable((LinphoneCore*)lc,isReachable);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setSoftPlayLevel( JNIEnv* env
,jobject thiz
,jlong lc
,jfloat gain) {
linphone_core_set_soft_play_level((LinphoneCore*)lc,gain);
}
extern "C" float Java_org_linphone_core_LinphoneCoreImpl_getSoftPlayLevel( JNIEnv* env
,jobject thiz
,jlong lc) {
return linphone_core_get_soft_play_level((LinphoneCore*)lc);
}
//ProxyConfig
......
......@@ -289,6 +289,7 @@ typedef struct sound_config
char rec_lev;
char play_lev;
char ring_lev;
char soft_play_lev;
char source;
char *local_ring;
char *remote_ring;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment