Add input gain stage to Compressor pedal
A pre-compression input gain knob (Input, dB, range [-12, +24], default 0) boosts/cuts the signal before it hits the compressor, so driving the input harder pushes more of the signal past the threshold. The dB value is converted to a linear multiplier via Exp(dB * ln(10)/20) and applied to the dry signal. Tests: knob list is [Input, Threshold, Ratio]; input gain changes the output. The preset recall test now finds the Threshold knob by label, not position. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -423,9 +423,12 @@ struct PresetTests {
|
||||
// Apply the captured state (lightweight recall — no graph rebuild).
|
||||
sg.applyState(captured)
|
||||
|
||||
// threshold is the first effectKnob; applyState calls knob.node.update(value)
|
||||
// which sets the UIParamNode. The UIParamNode.value should now reflect the restored value.
|
||||
let thresholdKnobValue: Double = compressor.knobs[0].node.value
|
||||
// applyState calls knob.node.update(value) on each knob; the Threshold knob's
|
||||
// UIParamNode.value should now reflect the restored value. Look up by label rather
|
||||
// than position so the test is robust to knob additions.
|
||||
let thresholdKnobValue: Double = try #require(
|
||||
compressor.knobs.first(where: { $0.label == "Threshold" })?.node.value
|
||||
)
|
||||
#expect(
|
||||
abs(thresholdKnobValue - knownThreshold) < 1e-9,
|
||||
"threshold knob should be \(knownThreshold) after applyState, got \(thresholdKnobValue)"
|
||||
|
||||
Reference in New Issue
Block a user