_enabled_node = node->getChild( "enabled", 0, true );
_micBoost_node = node->getChild( "mic-boost", 0, true );
_micLevel_node = node->getChild( "mic-level", 0, true );
+ _silenceThd_node = node->getChild( "silence-threshold", 0, true );
_speakerLevel_node = node->getChild( "speaker-level", 0, true );
_selectedInput_node = node->getChild( "device-input", 0, true );
_selectedOutput_node = node->getChild( "device-output", 0, true );
if ( !_micLevel_node->hasValue() )
_micLevel_node->setFloatValue(1.0);
+ if ( !_silenceThd_node->hasValue() )
+ _silenceThd_node->setFloatValue(-20.0);
+
if ( !_register_node->hasValue() )
_register_node->setBoolValue(false);
_selectedOutput_node->addChangeListener(this);
_selectedInput_node->addChangeListener(this);
_speakerLevel_node->addChangeListener(this);
+ _silenceThd_node->addChangeListener(this);
_micBoost_node->addChangeListener(this);
_micLevel_node->addChangeListener(this);
_enabled_node->addChangeListener(this);
iaxc_set_formats (IAXC_FORMAT_SPEEX, IAXC_FORMAT_ULAW|IAXC_FORMAT_SPEEX);
iaxc_set_speex_settings(1, 5, 0, 1, 0, 3);
iaxc_set_filters(IAXC_FILTER_AGC | IAXC_FILTER_DENOISE);
- iaxc_set_silence_threshold(-20.0);
+ iaxc_set_silence_threshold(_silenceThd_node->getFloatValue());
iaxc_start_processing_thread ();
// Now IAXClient is initialized
return;
}
+ if (prop == _silenceThd_node && _initialized) {
+ float silenceThd = prop->getFloatValue();
+ SG_CLAMP_RANGE<float>( silenceThd, -60, 0 );
+ iaxc_set_silence_threshold( silenceThd );
+ return;
+ }
+
//FIXME: not implemented in IAX audio driver (audio_openal.c)
if (prop == _micBoost_node && _initialized) {
int micBoost = prop->getIntValue();
double previous_com_frequency = 0.0;
int previous_ptt = 0;
float previous_vol = 0.0;
+float previous_thd = 0.0;
int com_select = 0;
int max_com_instruments = 2;
struct airport *airportlist;
static const char *audio_out;
static double level_in = 0.7;
static double level_out = 0.7;
+static double silence_thd = -20.0;
static bool mic_boost;
static char codec_option;
static const char *callsign;
"speaker output level (0.0 - 1.0)", 0},
{"mic-boost", 'b', false, OPTION_BOOL, &mic_boost, 0, "enable mic boost",
0},
+ {"silence-threshold", 't', false, OPTION_DOUBLE, &silence_thd, 0, "set silence threshold (-60.0 - 0.0)",
+ 0},
{"list-audio", 'l', false, OPTION_BOOL, &list_audio, 0,
"list audio devices", 0},
{"set-audio-in", 'r', true, OPTION_STRING, &audio_in, 0,
previous_vol = data.OUTPUT_VOL;
}
+ /* Check for silence threshold change */
+ if (previous_thd != data.SILENCE_THD)
+ {
+ SG_LOG( SG_GENERAL, SG_ALERT, "Set silent threshold to " << data.SILENCE_THD );
+
+ iaxc_set_silence_threshold( data.SILENCE_THD );
+ previous_thd = data.SILENCE_THD;
+ }
+
/* Check for callsign change */
if (strcmp(callsign, data.CALLSIGN) != 0)
{
iaxc_set_formats (IAXC_FORMAT_SPEEX, IAXC_FORMAT_ULAW|IAXC_FORMAT_SPEEX);
iaxc_set_speex_settings(1, 5, 0, 1, 0, 3);
iaxc_set_filters(IAXC_FILTER_AGC | IAXC_FILTER_DENOISE);
- iaxc_set_silence_threshold(-20.0);
+ iaxc_set_silence_threshold(silence_thd);
iaxc_set_event_callback (iaxc_callback);
iaxc_start_processing_thread ();
data->OUTPUT_VOL = atof (fields[1]);
SG_LOG( SG_GENERAL, SG_DEBUG, "OUTPUT_VOL=" << data->OUTPUT_VOL );
}
+ else if (strcmp (fields[0], "SILENCE_THD") == 0)
+ {
+ data->SILENCE_THD = atof (fields[1]);
+ SG_LOG( SG_GENERAL, SG_DEBUG, "SILENCE_THD=" << data->SILENCE_THD );
+ }
else if (strcmp (fields[0], "CALLSIGN") == 0)
{
data->CALLSIGN = fields[1];