77 lines
2.2 KiB
Markdown
77 lines
2.2 KiB
Markdown
# ``LyrebirdUI``
|
|
|
|
Native macOS controls that bind directly to Lyrebird synthesizer parameters.
|
|
|
|
## Overview
|
|
|
|
`LyrebirdUI` provides SwiftUI controls that bind to `SynthesizerBase` parameters through
|
|
the `@UIParam` property wrapper. Changes flow to the RT audio thread via a lock-free
|
|
atomic store — no queues, no locks, no latency. The same path used by code is used by UI,
|
|
so any parameter controllable from code is automatically controllable from a GUI control.
|
|
|
|
```swift
|
|
import LyrebirdUI
|
|
|
|
class MySynth: SynthesizerBase {
|
|
@UIParam var frequency: LyrebirdFloat = 440.0
|
|
@UIParam var amplitude: LyrebirdFloat = 0.5
|
|
@UIParam var pan: LyrebirdFloat = 0.0
|
|
|
|
override func build() {
|
|
let osc = OscSin.Audio(freq: $frequency)
|
|
output(bus: 0, source: Pan2(input: osc * $amplitude, pan: $pan))
|
|
}
|
|
}
|
|
|
|
// Wire scope tap before start
|
|
let scope = ScopeCapture(buses: [0, 1])
|
|
engine.scopeTap = scope
|
|
try engine.start()
|
|
|
|
let window = LyrebirdWindow(title: "My Synth", width: 400, height: 360)
|
|
window.open {
|
|
VStack {
|
|
ParameterSlider("Frequency", node: synth.$frequency, range: 20...20000, taper: .exponential)
|
|
ParameterKnob("Amplitude", node: synth.$amplitude, range: 0...1)
|
|
ParameterKnob("Pan", node: synth.$pan, range: -1...1)
|
|
Divider()
|
|
LyrebirdStatusView(engine: engine)
|
|
LyrebirdScopeView(capture: scope).frame(height: 120)
|
|
}
|
|
.padding()
|
|
}
|
|
```
|
|
|
|
The core `Lyrebird` module has no UI dependency — `LyrebirdUI` is imported only by targets
|
|
that need GUI windows.
|
|
|
|
## Topics
|
|
|
|
### Parameter Binding
|
|
|
|
- <doc:GUISystem>
|
|
|
|
### Engine Monitoring
|
|
|
|
- ``LyrebirdStatusView``
|
|
- ``LyrebirdEngineStatusView``
|
|
- ``LyrebirdScopeView``
|
|
|
|
### Performance Control
|
|
|
|
- ``LyrebirdEventListView``
|
|
- ``LyrebirdProcessView``
|
|
- ``LyrebirdRunningProcessesView``
|
|
- ``LyrebirdEventListPerformanceView``
|
|
|
|
### Visualization
|
|
|
|
- ``LyrebirdEnvelopeView``
|
|
- ``LyrebirdScatterView``
|
|
|
|
### Live Coding
|
|
|
|
The live-coding scratchpad (``LyrebirdScratchView`` / ``LyrebirdScratchModel``) lives
|
|
in the separate `LyrebirdLiveCompileUI` module (sub-package `LiveCompile/`). See the
|
|
`LyrebirdLiveCompileUI` docc archive for the `LiveCoding` article.
|