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

Function testAboveThresholdPassthrough

tests/client_gate_test.cpp:116–144  ·  view source on GitHub ↗

Signal well above threshold → unity gain (no attenuation).

Source from the content-addressed store, hash-verified

114
115// Signal well above threshold → unity gain (no attenuation).
116void testAboveThresholdPassthrough()
117{
118 ClientGate gate;
119 gate.prepare(kSampleRate);
120 gate.setEnabled(true);
121 gate.setThresholdDb(-40.0f);
122 gate.setRatio(10.0f);
123 gate.setAttackMs(0.5f);
124 gate.setReleaseMs(50.0f);
125 gate.setHoldMs(0.0f);
126 gate.setFloorDb(-40.0f);
127
128 // Prime envelope with a long burst at -6 dBFS.
129 const float ampIn = dbToLin(-6.0f);
130 auto buf = makeTone(1000.0, 4800, ampIn); // 200 ms
131 processBlocks(gate, buf.data(), 4800);
132
133 // Now measure the trailing block — envelope is fully settled.
134 const int tailFrames = 512;
135 auto tail = makeTone(1000.0, tailFrames, ampIn);
136 processBlocks(gate, tail.data(), tailFrames);
137
138 const float outPeak = peakAbsStereo(tail.data(), tailFrames);
139 const float grDb = linToDb(outPeak / ampIn);
140
141 report("above-threshold: unity gain (no reduction)",
142 std::fabs(grDb) < 0.5f,
143 "GR=" + std::to_string(grDb) + " dB");
144}
145
146// Signal below threshold, soft expander (ratio 2:1, floor -15 dB):
147// expected reduction = min(floor, (T - env) * (ratio - 1))

Callers 1

mainFunction · 0.85

Calls 15

setHoldMsMethod · 0.80
setFloorDbMethod · 0.80
dbToLinFunction · 0.70
makeToneFunction · 0.70
processBlocksFunction · 0.70
peakAbsStereoFunction · 0.70
linToDbFunction · 0.70
reportFunction · 0.70
prepareMethod · 0.45
setEnabledMethod · 0.45
setThresholdDbMethod · 0.45
setRatioMethod · 0.45

Tested by

no test coverage detected