更新 'utils/fgcom/fgcom_external.cxx'

This commit is contained in:
zhongjin 2023-10-29 15:40:30 +08:00
parent af124cf7e5
commit 7ad4a13b65

View File

@ -133,7 +133,12 @@ int main(int argc, char** argv)
sgSocket.open(false); sgSocket.open(false);
sgSocket.bind(_host.c_str(), _port); sgSocket.bind(_host.c_str(), _port);
sgSocket.setBlocking(false); sgSocket.setBlocking(false);
lib_setVolume(0.0, 1.0);
//lib_setVolume(0.0, 1.0);
iaxc_input_level_set(0.1);
iaxc_output_level_set(0.8);
static char currentPacket[MAXBUFLEN+2], previousPacket[MAXBUFLEN+2]; static char currentPacket[MAXBUFLEN+2], previousPacket[MAXBUFLEN+2];
struct Data currentData, previousData, previousPosData; struct Data currentData, previousData, previousPosData;
double currentFreq = -1, previousFreq = -1; double currentFreq = -1, previousFreq = -1;
@ -179,18 +184,31 @@ int main(int argc, char** argv)
SG_LOG( SG_GENERAL, SG_INFO, "Select radio " << activeComm << " on " << currentFreq << " MHz" ); SG_LOG( SG_GENERAL, SG_INFO, "Select radio " << activeComm << " on " << currentFreq << " MHz" );
} else if(currentData.ptt) { } else if(currentData.ptt) {
SG_LOG( SG_GENERAL, SG_INFO, "[SPEAK] unmute mic, mute speaker" ); SG_LOG( SG_GENERAL, SG_INFO, "[SPEAK] unmute mic, mute speaker" );
lib_setVolume(1.0, 0.0);
//lib_setVolume(1.0, 0.0);
iaxc_input_level_set(1.0);
iaxc_output_level_set(0.1);
} else { } else {
SG_LOG( SG_GENERAL, SG_INFO, "[LISTEN] mute mic, unmute speaker" ); SG_LOG( SG_GENERAL, SG_INFO, "[LISTEN] mute mic, unmute speaker" );
//lib_setVolume(0.0, currentData.outputVol); //lib_setVolume(0.0, currentData.outputVol);
lib_setVolume(0.0, 1.0); //lib_setVolume(0.0, 1.0);
iaxc_input_level_set(0.1);
iaxc_output_level_set(0.8);
} }
} }
if(currentData.outputVol != previousData.outputVol) if(currentData.outputVol != previousData.outputVol)
lib_setVolume(0.0, currentData.outputVol); //lib_setVolume(0.0, currentData.outputVol);
iaxc_input_level_set(0.1);
iaxc_output_level_set(0.8);
if(currentData.silenceThd != previousData.silenceThd) if(currentData.silenceThd != previousData.silenceThd)
lib_setSilenceThreshold(currentData.silenceThd); lib_setSilenceThreshold(currentData.silenceThd);
@ -256,11 +274,17 @@ int main(int argc, char** argv)
if(mode == OBS) { if(mode == OBS) {
SG_LOG( SG_GENERAL, SG_INFO, "Entering main loop in mode OBS (max duration: 6 hours)" ); SG_LOG( SG_GENERAL, SG_INFO, "Entering main loop in mode OBS (max duration: 6 hours)" );
sessionDuration *= 2160; // 6 hours for OBS mode sessionDuration *= 2160; // 6 hours for OBS mode
lib_setVolume(0.0, 1.0); //lib_setVolume(0.0, 1.0);
iaxc_input_level_set(0.1);
iaxc_output_level_set(0.8);
lib_setCallerId("::OBS::"); lib_setCallerId("::OBS::");
num = computePhoneNumber(_frequency, _airport); num = computePhoneNumber(_frequency, _airport);
} else { } else {
lib_setVolume(1.0, 1.0); //lib_setVolume(1.0, 1.0);
iaxc_input_level_set(1.0);
iaxc_output_level_set(0.8);
if(mode == TEST) { if(mode == TEST) {
sessionDuration *= 65; // 65 seconds for TEST mode sessionDuration *= 65; // 65 seconds for TEST mode
SG_LOG( SG_GENERAL, SG_INFO, "Entering main loop in mode TEST (max duration: 65 seconds)" ); SG_LOG( SG_GENERAL, SG_INFO, "Entering main loop in mode TEST (max duration: 65 seconds)" );
@ -565,6 +589,12 @@ bool lib_init()
iaxc_set_event_callback(iaxc_callback); iaxc_set_event_callback(iaxc_callback);
iaxc_start_processing_thread (); iaxc_start_processing_thread ();
lib_setSilenceThreshold(_silenceThd); lib_setSilenceThreshold(_silenceThd);
iaxc_input_level_set(0.1);
iaxc_output_level_set(0.8);
iaxc_millisleep(30);
return true; return true;
} }