v1.4.0 release: live-coding scratch editor, interpreted Graph DSL, ClosureSynthesizer + SampleLoop
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
// ScratchModelEngineTests.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#if os(macOS)
|
||||
import Testing
|
||||
import LyrebirdSynth
|
||||
@testable import LyrebirdLiveCompile
|
||||
@testable import LyrebirdLiveCompileUI
|
||||
|
||||
@Suite("LyrebirdScratchModel engine toggle")
|
||||
@MainActor
|
||||
struct ScratchModelEngineTests {
|
||||
|
||||
private func makeModel() -> LyrebirdScratchModel {
|
||||
let engine: SynthesisEngine = SynthesisEngine(
|
||||
blockSize: 64,
|
||||
controlBlockSize: 16,
|
||||
sampleRate: 48_000,
|
||||
numOutputChannels: 2,
|
||||
numInputChannels: 0,
|
||||
numAudioBuses: 16,
|
||||
numControlBuses: 16,
|
||||
eventQueueCapacity: lyrebirdDefaultEventQueueCapacity,
|
||||
driver: OfflineDriver()
|
||||
)
|
||||
return LyrebirdScratchModel(session: LiveSession(engine: engine))
|
||||
}
|
||||
|
||||
@Test func toggleStartsThenStopsEngine() throws {
|
||||
let model: LyrebirdScratchModel = makeModel()
|
||||
let engine: SynthesisEngine = model.session.engine
|
||||
#expect(engine.isRunning == false)
|
||||
|
||||
model.toggleEngine()
|
||||
#expect(engine.isRunning)
|
||||
#expect(model.statusMessage == "Engine started.")
|
||||
|
||||
model.toggleEngine()
|
||||
#expect(engine.isRunning == false)
|
||||
#expect(model.statusMessage == "Engine stopped.")
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user