v2.4.0 release: event patterns + live event conductor

This commit is contained in:
2026-12-03 08:45:07 -08:00
parent a175c437de
commit 6da3615707
40 changed files with 4223 additions and 19 deletions
@@ -0,0 +1,62 @@
// ConductorDemoView.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
#if canImport(SwiftUI)
import SwiftUI
#endif
import LyrebirdSynth
import LyrebirdUI
/// Demonstrates ``EventConductor``: start the engine, then toggle a top and a bottom part on and
/// off. Each part loops forever while on and enters on the next beat of the conductor's clock, so
/// the two lock together however late they are pressed. Includes the CPU status strip and an
/// oscilloscope.
///
/// Written to the View-DSL subset shared by SwiftUI and SwiftOpenUI, so it runs on macOS and Linux.
/// Buttons use the `action:label:` form, which fires reliably on both backends.
public struct ConductorDemoView: View {
let scope: ScopeCapture
let engine: SynthesisEngine
@State private var controller: ConductorDemoController
public init(scope: ScopeCapture, engine: SynthesisEngine) {
self.scope = scope
self.engine = engine
_controller = State(wrappedValue: ConductorDemoController(engine: engine))
}
public var body: some View {
VStack {
Text("Lyrebird — Event Conductor")
.font(.headline)
Button {
controller.toggleEngine()
} label: {
Text(controller.engineRunning ? "Stop Engine" : "Start Engine")
}
Button {
controller.toggleTop()
} label: {
Text(controller.topOn ? "Top Part: ON (tap to stop)" : "Top Part: off (starts on next beat)")
}
.disabled(!controller.engineRunning)
Button {
controller.toggleBottom()
} label: {
Text(controller.bottomOn
? "Bottom Part: ON (tap to stop)"
: "Bottom Part: off (starts on next beat)")
}
.disabled(!controller.engineRunning)
LyrebirdStatusView(engine: engine)
LyrebirdScopeView(capture: scope)
.frame(height: 120)
}
.padding()
}
}