更新 'src/Network/fgcom.cxx'

next
zhongjin 2 years ago
parent fdcdc4d6b4
commit 4ddf59ebe4

@ -226,10 +226,8 @@ void FGCom::init()
_maxRange = MAX_RANGE;
_minRange = MIN_RANGE;
SG_LOG(SG_IO, SG_ALERT, "FGCom: ---------------------------------------");
SG_LOG(SG_SOUND, SG_DEBUG, "FGCom: init");
}
@ -237,7 +235,7 @@ void FGCom::init()
void FGCom::postinit()
{
SG_LOG(SG_IO, SG_ALERT, "FGCom: 1111111111111111111111111111111111111");
SG_LOG(SG_SOUND, SG_DEBUG, "FGCom: postinit() 11111111111111111111111111");
if( !_enabled ) {
return;
@ -245,7 +243,7 @@ void FGCom::postinit()
//WARNING: this _must_ be executed after sound system is totally initialized !
if( iaxc_initialize(4) ) {
SG_LOG(SG_IO, SG_ALERT, "FGCom: cannot initialize iaxclient");
SG_LOG(SG_SOUND, SG_DEBUG, "FGCom: cannot initialize iaxclient");
_enabled = false;
return;
}
@ -291,7 +289,7 @@ void FGCom::postinit()
const_cast<char*>(_password.c_str()),
const_cast<char*>(_server.c_str()) );
if( _regId == -1 ) {
SG_LOG(SG_SOUND, SG_ALERT, "FGCom: cannot register iaxclient");
SG_LOG(SG_SOUND, SG_DEBUG, "FGCom: cannot register iaxclient");
return;
}
}
@ -385,13 +383,13 @@ double FGCom::getCurrentCommVolume() const {
if (_speakerLevel_node)
rv = _speakerLevel_node->getFloatValue();
SG_LOG(SG_SOUND, SG_INFO, "FGCom: _speakerLevel_node " << _speakerLevel_node->getFloatValue());
SG_LOG(SG_SOUND, SG_DEBUG, "FGCom: _speakerLevel_node " << _speakerLevel_node->getFloatValue());
if (_commVolumeNode)
//暂时关闭 _commVolumeNode
//rv = rv * _commVolumeNode->getFloatValue();
SG_LOG(SG_SOUND, SG_INFO, "FGCom: _commVolumeNode " << _commVolumeNode->getFloatValue());
SG_LOG(SG_SOUND, SG_DEBUG, "FGCom: _commVolumeNode " << _commVolumeNode->getFloatValue());
return rv;
}
@ -401,7 +399,7 @@ double FGCom::getCurrentFrequencyKhz() const {
void FGCom::setupCommFrequency(int channel) {
SG_LOG(SG_SOUND, SG_INFO, "setupCommFrequency1 channel=" << channel);
SG_LOG(SG_SOUND, SG_DEBUG, "setupCommFrequency1 channel=" << channel);
if (channel < 1) {
if (_selected_comm_node != nullptr) {
@ -409,13 +407,13 @@ void FGCom::setupCommFrequency(int channel) {
}
}
SG_LOG(SG_SOUND, SG_INFO, "setupCommFrequency2 channel=" << channel);
SG_LOG(SG_SOUND, SG_DEBUG, "setupCommFrequency2 channel=" << channel);
// disconnect if channel set to 0
if (channel < 1) {
if (_currentCallIdent != -1) {
iaxc_dump_call_number(_currentCallIdent);
SG_LOG(SG_SOUND, SG_INFO, "FGCom: disconnect as channel 0 " << _currentCallIdent);
SG_LOG(SG_SOUND, SG_DEBUG, "FGCom: disconnect as channel 0 " << _currentCallIdent);
_currentCallIdent = -1;
}
_currentCommFrequency = 0.0;
@ -447,15 +445,15 @@ void FGCom::setupCommFrequency(int channel) {
}
}
}
SG_LOG(SG_SOUND, SG_INFO, "FGCom: setupCommFrequency node listener failed: channel " << channel);
SG_LOG(SG_SOUND, SG_DEBUG, "FGCom: setupCommFrequency node listener failed: channel " << channel);
}
SG_LOG(SG_SOUND, SG_INFO, "setupCommFrequency3 _commFrequencyNode=" << _commFrequencyNode);
SG_LOG(SG_SOUND, SG_DEBUG, "setupCommFrequency3 _commFrequencyNode=" << _commFrequencyNode);
if (_commFrequencyNode)
_commFrequencyNode->removeChangeListener(this);
SG_LOG(SG_SOUND, SG_INFO, "FGCom: setupCommFrequency invalid channel " << channel);
SG_LOG(SG_SOUND, SG_DEBUG, "FGCom: setupCommFrequency invalid channel " << channel);
_currentCommFrequency = 0.0;
}
@ -479,7 +477,7 @@ void FGCom::connectToCommFrequency() {
if (_currentCallIdent != -1) {
iaxc_dump_call_number(_currentCallIdent);
SG_LOG(SG_SOUND, SG_INFO, "FGCom: disconnect as freq 0: current call " << _currentCallIdent);
SG_LOG(SG_SOUND, SG_DEBUG, "FGCom: disconnect as freq 0: current call " << _currentCallIdent);
_currentCallIdent = -1;
}
return;
@ -489,7 +487,7 @@ void FGCom::connectToCommFrequency() {
if (_currentCallIdent != -1) {
iaxc_dump_call_number(_currentCallIdent);
SG_LOG(SG_SOUND, SG_INFO, "FGCom: dump_call_number " << _currentCallIdent);
SG_LOG(SG_SOUND, SG_DEBUG, "FGCom: dump_call_number " << _currentCallIdent);
_currentCallIdent = -1;
}
@ -510,12 +508,12 @@ void FGCom::connectToCommFrequency() {
return;
}
SG_LOG(SG_SOUND, SG_INFO, "FGCom: connectToCommFrequency num=" << num);
SG_LOG(SG_SOUND, SG_DEBUG, "FGCom: connectToCommFrequency num=" << num);
if (!num.empty()) {
_currentCallIdent = iaxc_call(num.c_str());
SG_LOG(SG_SOUND, SG_INFO, "FGCom: iaxc_call(" << num << ") _currentCallIdent=" << _currentCallIdent);
SG_LOG(SG_SOUND, SG_DEBUG, "FGCom: iaxc_call(" << num << ") _currentCallIdent=" << _currentCallIdent);
if (_currentCallIdent == -1)
SG_LOG(SG_SOUND, SG_DEBUG, "FGCom: cannot call " << num.c_str());
@ -532,6 +530,9 @@ void FGCom::connectToCommFrequency() {
void FGCom::updateCall()
{
SG_LOG(SG_SOUND,SG_DEBUG,"updateCall()");
if (_processingTimer.elapsedMSec() > IAX_DELAY) {
_processingTimer.stamp();

Loading…
Cancel
Save