v1.4.0 release: live-coding scratch editor, interpreted Graph DSL, ClosureSynthesizer + SampleLoop

This commit is contained in:
2026-07-20 10:02:49 -07:00
parent 560724d116
commit 38d2107f64
104 changed files with 14471 additions and 105 deletions
@@ -0,0 +1,34 @@
// DSLResourceResolver.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
// How the DSL resolves a bare identifier (`PlayBuffer(buffer: kick)`) to a host
// resource. The host implements this to register the buffers a snippet may name.
import LyrebirdSynth
/// Resolves DSL resource references (bare identifiers) to host objects.
public protocol DSLResourceResolver {
/// The buffer registered under `name`, or `nil` if there is none.
func buffer(named name: String) -> LyrebirdBuffer?
}
/// A resolver with no resources — every reference is unresolved. The default for
/// ``DSLInterpreter/evaluate(_:resources:)``.
public struct DSLEmptyResources: DSLResourceResolver {
public init() {}
public func buffer(named name: String) -> LyrebirdBuffer? { nil }
}
/// A resolver backed by a name→buffer dictionary — convenient for hosts and tests.
public struct DSLBufferTable: DSLResourceResolver {
private let buffers: [String: LyrebirdBuffer]
public init(_ buffers: [String: LyrebirdBuffer]) {
self.buffers = buffers
}
public func buffer(named name: String) -> LyrebirdBuffer? { buffers[name] }
}