Files
Lyrebird/Sources/LyrebirdUILinuxDemo/KnobDemoSynth.swift
T
josh b6fdee8bfc Lyrebird 2.0.0 — Linux support
Consolidated release: the cross-platform Linux port (engine, generators, CLI,
REPL, NRT, portable DSP), live ALSA audio + ALSA MIDI + POSIX OSC + portable
WAV codec, the GTK4 GUI (LyrebirdUI on the SwiftOpenUI backend), and the Linux
live-coding scratchpad (LiveCompile). Apple platforms unchanged; all additive.
See RELEASES.md and LINUX_README.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-10 21:09:11 -07:00

23 lines
776 B
Swift

// KnobDemoSynth.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
import LyrebirdSynth
/// A minimal sine-tone synthesizer whose frequency and amplitude are `@UIParam`
/// slots, so the Linux GTK4 knobs bind to the same RT-safe parameter model the
/// macOS SwiftUI controls use. Turning a knob updates the atomic the render
/// thread reads at the next block — audible immediately when a live ALSA device
/// is present.
final class KnobDemoSynth: SynthesizerBase {
@UIParam var frequency: Double = 220.0
@UIParam var amplitude: Double = 0.2
override func build() {
let osc: OscSin.Audio = OscSin.Audio(freq: $frequency)
output(bus: 0, source: Pan2(input: osc * $amplitude))
}
}