v1.4.0 release: live-coding scratch editor, interpreted Graph DSL, ClosureSynthesizer + SampleLoop
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
// DSLTestSupport.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import LyrebirdSynth
|
||||
import LyrebirdGraphDSL
|
||||
|
||||
/// Shared offline engine for DSL round-trip tests.
|
||||
@MainActor
|
||||
func makeDSLTestEngine() -> SynthesisEngine {
|
||||
SynthesisEngine(
|
||||
blockSize: 16,
|
||||
controlBlockSize: 16,
|
||||
sampleRate: 48_000,
|
||||
numOutputChannels: 2,
|
||||
numInputChannels: 0,
|
||||
numAudioBuses: 16,
|
||||
numControlBuses: 16,
|
||||
eventQueueCapacity: lyrebirdDefaultEventQueueCapacity,
|
||||
driver: OfflineDriver()
|
||||
)
|
||||
}
|
||||
|
||||
/// `true` when any sample in bus `bus` of `engine` is non-zero.
|
||||
@MainActor
|
||||
func busHasSignal(_ engine: SynthesisEngine, bus: Int) -> Bool {
|
||||
(0..<engine.blockSize).contains { engine.audioBuses[bus][$0] != 0.0 }
|
||||
}
|
||||
|
||||
/// Wrap a signal value as a `DSLValue` for direct `DSLBuiltin.make` calls.
|
||||
func sig(_ value: any ValidGeneratorInput) -> DSLValue { .signal(value) }
|
||||
Reference in New Issue
Block a user