Files
Lyrebird/Sources/LyrebirdGraphDSL/DSLValue.swift
T

28 lines
1.1 KiB
Swift

// DSLValue.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
// The runtime value of a built DSL expression. Most expressions are a *signal*
// (a number or a generator graph, both `any ValidGeneratorInput`); a bare
// identifier resolves to a *resource* the host registered — currently a buffer.
// A generator init parameter pulls the shape it needs out of a `DSLValue` via
// `DSLArgument`.
import LyrebirdSynth
/// A value produced while building a DSL expression.
///
/// Not `Sendable` — it carries `any ValidGeneratorInput` / `LyrebirdBuffer`,
/// neither of which is. It flows through ``DSLBuiltin/make`` (a `@Sendable`
/// closure so the registry can be a `static let`), but only during synchronous,
/// single-thread graph construction: the generated closures capture nothing, so
/// no value actually crosses a concurrency boundary.
public enum DSLValue {
/// A number or generator graph.
case signal(any ValidGeneratorInput)
/// A host-registered buffer (from a bare identifier reference).
case buffer(LyrebirdBuffer)
}