Files
josh 06bdcbbe92 v2.3.1 release: cross-platform LyrebirdGUIDemo + Linux demo ports + doc refresh
- New Demos/LyrebirdGUIDemo: one shared source (synths + node-based views) that
  bootstraps SwiftUI on macOS and GTK4/SwiftOpenUI on Linux; LYREBIRD_DEMO=vector|sine.
- The four CLI demos (Quickstart/Demo/NRT/Score) now build and run on Linux.
- README + Linux getting-started refreshed; LyrebirdATK row removed from the
  Extensions section pending collaborator sign-off.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-29 11:34:24 -08:00

61 lines
1.9 KiB
Swift

// SineToneDemoView.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
#if canImport(SwiftUI)
import SwiftUI
#endif
import LyrebirdSynth
import LyrebirdUI
/// Live controls for ``SineToneUI``: a frequency slider, amplitude and pan knobs,
/// a level readout, a CPU-load strip, an oscilloscope, and a static envelope plot.
///
/// Node-based for the same reason as ``VectorOscillatorDemoView`` — the body must
/// compile under both SwiftUI's `@MainActor` body and SwiftOpenUI's nonisolated one.
public struct SineToneDemoView: View {
let frequencyNode: UIParamNode
let amplitudeNode: UIParamNode
let panNode: UIParamNode
let scope: ScopeCapture
let engine: SynthesisEngine
let envelope: Envelope
public init(
frequencyNode: UIParamNode,
amplitudeNode: UIParamNode,
panNode: UIParamNode,
scope: ScopeCapture,
engine: SynthesisEngine,
envelope: Envelope
) {
self.frequencyNode = frequencyNode
self.amplitudeNode = amplitudeNode
self.panNode = panNode
self.scope = scope
self.engine = engine
self.envelope = envelope
}
public var body: some View {
VStack {
Text("Lyrebird — Sine Tone")
.font(.headline)
ParameterSlider("Frequency", node: frequencyNode, range: 440.0...880.0)
HStack {
ParameterKnob("Amplitude", node: amplitudeNode, range: 0.0...1.0)
ParameterKnob("Pan", node: panNode, range: -1.0...1.0)
ParameterLabel("Level", node: amplitudeNode, decimalPlaces: 2)
}
LyrebirdStatusView(engine: engine)
LyrebirdScopeView(capture: scope)
.frame(height: 120)
LyrebirdEnvelopeView(envelope)
}
.padding()
}
}