更新 'src/Network/fgcom.cxx'

This commit is contained in:
zhongjin 2022-10-22 15:15:53 +08:00
parent b53cb00d9c
commit 1bec4f0bd6

View File

@ -326,6 +326,9 @@ void FGCom::postinit()
iaxc_input_level_set( 0.0 );
iaxc_output_level_set(getCurrentCommVolume());
SG_LOG(SG_IO, SG_INFO, "FGCom: Mute the mic and set speaker at start " << getCurrentCommVolume());
iaxc_millisleep(50);
// Do the first call at start
@ -343,8 +346,8 @@ double FGCom::getCurrentCommVolume() const {
rv = rv * _commVolumeNode->getFloatValue();
//zhongjin
// return rv;
return 1.0;
rv = 0.9;
return rv;
}
double FGCom::getCurrentFrequencyKhz() const {
return 10 * static_cast<int>(_currentCommFrequency * 100 + 0.25);
@ -402,6 +405,9 @@ void FGCom::setupCommFrequency(int channel) {
}
void FGCom::connectToCommFrequency() {
SG_LOG(SG_IO, SG_INFO, "FGCom: connectToCommFrequency" );
// ensure that the current comm is still in range
if ((_currentCallFrequency > 0.0) && !isInRange(_currentCallFrequency)) {
SG_LOG(SG_IO, SG_WARN, "FGCom: call out of range of: " << _currentCallFrequency);
@ -484,6 +490,8 @@ void FGCom::shutdown()
_initialized = false;
_enabled = false;
SG_LOG(SG_IO, SG_INFO, "FGCom: shutdown" );
iaxc_set_event_callback(NULL);
iaxc_unregister(_regId);
iaxc_stop_processing_thread();
@ -520,6 +528,9 @@ void FGCom::valueChanged(SGPropertyNode *prop)
}
if (prop == _commVolumeNode && _enabled) {
SG_LOG(SG_IO, SG_INFO, "FGCom: prop = _commVolumeNode" );
if (_ptt_node->getIntValue()) {
SG_LOG(SG_IO, SG_INFO, "FGCom: ignoring change comm volume as PTT pressed");
}
@ -542,6 +553,9 @@ void FGCom::valueChanged(SGPropertyNode *prop)
}
if (prop == _ptt_node && _enabled) {
SG_LOG(SG_IO, SG_INFO, "FGCom: prop = _ptt_node" );
if (_ptt_node->getIntValue()) {
// ensure that we are on the right channel by calling setupCommFrequency
setupCommFrequency();
@ -552,7 +566,8 @@ void FGCom::valueChanged(SGPropertyNode *prop)
SG_LOG(SG_IO, SG_INFO, "FGCom: PTT active: " << _currentCallFrequency);
}
else {
iaxc_output_level_set(getCurrentCommVolume());
//iaxc_output_level_set(getCurrentCommVolume());
iaxc_output_level_set(0.9);
iaxc_input_level_set(0.0);
SG_LOG(SG_IO, SG_INFO, "FGCom: PTT release: " << _currentCallFrequency << " vol=" << getCurrentCommVolume());
_mpTransmitFrequencyNode->setValue(0);