//iaxc_mic_boost_set( _micBoost_node->getIntValue() );
iaxc_set_formats( IAXC_FORMAT_GSM, IAXC_FORMAT_GSM );
iaxc_start_processing_thread ();
+
+ // Now IAXClient is initialized
+ _initialized = true;
if ( _register ) {
_regId = iaxc_register( const_cast<char*>(_username.c_str()),
void FGCom::update(double dt)
{
- if ( !_enabled ) {
+ if ( !_enabled || !_initialized ) {
return;
}
}
SG_LOG( SG_IO, SG_INFO, "FGCom shutdown()" );
+ _initialized = false;
_enabled = false;
iaxc_unregister(_regId);
}
//FIXME: not implemented in IAX audio driver (audio_openal.c)
- if (prop == _micBoost_node && _enabled) {
+ if (prop == _micBoost_node && _initialized) {
int micBoost = prop->getIntValue();
SG_LOG( SG_IO, SG_INFO, "FGCom mic-boost= " << micBoost );
SG_CLAMP_RANGE<int>( micBoost, 0, 1 );
}
//FIXME: not implemented in IAX audio driver (audio_openal.c)
- if ((prop == _selectedInput_node || prop == _selectedOutput_node) && _enabled) {
+ if ((prop == _selectedInput_node || prop == _selectedOutput_node) && _initialized) {
int selectedInput = _selectedInput_node->getIntValue();
int selectedOutput = _selectedOutput_node->getIntValue();
SG_LOG( SG_IO, SG_INFO, "FGCom selected-input= " << selectedInput );
void FGCom::testMode(bool testMode)
{
- if(testMode) {
+ if(testMode && _initialized) {
_enabled = false;
iaxc_dump_call_number(_callComm0);
iaxc_input_level_set( _micLevel_node->getFloatValue() );
if( _callComm0 == -1 )
SG_LOG( SG_IO, SG_ALERT, "FGCom cannot call selected freq (test mode)" );
} else {
- iaxc_dump_call_number(_callComm0);
- iaxc_millisleep(IAX_DELAY);
- _callComm0 = -1;
- _enabled = true;
+ if( _initialized ) {
+ iaxc_dump_call_number(_callComm0);
+ iaxc_millisleep(IAX_DELAY);
+ _callComm0 = -1;
+ _enabled = true;
+ }
}
}