Files
Lyrebird/Sources/Lyrebird/Process/LyrebirdProcessFactory.swift
T
2026-06-01 18:27:40 -07:00

24 lines
930 B
Swift

// LyrebirdProcessFactory.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
/// A type that produces `LyrebirdProcess` instances on demand.
///
/// Conformers encapsulate the configuration needed to build a process
/// (id, envelope, channels, body closure, etc.) and defer construction
/// to call sites that need a fresh instance — for example, polyphonic
/// triggering or event-list scheduling.
///
/// Factories are `Sendable` so they can be stored in collections passed
/// across actor boundaries; the `LyrebirdProcess` body runs as
/// `@Sendable async`.
public protocol LyrebirdProcessFactory: Sendable {
/// Build and return a new `LyrebirdProcess` instance.
///
/// Each call should return an independent process — callers may
/// invoke this repeatedly to spawn distinct concurrent processes.
func createProcess() -> LyrebirdProcess
}