ec72bd3a4c
Maintenance release, no framework API changes. Scratchpad: Kill All Sound (⌘K) rename, mode-switch desync fix, code-completion prefix filtering restored (⌃Space Show Completions). Demos: GUIDemo voices + CLI EventPattern BlipVoice moved into Synthesizers/, EventPattern demo split into makeLead/makeBass, GUIDemo doc drift fixed (conductor default). LyrebirdScratch gains a SwiftPM package so the workspace shows it like GUIDemo (.xcodeproj kept for distribution). Linux live-coding scratchpad documented.
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))
|
||
}
|
||
}
|