| 85 | } |
| 86 | |
| 87 | int 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 | |
| 101 | float agcThresholdToControllerValue(const SliceModel* slice) |
| 102 | { |
no test coverage detected