fixes for Swift 6 and threading concerns

This commit is contained in:
2026-06-02 12:09:44 -07:00
parent 2fa4bfd45e
commit 6d3a0930a1
327 changed files with 1596 additions and 199 deletions
@@ -26,7 +26,7 @@ private final class StemRenderSynth: SynthesizerBase {
}
private final class StemRenderAU: LyrebirdAudioUnit {
public override class func makeSynthesizer() -> SynthesizerBase { StemRenderSynth() }
public override class func makeSynthesizer() -> SynthesizerBase { MainActor.assumeIsolated { StemRenderSynth() } }
public override class var lyrebirdOutputBusses: [LyrebirdAUBusSpec] {
[
.init(name: "Main", channelCount: 2),
@@ -48,7 +48,7 @@ private final class SidechainPassthrough: SynthesizerBase {
}
private final class SidechainAU: LyrebirdAudioUnit {
public override class func makeSynthesizer() -> SynthesizerBase { SidechainPassthrough() }
public override class func makeSynthesizer() -> SynthesizerBase { MainActor.assumeIsolated { SidechainPassthrough() } }
public override class var lyrebirdOutputBusses: [LyrebirdAUBusSpec] {
[.init(name: "Output", channelCount: 2)]
}
@@ -67,7 +67,7 @@ private final class SingleBusSynth: SynthesizerBase {
}
private final class SingleBusAU: LyrebirdAudioUnit {
public override class func makeSynthesizer() -> SynthesizerBase { SingleBusSynth() }
public override class func makeSynthesizer() -> SynthesizerBase { MainActor.assumeIsolated { SingleBusSynth() } }
// No bus-spec overrides — must keep the default single-bus behaviour.
}
@@ -81,6 +81,7 @@ private func makeAUDesc(subtype: UInt32) -> AudioComponentDescription {
)
}
@MainActor
@Suite("LyrebirdAudioUnit multi-bus — defaults") struct LyrebirdAudioUnitMultiBusDefaultTests {
@Test func singleBusAUKeeps104aShape() throws {
@@ -97,6 +98,7 @@ private func makeAUDesc(subtype: UInt32) -> AudioComponentDescription {
}
}
@MainActor
@Suite("LyrebirdAudioUnit multi-bus — multi-output") struct LyrebirdAudioUnitMultiOutputBusTests {
@Test func twoOutputBussesAreExposed() throws {
@@ -120,6 +122,7 @@ private func makeAUDesc(subtype: UInt32) -> AudioComponentDescription {
}
@Test func asymmetricBusPullsDoNotCrash() throws {
defer { lyrebirdClearRTMarkAfterTestRender() }
// AU spec lets a host pull bus 0 repeatedly without pulling bus 1.
// Without the driver's saturation guard this would overflow bus 1's
// ring buffer after `capacity / blockSize` engine advances.
@@ -157,6 +160,7 @@ private func makeAUDesc(subtype: UInt32) -> AudioComponentDescription {
}
@Test func renderingRoutesEachBusIndependently() throws {
defer { lyrebirdClearRTMarkAfterTestRender() }
let au: StemRenderAU = try StemRenderAU(componentDescription: makeAUDesc(subtype: 0x534D4F44))
try au.allocateRenderResources()
defer { au.deallocateRenderResources() }
@@ -199,6 +203,7 @@ private func makeAUDesc(subtype: UInt32) -> AudioComponentDescription {
}
}
@MainActor
@Suite("LyrebirdAudioUnit multi-bus — sidechain input") struct LyrebirdAudioUnitSidechainTests {
@Test func twoInputBussesAreExposed() throws {
@@ -219,6 +224,7 @@ private func makeAUDesc(subtype: UInt32) -> AudioComponentDescription {
}
@Test func renderLoopDispatchesPerInputBusPullBlock() throws {
defer { lyrebirdClearRTMarkAfterTestRender() }
// Drive the full internalRenderBlock → driver → _fillInputStagingFromHost
// path with a synthetic pullInputBlock that fills bus 0 ABL with +1.0
// and bus 1 ABL with -1.0. Verify the AU passes bus 0 samples through