From f0e0978d7b49e5d85bdffc9e208d6e5730cc1284 Mon Sep 17 00:00:00 2001 From: zhongjin Date: Tue, 6 Dec 2022 15:57:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'src/Network/fgcom.cxx'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Network/fgcom.cxx | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/src/Network/fgcom.cxx b/src/Network/fgcom.cxx index e0365e4..41d3676 100644 --- a/src/Network/fgcom.cxx +++ b/src/Network/fgcom.cxx @@ -390,13 +390,13 @@ double FGCom::getCurrentCommVolume() const { if (_speakerLevel_node) { rv = rv * _speakerLevel_node->getFloatValue(); - SG_LOG(SG_SOUND, SG_ALERT, "FGCom: _speakerLevel_node " << _speakerLevel_node->getFloatValue()); +// SG_LOG(SG_SOUND, SG_ALERT, "FGCom: _speakerLevel_node " << _speakerLevel_node->getFloatValue()); } if (_commVolumeNode) { //暂时关闭 _commVolumeNode //rv = rv * _commVolumeNode->getFloatValue(); - SG_LOG(SG_SOUND, SG_ALERT, "FGCom: _commVolumeNode " << _commVolumeNode->getFloatValue()); + // SG_LOG(SG_SOUND, SG_ALERT, "FGCom: _commVolumeNode " << _commVolumeNode->getFloatValue()); } return rv; @@ -407,7 +407,7 @@ double FGCom::getCurrentFrequencyKhz() const { void FGCom::setupCommFrequency(int channel) { - SG_LOG(SG_SOUND, SG_ALERT, "setupCommFrequency1 channel=" << channel); + // SG_LOG(SG_SOUND, SG_ALERT, "setupCommFrequency1 channel=" << channel); if (channel < 1) { if (_selected_comm_node != nullptr) { @@ -415,7 +415,7 @@ void FGCom::setupCommFrequency(int channel) { } } - SG_LOG(SG_SOUND, SG_ALERT, "setupCommFrequency2 channel=" << channel); + // SG_LOG(SG_SOUND, SG_ALERT, "setupCommFrequency2 channel=" << channel); // disconnect if channel set to 0 if (channel < 1) { @@ -453,7 +453,7 @@ void FGCom::setupCommFrequency(int channel) { } } } - SG_LOG(SG_SOUND, SG_ALERT, "FGCom: setupCommFrequency node listener failed: channel " << channel); + // SG_LOG(SG_SOUND, SG_ALERT, "FGCom: setupCommFrequency node listener failed: channel " << channel); } SG_LOG(SG_SOUND, SG_ALERT, "setupCommFrequency3 _commFrequencyNode=" << _commFrequencyNode); @@ -497,7 +497,7 @@ void FGCom::connectToCommFrequency() { iaxc_dump_call_number(_currentCallIdent); - SG_LOG(SG_SOUND, SG_ALERT, "FGCom:iaxc_dump_call_number:" << _currentCallIdent); +// SG_LOG(SG_SOUND, SG_ALERT, "FGCom:iaxc_dump_call_number:" << _currentCallIdent); _currentCallIdent = -1; } @@ -510,7 +510,7 @@ void FGCom::connectToCommFrequency() { if (!isInRange(_currentCommFrequency)) { if (_currentCallIdent != -1) { - SG_LOG(SG_SOUND, SG_ALERT, "FGCom: disconnect call as not in range " << _currentCallIdent); + // SG_LOG(SG_SOUND, SG_ALERT, "FGCom: disconnect call as not in range " << _currentCallIdent); if (_currentCallIdent != -1) { iaxc_dump_call_number(_currentCallIdent); _currentCallIdent = -1; @@ -519,19 +519,19 @@ void FGCom::connectToCommFrequency() { return; } - SG_LOG(SG_SOUND, SG_ALERT, "FGCom: connectToCommFrequency num=" << num); + // SG_LOG(SG_SOUND, SG_ALERT, "FGCom: connectToCommFrequency num=" << num); if (!num.empty()) { lib_hangup(); _currentCallIdent = iaxc_call(num.c_str()); - SG_LOG(SG_SOUND, SG_ALERT, "FGCom: iaxc_call(" << num << ") _currentCallIdent=" << _currentCallIdent); + // SG_LOG(SG_SOUND, SG_ALERT, "FGCom: iaxc_call(" << num << ") _currentCallIdent=" << _currentCallIdent); if (_currentCallIdent == -1) - SG_LOG(SG_SOUND, SG_ALERT, "FGCom: cannot call " << num.c_str()); + // SG_LOG(SG_SOUND, SG_ALERT, "FGCom: cannot call " << num.c_str()); else { - SG_LOG(SG_SOUND, SG_ALERT, "FGCom: call established " << num.c_str() << " Freq: " << _currentCommFrequency); + // SG_LOG(SG_SOUND, SG_ALERT, "FGCom: call established " << num.c_str() << " Freq: " << _currentCommFrequency); _currentCallFrequency = _currentCommFrequency; _connected = true; } @@ -622,18 +622,18 @@ void FGCom::valueChanged(SGPropertyNode *prop) iaxc_input_level_set(0.0); // iaxc_output_level_set(getCurrentCommVolume()); iaxc_output_level_set(1.0); - SG_LOG(SG_SOUND, SG_ALERT, "FGCom: change comm volume=" << _commVolumeNode->getFloatValue()); +// SG_LOG(SG_SOUND, SG_ALERT, "FGCom: change comm volume=" << _commVolumeNode->getFloatValue()); } } if (prop == _selected_comm_node && _enabled) { setupCommFrequency(); - SG_LOG(SG_SOUND, SG_ALERT, "FGCom: change comm frequency (selected node): set to " << _currentCommFrequency); + // SG_LOG(SG_SOUND, SG_ALERT, "FGCom: change comm frequency (selected node): set to " << _currentCommFrequency); } if (prop == _commFrequencyNode && _enabled) { setupCommFrequency(); - SG_LOG(SG_SOUND, SG_ALERT, "FGCom: change comm frequency (property updated): set to " << _currentCommFrequency); + // SG_LOG(SG_SOUND, SG_ALERT, "FGCom: change comm frequency (property updated): set to " << _currentCommFrequency); } if (prop == _ptt_node && _enabled) { @@ -644,13 +644,23 @@ void FGCom::valueChanged(SGPropertyNode *prop) iaxc_input_level_set(_micLevel_node->getFloatValue()); //0.0 = min , 1.0 = max _mpTransmitFrequencyNode->setValue(_currentCallFrequency * 1000000); _mpTransmitPowerNode->setValue(1.0); - SG_LOG(SG_SOUND, SG_ALERT, "FGCom: PTT active: " << _currentCallFrequency); + + SGPath soundpath( globals->get_fg_root() ); + soundpath.append( "/Sounds/click.wav" ); + + SG_LOG(SG_SOUND, SG_ALERT, "FGCom: PTT active: " << soundpath); + + + + + + } else { // iaxc_output_level_set(getCurrentCommVolume()); iaxc_output_level_set(1.0); iaxc_input_level_set(0.0); - SG_LOG(SG_SOUND, SG_ALERT, "FGCom: PTT release: " << _currentCallFrequency << " vol=" << getCurrentCommVolume()); +// SG_LOG(SG_SOUND, SG_ALERT, "FGCom: PTT release: " << _currentCallFrequency << " vol=" << getCurrentCommVolume()); _mpTransmitFrequencyNode->setValue(0); _mpTransmitPowerNode->setValue(0); }