Skip to content

Commit

Permalink
Debug builds only: Added DEBUG_SIGQLY UDP field. Using this one can o…
Browse files Browse the repository at this point in the history
…verride the calculated signal quality for incoming signals to test the applied audio effects more easily. <0 disables the override, otherwise 0.0 to 1.0 denotes the signal quality.
  • Loading branch information
hbeni committed Sep 22, 2020
1 parent 87fb0f9 commit c8f37b4
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
8 changes: 8 additions & 0 deletions client/mumble-plugin/fgcom-mumble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,14 @@ bool mumble_onAudioSourceFetched(float *outputPCM, uint32_t sampleCount, uint16_
// - we did not have any info on the client
// - the client was out of range
// - we did not tune the frequency (or radio was broken, or radio squelch cut off)
#ifdef DEBUG
// Debug code: Allow override of signal quality for debugging purposes
if (fgcom_debug_signalstrength >= 0) {
bestSignalStrength = fgcom_debug_signalstrength;
pluginDbg("mumble_onAudioSourceFetched(): signalQuality debug override to "+std::to_string(fgcom_debug_signalstrength)+" in effect!");
}
#endif

rv = true; // we adjust the stream in any case
if (isLandline) {
// we got a landline connection!
Expand Down
15 changes: 15 additions & 0 deletions client/mumble-plugin/lib/io_UDPServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@
#include "mumble/MumblePlugin_v_1_0_x.h"
#include "fgcom-mumble.h"

#ifdef DEBUG
float fgcom_debug_signalstrength = -1;
#endif


/*
* Process a received message:
Expand Down Expand Up @@ -401,6 +405,17 @@ std::map<int, fgcom_udp_parseMsg_result> fgcom_udp_parseMsg(char buffer[MAXLINE]
if (token_key == "AUDIO_FX_RADIO") {
fgcom_cfg.radioAudioEffects = (token_value == "0" || token_value == "false" || token_value == "off")? false : true;
}


#ifdef DEBUG
// DEBUG: allow override of signal quality for incoming transmissions
if (token_key == "DEBUG_SIGQLY") {
fgcom_debug_signalstrength = std::stof(token_value);
if (fgcom_debug_signalstrength > 1) fgcom_debug_signalstrength = 1;
if (fgcom_debug_signalstrength < 0) fgcom_debug_signalstrength = -1;
pluginDbg("[UDP-server] debug override of signal quality updated to "+std::to_string(fgcom_debug_signalstrength));
}
#endif


} else {
Expand Down
5 changes: 5 additions & 0 deletions client/mumble-plugin/lib/io_UDPServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
#define MAXLINE 1024 // max byte size of a udp packet


#ifdef DEBUG
// Debug code: Allow override of signal quality for debugging purposes
extern float fgcom_debug_signalstrength; // <0 to disable
#endif


/*
* Spawn the udp server thread.
Expand Down

0 comments on commit c8f37b4

Please sign in to comment.