32 lines
913 B
Swift
32 lines
913 B
Swift
// ScratchEvalMode.swift
|
|
// Lyrebird
|
|
//
|
|
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
// LyrebirdUI/LiveCompile
|
|
//
|
|
// Which evaluator the scratch editor runs the buffer through.
|
|
|
|
#if os(macOS)
|
|
|
|
/// The evaluation path for a `LyrebirdScratchModel`'s buffer.
|
|
public enum ScratchEvalMode: String, CaseIterable, Sendable {
|
|
/// Full Swift snippet compiled with swiftc into a dylib and run — the whole
|
|
/// language, `SynthesizerBase` subclasses, arbitrary code. Costs a compile.
|
|
case swift
|
|
/// Interpreted graph-DSL — instant, no swiftc, but only generator-graph
|
|
/// expressions (`OscSin.Audio(freq: 440) * 0.1`, `bass = …`).
|
|
case graphDSL
|
|
|
|
/// Human-readable label for a mode toggle.
|
|
public var title: String {
|
|
switch self {
|
|
case .swift: return "Swift"
|
|
case .graphDSL: return "Graph DSL"
|
|
}
|
|
}
|
|
}
|
|
|
|
#endif
|