prep for 1.2.0 release updates
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
// PanNParameterRampingTests.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import Testing
|
||||
@testable @_spi(LyrebirdExtensions) import LyrebirdSynth
|
||||
|
||||
@MainActor
|
||||
@Suite("PanN parameter ramping")
|
||||
struct PanNParameterRampingTests {
|
||||
|
||||
@Test func generatorPositionRampIsApplied() throws {
|
||||
let engine: SynthesisEngine = makeTestEngine(blockSize: 64)
|
||||
try engine.start()
|
||||
defer { engine.stop() }
|
||||
|
||||
let lastSampleIdx: Int = engine.blockSize - 1
|
||||
|
||||
let posNode: ParameterNode = ParameterNode(0.0)
|
||||
let pan: PanN = PanN(input: ConstantGeneratorInput(1.0), channels: 4, position: posNode)
|
||||
|
||||
// Block 1: position = 0 (all energy on ch0).
|
||||
let g1: SynthGraph = makeSynthGraph(engine: engine)
|
||||
let out1: [[Double]] = pan.calculatedSamples(graph: g1, count: 64)
|
||||
#expect(abs(out1[0][0] - 1.0) < 1e-6, "Position=0: ch0 should be 1.0 at sample 0")
|
||||
advanceBlock(engine)
|
||||
|
||||
// Block 2: position ramps 0→1 (energy migrates toward ch1).
|
||||
posNode.value = 1.0
|
||||
let g2: SynthGraph = makeSynthGraph(engine: engine)
|
||||
let out2: [[Double]] = pan.calculatedSamples(graph: g2, count: 64)
|
||||
// Last sample: position=1 → full gain on ch1.
|
||||
#expect(abs(out2[1][lastSampleIdx] - 1.0) < 1e-5,
|
||||
"After position=1 ramp: ch1 last sample should be ~1.0")
|
||||
#expect(abs(out2[0][lastSampleIdx]) < 1e-5,
|
||||
"After position=1 ramp: ch0 last sample should be ~0.0")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user