Commit b1b9fc24 authored by Guillaume BIENKOWSKI's avatar Guillaume BIENKOWSKI

Add a location specifier for the equalizer. Defaults on output graph, but can...

Add a location specifier for the equalizer. Defaults on output graph, but can be placed on input graph by specifying the "eq_loc" variable of the stream.
parent a1c7195f
......@@ -271,6 +271,12 @@ typedef enum EchoLimiterType{
ELControlFull
} EchoLimiterType;
typedef enum EqualizerLocation {
MSEqualizerHP = 0,
MSEqualizerMic
} EqualizerLocation;
struct _AudioStream
{
MediaStream ms;
......@@ -300,6 +306,7 @@ struct _AudioStream
}av_recorder;
char *recorder_file;
EchoLimiterType el_type; /*use echo limiter: two MSVolume, measured input level controlling local output level*/
EqualizerLocation eq_loc;
uint32_t features;
bool_t play_dtmfs;
bool_t use_gc;
......@@ -323,9 +330,9 @@ MS2_PUBLIC AudioStream *audio_stream_start_with_sndcards(RtpProfile * prof, int
MS2_PUBLIC int audio_stream_start_with_files (AudioStream * stream, RtpProfile * prof,
const char *remip, int remport, int rem_rtcp_port,
int pt, int jitt_comp,
const char * infile, const char * outfile);
const char *remip, int remport, int rem_rtcp_port,
int pt, int jitt_comp,
const char * infile, const char * outfile);
/**
* Starts an audio stream from/to local wav files or soundcards.
......@@ -606,7 +613,7 @@ struct _VideoStream
bool_t display_filter_auto_rotate_enabled;
bool_t source_performs_encoding;
bool_t output_performs_decoding;
};
typedef struct _VideoStream VideoStream;
......
......@@ -53,7 +53,6 @@ static void equalizer_state_flatten(EqualizerState *s){
s->fft_cpx[i]=val;
}
/* TODO: rate also beyond 8000 */
static EqualizerState * equalizer_state_new(int nfft){
EqualizerState *s=(EqualizerState *)ms_new0(EqualizerState,1);
s->rate=8000;
......@@ -191,7 +190,7 @@ static void norm_and_apodize(ms_word16_t *s, int len){
w=0.54 - (0.46*cos(x));
//w=0.42 - (0.5*cos(x)) + (0.08*cos(2*x));
s[i]=w*(float)s[i];
}
}
}
static void equalizer_state_compute_impulse_response(EqualizerState *s){
......
......@@ -662,6 +662,8 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
ms_connection_helper_link(&h,stream->soundread,-1,0);
if (stream->read_resampler)
ms_connection_helper_link(&h,stream->read_resampler,0,0);
if( stream->equalizer && stream->eq_loc == MSEqualizerMic )
ms_connection_helper_link(&h,stream->equalizer, 0, 0);
if (stream->ec)
ms_connection_helper_link(&h,stream->ec,1,1);
if (stream->volsend)
......@@ -685,7 +687,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
ms_connection_helper_link(&h,stream->volrecv,0,0);
if (stream->recv_tee)
ms_connection_helper_link(&h,stream->recv_tee,0,0);
if (stream->equalizer)
if (stream->equalizer && stream->eq_loc == MSEqualizerHP)
ms_connection_helper_link(&h,stream->equalizer,0,0);
if (stream->local_mixer){
ms_connection_helper_link(&h,stream->local_mixer,0,0);
......@@ -1030,6 +1032,8 @@ void audio_stream_stop(AudioStream * stream){
ms_connection_helper_unlink(&h,stream->soundread,-1,0);
if (stream->read_resampler!=NULL)
ms_connection_helper_unlink(&h,stream->read_resampler,0,0);
if( stream->equalizer && stream->eq_loc == MSEqualizerMic)
ms_connection_helper_unlink(&h, stream->equalizer, 0,0);
if (stream->ec!=NULL)
ms_connection_helper_unlink(&h,stream->ec,1,1);
if (stream->volsend!=NULL)
......@@ -1053,7 +1057,7 @@ void audio_stream_stop(AudioStream * stream){
ms_connection_helper_unlink(&h,stream->volrecv,0,0);
if (stream->recv_tee)
ms_connection_helper_unlink(&h,stream->recv_tee,0,0);
if (stream->equalizer!=NULL)
if (stream->equalizer!=NULL && stream->eq_loc == MSEqualizerHP)
ms_connection_helper_unlink(&h,stream->equalizer,0,0);
if (stream->local_mixer){
ms_connection_helper_unlink(&h,stream->local_mixer,0,0);
......
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