Files
josh b6fdee8bfc Lyrebird 2.0.0 — Linux support
Consolidated release: the cross-platform Linux port (engine, generators, CLI,
REPL, NRT, portable DSP), live ALSA audio + ALSA MIDI + POSIX OSC + portable
WAV codec, the GTK4 GUI (LyrebirdUI on the SwiftOpenUI backend), and the Linux
live-coding scratchpad (LiveCompile). Apple platforms unchanged; all additive.
See RELEASES.md and LINUX_README.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-10 21:09:11 -07:00

64 lines
2.0 KiB
Swift

// ScopeAttachTests.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
#if os(macOS) || os(Linux)
import Testing
import LyrebirdSynth
@testable import LyrebirdLiveCompile
@MainActor
@Suite("LiveSession scope attach")
struct ScopeAttachTests {
private func makeEngine(outChannels: Int = 2) -> SynthesisEngine {
SynthesisEngine(
blockSize: 64,
controlBlockSize: 16,
sampleRate: 48_000,
numOutputChannels: outChannels,
numInputChannels: 0,
numAudioBuses: 16,
numControlBuses: 16,
eventQueueCapacity: lyrebirdDefaultEventQueueCapacity,
driver: OfflineDriver()
)
}
@Test func attachesStereoScopeByDefault() {
let engine: SynthesisEngine = makeEngine(outChannels: 2)
let session: LiveSession = LiveSession(engine: engine)
let scope: ScopeCapture? = session.scope
#expect(scope != nil)
#expect(scope?.buses == [0, 1])
// Installed on the engine so the RT thread writes to it.
#expect(engine.scopeTap === scope)
}
@Test func attachScopeFalseInstallsNothing() {
let engine: SynthesisEngine = makeEngine()
let session: LiveSession = LiveSession(engine: engine, attachScope: false)
#expect(session.scope == nil)
#expect(engine.scopeTap == nil)
}
@Test func monoEngineTapsOneBus() {
let engine: SynthesisEngine = makeEngine(outChannels: 1)
let session: LiveSession = LiveSession(engine: engine)
#expect(session.scope?.buses == [0])
}
@Test func reusesExistingTapRatherThanReplacing() {
let engine: SynthesisEngine = makeEngine()
let existing: ScopeCapture = ScopeCapture(buses: [0], bufferSize: 256)
engine.scopeTap = existing
let session: LiveSession = LiveSession(engine: engine) // attach on, but a tap exists
#expect(session.scope === existing)
#expect(engine.scopeTap === existing)
}
}
#endif