更新 'src/Network/fgcom.cxx'
This commit is contained in:
parent
b53cb00d9c
commit
1bec4f0bd6
@ -326,6 +326,9 @@ void FGCom::postinit()
|
|||||||
iaxc_input_level_set( 0.0 );
|
iaxc_input_level_set( 0.0 );
|
||||||
iaxc_output_level_set(getCurrentCommVolume());
|
iaxc_output_level_set(getCurrentCommVolume());
|
||||||
|
|
||||||
|
SG_LOG(SG_IO, SG_INFO, "FGCom: Mute the mic and set speaker at start " << getCurrentCommVolume());
|
||||||
|
|
||||||
|
|
||||||
iaxc_millisleep(50);
|
iaxc_millisleep(50);
|
||||||
|
|
||||||
// Do the first call at start
|
// Do the first call at start
|
||||||
@ -343,8 +346,8 @@ double FGCom::getCurrentCommVolume() const {
|
|||||||
rv = rv * _commVolumeNode->getFloatValue();
|
rv = rv * _commVolumeNode->getFloatValue();
|
||||||
|
|
||||||
//zhongjin
|
//zhongjin
|
||||||
// return rv;
|
rv = 0.9;
|
||||||
return 1.0;
|
return rv;
|
||||||
}
|
}
|
||||||
double FGCom::getCurrentFrequencyKhz() const {
|
double FGCom::getCurrentFrequencyKhz() const {
|
||||||
return 10 * static_cast<int>(_currentCommFrequency * 100 + 0.25);
|
return 10 * static_cast<int>(_currentCommFrequency * 100 + 0.25);
|
||||||
@ -402,6 +405,9 @@ void FGCom::setupCommFrequency(int channel) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FGCom::connectToCommFrequency() {
|
void FGCom::connectToCommFrequency() {
|
||||||
|
|
||||||
|
SG_LOG(SG_IO, SG_INFO, "FGCom: connectToCommFrequency" );
|
||||||
|
|
||||||
// ensure that the current comm is still in range
|
// ensure that the current comm is still in range
|
||||||
if ((_currentCallFrequency > 0.0) && !isInRange(_currentCallFrequency)) {
|
if ((_currentCallFrequency > 0.0) && !isInRange(_currentCallFrequency)) {
|
||||||
SG_LOG(SG_IO, SG_WARN, "FGCom: call out of range of: " << _currentCallFrequency);
|
SG_LOG(SG_IO, SG_WARN, "FGCom: call out of range of: " << _currentCallFrequency);
|
||||||
@ -484,13 +490,15 @@ void FGCom::shutdown()
|
|||||||
_initialized = false;
|
_initialized = false;
|
||||||
_enabled = false;
|
_enabled = false;
|
||||||
|
|
||||||
|
SG_LOG(SG_IO, SG_INFO, "FGCom: shutdown" );
|
||||||
|
|
||||||
iaxc_set_event_callback(NULL);
|
iaxc_set_event_callback(NULL);
|
||||||
iaxc_unregister(_regId);
|
iaxc_unregister(_regId);
|
||||||
iaxc_stop_processing_thread();
|
iaxc_stop_processing_thread();
|
||||||
iaxc_shutdown();
|
iaxc_shutdown();
|
||||||
|
|
||||||
// added to help debugging lingering IAX thread after fgOSCloseWindow
|
// added to help debugging lingering IAX thread after fgOSCloseWindow
|
||||||
flightgear::addSentryBreadcrumb("Did shutdown FGCom", "info");
|
flightgear::addSentryBreadcrumb("Did shutdown FGCom", "info");
|
||||||
|
|
||||||
assert( static_instance == this );
|
assert( static_instance == this );
|
||||||
static_instance = NULL;
|
static_instance = NULL;
|
||||||
@ -520,6 +528,9 @@ void FGCom::valueChanged(SGPropertyNode *prop)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (prop == _commVolumeNode && _enabled) {
|
if (prop == _commVolumeNode && _enabled) {
|
||||||
|
|
||||||
|
SG_LOG(SG_IO, SG_INFO, "FGCom: prop = _commVolumeNode" );
|
||||||
|
|
||||||
if (_ptt_node->getIntValue()) {
|
if (_ptt_node->getIntValue()) {
|
||||||
SG_LOG(SG_IO, SG_INFO, "FGCom: ignoring change comm volume as PTT pressed");
|
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) {
|
if (prop == _ptt_node && _enabled) {
|
||||||
|
|
||||||
|
SG_LOG(SG_IO, SG_INFO, "FGCom: prop = _ptt_node" );
|
||||||
|
|
||||||
if (_ptt_node->getIntValue()) {
|
if (_ptt_node->getIntValue()) {
|
||||||
// ensure that we are on the right channel by calling setupCommFrequency
|
// ensure that we are on the right channel by calling setupCommFrequency
|
||||||
setupCommFrequency();
|
setupCommFrequency();
|
||||||
@ -552,7 +566,8 @@ void FGCom::valueChanged(SGPropertyNode *prop)
|
|||||||
SG_LOG(SG_IO, SG_INFO, "FGCom: PTT active: " << _currentCallFrequency);
|
SG_LOG(SG_IO, SG_INFO, "FGCom: PTT active: " << _currentCallFrequency);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
iaxc_output_level_set(getCurrentCommVolume());
|
//iaxc_output_level_set(getCurrentCommVolume());
|
||||||
|
iaxc_output_level_set(0.9);
|
||||||
iaxc_input_level_set(0.0);
|
iaxc_input_level_set(0.0);
|
||||||
SG_LOG(SG_IO, SG_INFO, "FGCom: PTT release: " << _currentCallFrequency << " vol=" << getCurrentCommVolume());
|
SG_LOG(SG_IO, SG_INFO, "FGCom: PTT release: " << _currentCallFrequency << " vol=" << getCurrentCommVolume());
|
||||||
_mpTransmitFrequencyNode->setValue(0);
|
_mpTransmitFrequencyNode->setValue(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user