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:
@@ -171,6 +171,16 @@ engine.stop() // calls driver.stop(), sets isRunning = false
|
||||
|
||||
Bus memory (`audioBuses`, `controlBuses`) is allocated in `start()` and is empty before start. After `stop()`, the existing bus arrays remain in memory but are not updated further.
|
||||
|
||||
### `stop()` node-tree teardown contract
|
||||
|
||||
`stop()` does more than halt the driver: after `driver.stop()` returns (the RT thread is no longer running), it tears down every non-persistent node in the tree **and unbinds every non-persistent synth it was hosting**:
|
||||
|
||||
- `rootGroup` and `mainGroup` are persistent — they survive `stop()` intact and are never unbound (they are not `SynthesizerBase` instances to begin with; only `mainGroup`'s `PreparedNode` remains as `rootGroup`'s sole child).
|
||||
- Every other node — direct children of `mainGroup`, pre/post-main nodes installed via `.before(mainGroup)` / `.after(mainGroup)`, and every synth nested inside a drained `Group` subtree — is unlinked from the tree and, if it is a `SynthesizerBase`, has `_unbind(from:)` called on it. `synthesizerCount` / `groupCount` reset to zero.
|
||||
- `ParallelGroup` children are not individually unbound — they were never individually bound in the first place (added via `ParallelGroup.add(_:)`, not `engine.add(_:)`), so only the enclosing `ParallelGroup` node itself is drained.
|
||||
|
||||
The practical effect: **a synth instance that was active when `stop()` was called can be `add`ed again immediately** — to the same engine or a different one — with no `EngineAddError.doubleAdd` / `.boundToOtherEngine` and no need to wait for a `processBlock` first. This is a stronger guarantee than `remove(_:)` (see [Ownership Binding](#ownership-binding-engineadd-throws) below), because `stop()` has already halted the RT thread before the unbind pass runs — there is no add-vs-evaluate race to protect against, unlike the `remove` → re-add path.
|
||||
|
||||
## Engine Identity
|
||||
|
||||
Every `SynthesisEngine` carries a process-unique `identifier: UUID`, assigned at `init` and immutable for the engine's lifetime. The identifier surfaces in:
|
||||
@@ -200,6 +210,8 @@ All four throw `EngineAddError`:
|
||||
|
||||
Internally, every add path calls `synth._bind(to: self)` before any RT-visible side effect. `_bind` is a single-shot acquire-release `compareExchange` on `SynthesizerBase._engineBinding: Atomic<UInt>` storing the raw bit pattern of an `UnsafeMutableRawPointer` to the bound engine. Zero RT cost — the binding atomic is read only on the main thread during add. `remove(_:)` synchronously calls `_unbind` on successful enqueue so a subsequent re-add (after one `processBlock`) does not collide with `.doubleAdd`.
|
||||
|
||||
`engine.stop()` also releases this binding for every non-persistent synth it was hosting — see [`stop()` node-tree teardown contract](#stop-node-tree-teardown-contract) above. Unlike `remove(_:)`, a stop-then-re-add needs no intervening `processBlock`: the RT thread is already halted by the time `stop()`'s unbind pass runs.
|
||||
|
||||
`Group` instances are not bound — they are persistent node-tree fixtures and do not subclass `SynthesizerBase`.
|
||||
|
||||
`LyrebirdBuffer` has an opt-in two-tier binding API for cross-engine sharing — see [Multi-Core Audio § Multiple Engines](multi-core.md) and the `EngineHost` doc.
|
||||
|
||||
Reference in New Issue
Block a user