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>
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#if canImport(SwiftUI)
|
||||
import SwiftUI
|
||||
import LyrebirdSynth
|
||||
|
||||
@@ -59,3 +60,68 @@ public struct ParameterLabel: View {
|
||||
String(format: "%.\(decimalPlaces)f", node.value)
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
// Linux/GTK4 counterpart to `LyrebirdUI.ParameterLabel`: a read-only display of
|
||||
// a core `UIParamNode`'s current value, updated automatically via `@Observable`
|
||||
// (no polling). Uses only the core View DSL; no BackendGTK4 import.
|
||||
//
|
||||
// SwiftOpenUI is always present in this target (see Package.swift), so no
|
||||
// `canImport` guard is needed.
|
||||
import SwiftOpenUI
|
||||
import LyrebirdSynth
|
||||
import Foundation // String(format:) for the value readout
|
||||
|
||||
/// A read-only label for the Linux/GTK4 UI that shows a ``UIParamNode``'s
|
||||
/// current value. Mirrors `LyrebirdUI.ParameterLabel`: a leading descriptive
|
||||
/// label and a trailing monospaced value. Refreshes automatically because
|
||||
/// `UIParamNode` is `@Observable`.
|
||||
public struct ParameterLabel: View {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
private let label: String
|
||||
private let node: UIParamNode
|
||||
private let decimalPlaces: Int
|
||||
|
||||
// Layout constants (points), matching the macOS label.
|
||||
private let labelMinWidth: Double = 80
|
||||
private let valueMinWidth: Double = 60
|
||||
|
||||
// MARK: - Init
|
||||
|
||||
/// Creates a read-only parameter label.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - label: Descriptive text displayed before the value.
|
||||
/// - node: The `UIParamNode` to monitor (pass `synth.$paramName`).
|
||||
/// - decimalPlaces: Number of decimal places shown. Default 3.
|
||||
public init(
|
||||
_ label: String,
|
||||
node: UIParamNode,
|
||||
decimalPlaces: Int = 3
|
||||
) {
|
||||
self.label = label
|
||||
self.node = node
|
||||
self.decimalPlaces = decimalPlaces
|
||||
}
|
||||
|
||||
// MARK: - Body
|
||||
|
||||
public var body: some View {
|
||||
HStack {
|
||||
Text(label)
|
||||
.frame(minWidth: labelMinWidth, alignment: .leading)
|
||||
Text(formattedValue)
|
||||
.monospacedDigit()
|
||||
.frame(minWidth: valueMinWidth, alignment: .trailing)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Formatting
|
||||
|
||||
private var formattedValue: String {
|
||||
String(format: "%.\(decimalPlaces)f", node.value)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user