1.0.0 release

This commit is contained in:
2026-06-01 18:27:40 -07:00
parent b1ab0f102c
commit 1f20fcab20
1151 changed files with 230703 additions and 14 deletions
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTD/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Kind</key>
<string>Xcode.IDEKit.TextSubstitutionFileTemplateKind</string>
<key>Platforms</key>
<array>
<string>com.apple.platform.macosx</string>
<string>com.apple.platform.iphoneos</string>
</array>
<key>Description</key>
<string>A SwiftUI View bound to a SynthesizerBase subclass with @UIParam slots. Uses ParameterKnob to drive frequency / amplitude / pan and embeds a LyrebirdScopeView showing the engine's output. Requires LyrebirdUI module.</string>
<key>Summary</key>
<string>Lyrebird UI View (SwiftUI w/ ParameterKnob + Scope)</string>
<key>SortOrder</key>
<string>23</string>
<key>AllowedTypes</key>
<array>
<string>public.swift-source</string>
</array>
<key>DefaultCompletionName</key>
<string>MySynthView</string>
<key>MainTemplateFile</key>
<string>___FILEBASENAME___.swift</string>
<key>Options</key>
<array>
<dict>
<key>Identifier</key>
<string>productName</string>
<key>Required</key>
<true/>
<key>Name</key>
<string>View name:</string>
<key>Description</key>
<string>Name of the SwiftUI View (also used as the file name).</string>
<key>Type</key>
<string>text</string>
<key>Default</key>
<string>MySynthView</string>
</dict>
</array>
</dict>
</plist>
@@ -0,0 +1,108 @@
//___FILEHEADER___
import SwiftUI
import LyrebirdSynth
import LyrebirdUI
// MARK: - ___FILEBASENAMEASIDENTIFIER___
/// SwiftUI view that drives a `SynthesizerBase` subclass with `@UIParam` slots
/// and visualises its output via `LyrebirdScopeView`.
///
/// Owns a controller object that:
/// 1. Holds the `SynthesisEngine` reference passed in.
/// 2. Holds the synth (replace `MyUISynth` with your `@UIParam`-annotated
/// synthesizer — see the `LyrebirdSynthesizer (UI)` file template).
/// 3. Wires `engine.scopeTap` to a `ScopeCapture` so the scope view
/// sees real audio.
///
/// ## Usage
/// ```swift
/// // In your App / scene root:
/// ___FILEBASENAMEASIDENTIFIER___(engine: engine)
/// ```
public struct ___FILEBASENAMEASIDENTIFIER___: View {
@State private var controller: Controller
public init(engine: SynthesisEngine) {
_controller = State(wrappedValue: Controller(engine: engine))
}
public var body: some View {
VStack(spacing: 20) {
HStack {
Text("___FILEBASENAMEASIDENTIFIER___").font(.headline)
Spacer()
Button(controller.isPlaying ? "Stop" : "Start") {
controller.toggle()
}
.buttonStyle(.bordered)
.tint(controller.isPlaying ? .red : .green)
}
ParameterSlider(
"Frequency",
node: controller.synth.$frequency,
range: 110...880
)
HStack(spacing: 24) {
ParameterKnob("Amplitude", node: controller.synth.$amplitude, range: 0...1)
ParameterKnob("Pan", node: controller.synth.$pan, range: -1...1)
}
Divider()
LyrebirdStatusView(engine: controller.engine)
Divider()
LyrebirdScopeView(capture: controller.scope)
.frame(height: 120)
}
.padding()
}
// MARK: - Controller
/// Owns the synth, scope capture, and play/stop state. Lives for the
/// lifetime of the view via `@State`.
@Observable
final class Controller {
let engine: SynthesisEngine
let synth: MyUISynth = MyUISynth()
let scope: ScopeCapture
var isPlaying: Bool = false
init(engine: SynthesisEngine) {
self.engine = engine
self.scope = ScopeCapture(buses: [0, 1], bufferSize: 2048)
engine.scopeTap = scope
}
func toggle() {
if isPlaying {
engine.remove(synth)
} else {
do { try engine.add(synth) } catch { print("[Lyrebird] engine.add failed: \(error)") }
}
isPlaying.toggle()
}
}
}
// MARK: - Placeholder synth (replace with your own)
/// Replace this with your own `@UIParam`-annotated SynthesizerBase subclass
/// (generated from the `LyrebirdSynthesizer (UI)` template). The Controller
/// above references it directly — keep the parameter names in sync, or rename
/// the slot bindings above to match your synth.
public final class MyUISynth: SynthesizerBase {
@UIParam public var frequency: Double = 440.0
@UIParam public var amplitude: Double = 0.25
@UIParam public var pan: Double = 0.0
public override func build() {
let osc = OscSin.Audio(freq: $frequency)
output(bus: 0, source: Pan2(input: osc * $amplitude, pan: $pan))
}
}