move sample level dumping option to CLI;

r05a04_dev
Bryan Biedenkapp 4 weeks ago
parent d26abdc968
commit 92a737affc

@ -175,9 +175,6 @@ system:
# Amount of time (ms) to transmit preamble tone.
preambleLength: 200
# Flag indicating the detected VOX sample level should be dumped to the log (useful for setting VOX levels).
dumpSampleLevel: false
# Flag indicating whether a network grant demand packet will be sent before audio.
grantDemand: false

@ -4,7 +4,7 @@
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
* Copyright (C) 2024,2026 Bryan Biedenkapp, N2PLL
*
*/
#include "Defines.h"
@ -48,6 +48,8 @@ bool g_hideMessages = false;
int g_inputDevice = -1;
int g_outputDevice = -1;
bool g_dumpSampleLevels = false;
uint8_t* g_gitHashBytes = nullptr;
#ifdef _WIN32
@ -116,6 +118,7 @@ void usage(const char* message, const char* arg)
"\n"
" -i input audio device\n"
" -o output audio device\n"
" -level dump sample levels\n"
#ifdef _WIN32
"\n"
" -winmm use WinMM audio on Windows\n"
@ -211,6 +214,9 @@ int checkArgs(int argc, char* argv[])
g_backends[2] = ma_backend_null;
}
#endif
else if (IS("-level")) {
g_dumpSampleLevels = true;
}
else if (IS("-v")) {
::fprintf(stdout, __PROG_NAME__ " %s (built %s)\r\n", __VER__, __BUILD__);
::fprintf(stdout, "Copyright (c) 2017-2026 Bryan Biedenkapp, N2PLL and DVMProject (https://github.com/dvmproject) Authors.\n");

@ -4,7 +4,7 @@
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
* Copyright (C) 2024,2026 Bryan Biedenkapp, N2PLL
*
*/
/**
@ -45,6 +45,9 @@ extern int g_inputDevice;
/** @brief Audio Output Device Index. */
extern int g_outputDevice;
/** @brief (Global) Flag indicating local audio sample levels should be dumped to the log. */
extern bool g_dumpSampleLevels;
extern uint8_t* g_gitHashBytes;
#ifdef _WIN32

@ -242,7 +242,6 @@ HostBridge::HostBridge(const std::string& confFile) :
m_rxStreamId(0U),
m_txStreamId(0U),
m_detectedSampleCnt(0U),
m_dumpSampleLevel(false),
m_trace(false),
m_debug(false),
m_rtsPttEnable(false),
@ -959,8 +958,6 @@ bool HostBridge::readParams()
m_preambleTone = (uint16_t)systemConf["preambleTone"].as<uint32_t>(2175);
m_preambleLength = (uint16_t)systemConf["preambleLength"].as<uint32_t>(200);
m_dumpSampleLevel = systemConf["dumpSampleLevel"].as<bool>(false);
m_grantDemand = systemConf["grantDemand"].as<bool>(false);
m_localAudio = systemConf["localAudio"].as<bool>(true);
@ -1000,7 +997,6 @@ bool HostBridge::readParams()
LogInfo(" Generate Preamble Tone: %s", m_preambleLeaderTone ? "yes" : "no");
LogInfo(" Preamble Tone: %uhz", m_preambleTone);
LogInfo(" Preamble Tone Length: %ums", m_preambleLength);
LogInfo(" Dump Sample Levels: %s", m_dumpSampleLevel ? "yes" : "no");
LogInfo(" Grant Demands: %s", m_grantDemand ? "yes" : "no");
LogInfo(" Local Audio: %s", m_localAudio ? "yes" : "no");
LogInfo(" UDP Audio: %s", m_udpAudio ? "yes" : "no");
@ -3055,12 +3051,12 @@ void* HostBridge::threadAudioProcess(void* arg)
}
maxSample = maxSample / 1000;
if (bridge->m_dumpSampleLevel && bridge->m_detectedSampleCnt > 50U) {
if (g_dumpSampleLevels && bridge->m_detectedSampleCnt > 50U) {
bridge->m_detectedSampleCnt = 0U;
::LogInfoEx(LOG_HOST, "Detected Sample Level: %.2f", maxSample * 1000);
}
if (bridge->m_dumpSampleLevel) {
if (g_dumpSampleLevels) {
bridge->m_detectedSampleCnt++;
}

@ -249,7 +249,6 @@ private:
uint32_t m_txStreamId;
uint8_t m_detectedSampleCnt;
bool m_dumpSampleLevel;
static bool s_running;
bool m_trace;

Loading…
Cancel
Save

Powered by TurnKey Linux.