v2.1.1 release: delay-click fix + internal consolidation

Mirror of Lyrebird dev HEAD (9f791c7c) minus maintainer-only paths. Patch release:
fixes the allpass fractional-delay click (DelayLine/CombFilter/AllpassFilter/
DelayLineFeedback under a modulated delay) and lands the internal code-quality
consolidation pass (~160 deduped sites + shared base classes/helpers, bit-identical
output). No public API removed or changed. See RELEASES.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-10-07 21:20:49 -07:00
parent 844dc4d9cd
commit f8878324fd
212 changed files with 1386 additions and 2549 deletions
+50
View File
@@ -243,4 +243,54 @@ struct MulAddSpecChannelAwareTests {
// 4-row generator as `mul:` to a 2-channel `Pan2` traps with "MulAddSpec: mul has
// 4 channels but output has 2. mul/add must be mono (broadcast) or match the
// output channel count."
// MARK: - applyScalar (Math.Control scalar fold)
@Test func applyScalarIdentityReturnsTargetUnchanged() {
let spec: MulAddSpec = MulAddSpec(mul: 1.0, add: 0.0)
#expect(spec.isIdentity)
#expect(spec.applyScalar(0.42, graph: graph) == 0.42)
}
@Test func applyScalarFoldsScalarMulAdd() {
let spec: MulAddSpec = MulAddSpec(mul: 2.0, add: 1.0)
#expect(!spec.isIdentity)
// 3.0 × 2.0 + 1.0 = 7.0
#expect(abs(spec.applyScalar(3.0, graph: graph) - 7.0) < 1e-12)
}
@Test func applyScalarReadsGeneratorValuedMulAdd() {
let spec: MulAddSpec = MulAddSpec(mul: ConstantAudioGen(2.0), add: ConstantAudioGen(1.0))
#expect(!spec.isIdentity)
#expect(abs(spec.applyScalar(3.0, graph: graph) - 7.0) < 1e-12)
}
// MARK: - fillHeldResult (held-constant Control fill)
@Test func fillHeldResultFillsConstantAndSetsPrevious() {
var result: [[Double]] = [[Double](repeating: 0.0, count: 8)]
var prev: Double = -1.0
fillHeldResult(into: &result, value: 0.5, previousOutputValue: &prev,
mulAdd: .identity, graph: graph, count: 8)
#expect(result[0].allSatisfy { $0 == 0.5 })
#expect(prev == 0.5)
}
@Test func fillHeldResultAppliesMulAdd() {
var result: [[Double]] = [[Double](repeating: 0.0, count: 4)]
var prev: Double = 0.0
let spec: MulAddSpec = MulAddSpec(mul: 2.0, add: 1.0) // 0.5 × 2 + 1 = 2.0
fillHeldResult(into: &result, value: 0.5, previousOutputValue: &prev,
mulAdd: spec, graph: graph, count: 4)
#expect(result[0].allSatisfy { abs($0 - 2.0) < 1e-12 })
#expect(abs(prev - 2.0) < 1e-12)
}
@Test func fillHeldResultCountZeroLeavesStateUntouched() {
var result: [[Double]] = [[Double](repeating: 9.0, count: 4)]
var prev: Double = 7.0
fillHeldResult(into: &result, value: 0.5, previousOutputValue: &prev,
mulAdd: .identity, graph: graph, count: 0)
#expect(prev == 7.0)
}
}