MCPcopy Create free account
hub / github.com/aethersdr/AetherSDR / controllerValueToAgcThreshold

Function controllerValueToAgcThreshold

src/gui/MainWindow_Controllers.cpp:87–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87int controllerValueToAgcThreshold(const SliceModel* slice, float value)
88{
89 const float clamped = std::clamp(value, 0.0f, 100.0f);
90 if (!usesExternalReceiveControls(slice)) {
91 return static_cast<int>(std::lround(clamped));
92 }
93 constexpr float kUiSpan = 100.0f;
94 const float agcSpan =
95 static_cast<float>(KiwiSdrProtocol::kAgcThresholdMaxDb
96 - KiwiSdrProtocol::kAgcThresholdMinDb);
97 return KiwiSdrProtocol::kAgcThresholdMinDb
98 + static_cast<int>(std::lround(clamped * agcSpan / kUiSpan));
99}
100
101float agcThresholdToControllerValue(const SliceModel* slice)
102{

Callers 1

registerMidiParamsMethod · 0.85

Calls 1

Tested by

no test coverage detected