06bdcbbe92
- 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>
32 lines
1.0 KiB
Swift
32 lines
1.0 KiB
Swift
// SineToneUI.swift
|
||
// Lyrebird
|
||
//
|
||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||
// SPDX-License-Identifier: MIT
|
||
|
||
import LyrebirdSynth
|
||
|
||
/// A stereo sine tone whose frequency, amplitude, and pan are live-controllable
|
||
/// from the UI. The `@UIParam` slots are the same model both the SwiftUI (macOS)
|
||
/// and SwiftOpenUI (Linux) controls bind to — one synthesizer, two front ends.
|
||
public final class SineToneUI: SynthesizerBase {
|
||
|
||
/// Frequency in Hz. Slider range: 440–880 Hz.
|
||
@UIParam public var frequency: Double = 440.0
|
||
|
||
/// Output amplitude (linear gain). Knob range: 0–1.
|
||
@UIParam public var amplitude: Double = 0.25
|
||
|
||
/// Stereo pan position. Knob range: -1 (hard left) … 0 (center) … +1 (hard right).
|
||
@UIParam public var pan: Double = 0.0
|
||
|
||
public override init() {
|
||
super.init()
|
||
}
|
||
|
||
public override func build() {
|
||
let osc: OscSin.Audio = OscSin.Audio(freq: $frequency)
|
||
output(bus: 0, source: Pan2(input: osc * $amplitude, pan: $pan))
|
||
}
|
||
}
|