bugfixes, better MusicXML support and 1.1.0

This commit is contained in:
2026-06-10 08:41:07 -07:00
parent 6d3a0930a1
commit f59fd3b55a
228 changed files with 32271 additions and 2586 deletions
@@ -8,10 +8,10 @@ import Testing
import Foundation
@testable @_spi(LyrebirdExtensions) import LyrebirdSynth
/// Phase 196.6 — Multi-engine regression coverage.
/// Multi-engine regression coverage.
///
/// Validates the Phase 196 ownership-binding + lifecycle-coordinator
/// machinery against the two scenarios that motivated the phase:
/// Validates the ownership-binding + lifecycle-coordinator
/// machinery against the two scenarios that motivated it:
///
/// 1. **Two engines, two threads, disjoint Synth graphs** — drives both
/// engines for ≥ 1000 segments each in parallel. Acts as a
@@ -26,7 +26,7 @@ import Foundation
/// same-engine re-add without intervening `remove`, and accepts
/// re-add after `remove` clears the binding.
@MainActor
@Suite("Multi-engine regression (Phase 196.6)")
@Suite("Multi-engine regression")
struct MultiEngineRegressionTests {
// MARK: - Two-engine, two-thread driver
@@ -36,7 +36,7 @@ struct MultiEngineRegressionTests {
/// iterations. Joins both threads, stops both engines, and asserts
/// neither crashed nor produced obvious miscount.
///
/// `segmentCount = 1000` matches the Phase 196 plan exit criterion.
/// `segmentCount = 1000` matches the plan exit criterion.
/// Adjust upward for stress runs; downward to keep CI fast.
@Test func twoEnginesTwoThreadsDisjointGraphs() throws {
let segmentCount: Int = 1000
@@ -112,7 +112,7 @@ struct MultiEngineRegressionTests {
engineB.stop()
}
/// Phase 197.7 uniformity-contract regression — same two-engine
/// Uniformity-contract regression — same two-engine
/// two-thread workload as `twoEnginesTwoThreadsDisjointGraphs`, but
/// engines are constructed via `EngineHost.makeEngine` +
/// `host.startAll()` instead of direct-ctor. Verifies that the
@@ -272,7 +272,7 @@ struct MultiEngineRegressionTests {
// MARK: - LyrebirdBuffer read-only sharing
/// `bindReadOnly` allows the same buffer to be shared across multiple
/// engines concurrently. Phase 196.1 part-2 opt-in API.
/// engines concurrently. Opt-in API.
@Test func bufferReadOnlyShareAcrossEngines() throws {
let engineA: SynthesisEngine = makeTestEngine()
let engineB: SynthesisEngine = makeTestEngine()
@@ -296,7 +296,7 @@ struct MultiEngineRegressionTests {
buf.unbindReadOnly(from: engineB)
}
/// Phase 196 review fix #8: stale-pointer recovery in `_bind`.
/// Stale-pointer recovery in `_bind`.
///
/// If an engine deinits without unbinding a synth it owns, the raw
/// pointer in `_engineBinding` is dangling. The recovery path in
@@ -319,8 +319,7 @@ struct MultiEngineRegressionTests {
/// rather than stale-pointer recovery. Fixing this requires
/// replacing the raw-pointer-in-atomic with a coordinator-issued
/// monotonic UInt64 registration token (or stamping a generation
/// counter alongside the pointer). Tracked as a future improvement
/// — out of scope for Phase 196.
/// counter alongside the pointer). Tracked as a future improvement.
@Test func bindRecoversFromStaleEnginePointer() throws {
let synth: ConstantSynth = ConstantSynth(value: 0.1, outputBus: 0)
@@ -365,7 +364,7 @@ struct MultiEngineRegressionTests {
engineB.stop()
}
/// Phase 196 re-review fix: `unbindReadOnly` saturates at zero rather
/// `unbindReadOnly` saturates at zero rather
/// than wrapping to `Int.max` under unbalanced misuse. Without
/// saturation, an unbalanced unbind would permanently block any
/// subsequent `bindExclusive` because the refcount check in