v1.3.0 release: graceful-release fix, quickstart template + demo, documentation accuracy pass
- Fixed: SynthesizerBase subclasses' release/free now dispatch correctly (gated synths were hard-freed instead of released). - New: quickstart project template + LyrebirdQuickstartDemo. - Docs: every example typechecked or provably illustrative (426->542); ~20 wrong-API examples fixed; root docs brought under the compile guard. - Fixed: NRT/Score demo Package.swift build from terminal again. See RELEASES.md for details.
This commit is contained in:
@@ -745,4 +745,54 @@ struct LyrebirdTaskDemoIdiomTests {
|
||||
#expect(elapsed < 0.1,
|
||||
"waitUntilComplete must return immediately on terminal state; took \(elapsed)s")
|
||||
}
|
||||
|
||||
/// `ctx.set(_:to:)` writes a live-parameter node from the routine body (its own thread) with no
|
||||
/// main-thread dispatch — the value is readable immediately after via the node's atomic.
|
||||
@Test func ctxSetWritesLiveParameter() {
|
||||
let engine: SynthesisEngine = makeEngine()
|
||||
let param: ParameterNode = ParameterNode(1.0) // Sendable — captured in the @Sendable body
|
||||
let done: DispatchSemaphore = DispatchSemaphore(value: 0)
|
||||
|
||||
let routine: LyrebirdRoutine = LyrebirdRoutine { ctx in
|
||||
ctx.set(param, to: 7.5)
|
||||
done.signal()
|
||||
}
|
||||
routine.start(engine: engine)
|
||||
_ = done.wait(timeout: .now() + 2)
|
||||
|
||||
#expect(abs(param.value - 7.5) < 1e-9,
|
||||
"ctx.set must store the value in the parameter node's atomic")
|
||||
}
|
||||
|
||||
/// `ctx.ramp(_:to:seconds:)` blocks for the duration and lands exactly on the target.
|
||||
@Test func ctxRampLandsOnTarget() {
|
||||
let engine: SynthesisEngine = makeEngine()
|
||||
let param: ParameterNode = ParameterNode(1.0)
|
||||
let done: DispatchSemaphore = DispatchSemaphore(value: 0)
|
||||
|
||||
let routine: LyrebirdRoutine = LyrebirdRoutine { ctx in
|
||||
try? ctx.ramp(param, to: 5.0, seconds: 0.05)
|
||||
done.signal()
|
||||
}
|
||||
routine.start(engine: engine)
|
||||
_ = done.wait(timeout: .now() + 2)
|
||||
|
||||
#expect(abs(param.value - 5.0) < 1e-9, "ramp must finish exactly on the target value")
|
||||
}
|
||||
|
||||
/// A non-positive duration jumps straight to the target (no stepping).
|
||||
@Test func ctxRampZeroDurationJumps() {
|
||||
let engine: SynthesisEngine = makeEngine()
|
||||
let param: ParameterNode = ParameterNode(2.0)
|
||||
let done: DispatchSemaphore = DispatchSemaphore(value: 0)
|
||||
|
||||
let routine: LyrebirdRoutine = LyrebirdRoutine { ctx in
|
||||
try? ctx.ramp(param, to: 9.0, seconds: 0.0)
|
||||
done.signal()
|
||||
}
|
||||
routine.start(engine: engine)
|
||||
_ = done.wait(timeout: .now() + 2)
|
||||
|
||||
#expect(abs(param.value - 9.0) < 1e-9)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user