// MouseDemoSynth.swift // Lyrebird // // Copyright (c) 2026 Joshua Parmenter / realizedsound // SPDX-License-Identifier: MIT import LyrebirdSynth /// A sine tone driven entirely by the pointer via the `Mouse.*` control /// generators — no `@UIParam`s. Horizontal position sets frequency, vertical /// sets amplitude, so moving the pointer over the window sweeps the tone. Used /// by `LYREBIRD_DEMO=mouse` to validate the Linux `MouseTracker` pointer source. final class MouseDemoSynth: SynthesizerBase { /// Frequency sweep range (Hz), mapped from `Mouse.X` (0…1). private let freqBase: Double = 110.0 private let freqSpan: Double = 770.0 // → 110…880 Hz /// Amplitude ceiling, mapped from `Mouse.Y` (0…1). private let ampMax: Double = 0.3 override func build() { let freq: any ValidGeneratorInput = Mouse.X.Control() * freqSpan + freqBase let amp: any ValidGeneratorInput = Mouse.Y.Control() * ampMax let osc: OscSin.Audio = OscSin.Audio(freq: freq) output(bus: 0, source: Pan2(input: osc * amp)) } }