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

Method curveOutputDb

src/gui/ClientCompCurveWidget.cpp:91–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91float ClientCompCurveWidget::curveOutputDb(float inDb) const
92{
93 if (!m_comp) return inDb;
94 const float T = m_comp->thresholdDb();
95 const float W = m_comp->kneeDb();
96 const float ratio = std::max(1.0f, m_comp->ratio());
97 const float slope = 1.0f - 1.0f / ratio; // 0 = unity, 1 = limit
98 const float over = inDb - T;
99
100 float gain;
101 if (W <= 0.0f) {
102 gain = (over > 0.0f) ? -over * slope : 0.0f;
103 } else if (over <= -0.5f * W) {
104 gain = 0.0f;
105 } else if (over >= 0.5f * W) {
106 gain = -over * slope;
107 } else {
108 const float x = over + 0.5f * W;
109 gain = -slope * (x * x) / (2.0f * W);
110 }
111 return inDb + gain + m_comp->makeupDb();
112}
113
114void ClientCompCurveWidget::paintEvent(QPaintEvent*)
115{

Callers

nothing calls this directly

Calls 4

kneeDbMethod · 0.80
makeupDbMethod · 0.80
thresholdDbMethod · 0.45
ratioMethod · 0.45

Tested by

no test coverage detected