### Engine Connection Protocol Source: https://github.com/ryanfrancesconi/spfk-au-host/blob/main/README.md Provides an example implementation of the AudioEngineConnection protocol, which allows custom AVAudioEngine integration. ```swift // Implement AudioEngineConnection to provide your own AVAudioEngine struct MyEngine: AudioEngineConnection { let engine: AVAudioEngine func connectAndAttach( _ node1: AVAudioNode, to node2: AVAudioNode, format: AVAudioFormat?) async throws { engine.attach(node1) engine.attach(node2) engine.connect(node1, to: node2, format: format) } } ``` -------------------------------- ### Effects Chain Source: https://github.com/ryanfrancesconi/spfk-au-host/blob/main/README.md Demonstrates how to create an AudioUnitChain, update its IO, insert effects by AudioComponentDescription, and connect the chain. ```swift import SPFKAUHost // Create a chain with a delegate that provides engine connection let chain = AudioUnitChain(delegate: myEngine) try await chain.updateIO(input: playerNode, output: mixerNode) // Insert effects by AudioComponentDescription try await chain.insertAudioUnit(componentDescription: reverbDesc, at: 0) try await chain.insertAudioUnit(componentDescription: delayDesc, at: 1) try await chain.connect() ``` -------------------------------- ### Host Musical Context Source: https://github.com/ryanfrancesconi/spfk-au-host/blob/main/README.md Demonstrates how to set and update the musical context (tempo, time signature) for Audio Units. ```swift let hostState = HostAUState() hostState.musicalContext.currentTempo = 120 hostState.musicalContext.timeSignatureNumerator = 4 hostState.musicalContext.timeSignatureDenominator = 4 // Provide to Audio Units via their blocks await chainData.update(hostAUState: hostState) // Mutations are reflected live — no need to reassign blocks hostState.musicalContext.currentTempo = 140 ``` -------------------------------- ### Manufacturer Collection for Menus Source: https://github.com/ryanfrancesconi/spfk-au-host/blob/main/README.md Shows how to create and iterate through a collection of Audio Units grouped by manufacturer, useful for populating menus. ```swift let groups = AudioUnitManufacturerCollection.createGroup( from: availableComponents ) for manufacturer in groups { print(manufacturer.name) // "Apple", "FabFilter", etc. for component in manufacturer.components { print(" \(component.name)") // "AUDelay", "Pro-Q 3", etc. } } ``` -------------------------------- ### Bypass and Reorder Source: https://github.com/ryanfrancesconi/spfk-au-host/blob/main/README.md Shows how to bypass individual effects or the entire chain, and how to reorder effects within the chain. ```swift // Bypass a single effect try await chain.bypassEffect(at: 0, state: true, reconnect: true) // Bypass entire chain try await chain.bypassEffects(state: true) // Move effect from slot 0 to slot 2 try await chain.moveEffect(from: 0, to: 2) ``` -------------------------------- ### Component Cache Source: https://github.com/ryanfrancesconi/spfk-au-host/blob/main/README.md Illustrates the usage of AudioUnitCacheManager for loading, updating, and validating cached Audio Components. ```swift let cacheManager = AudioUnitCacheManager(cachesDirectory: cachesURL) cacheManager.update(delegate: self) cacheManager.update(cacheURL: nil) // uses default // Load cached components or create fresh cache try await cacheManager.load() if cacheManager.validationIsNeeded { try await cacheManager.createCache() } ``` -------------------------------- ### Architecture Diagram Source: https://github.com/ryanfrancesconi/spfk-au-host/blob/main/README.md A hierarchical breakdown of the SPFKAUHost project structure, detailing its components and their responsibilities. ```text SPFKAUHost |-- AudioUnitChain Actor-based effects chain manager | |-- AudioUnitChain+Connect Connection, bypass, move, remove operations | |-- AudioUnitChain+Insert Insert, load chain description, AU instantiation | |-- AudioUnitChain+Instantiate Out-of-process/in-process effect and instrument creation | |-- AudioUnitChainData Actor holding the effects slot array and state | |-- AudioUnitChainDelegate Protocol combining AudioEngineConnection + AudioUnitAvailability | |-- AudioUnitChainEvent Events: insert, remove, bypass, move, connection error | |-- AudioUnitDescription AVAudioUnit wrapper with independent bypass flag | |-- AudioUnitCacheManager Actor managing AU cache lifecycle | |-- +Cache XML cache read/write/parse/remove | |-- +Validation System component discovery and validation pipeline | |-- AudioUnitCacheEvent Events: caching started, updated, loaded, validating | |-- AudioUnitCacheObservation NotificationCenter observer for component changes | |-- ComponentCollection Filtered views: passed, failed, unavailable effects | |-- SystemComponentsResponse Validation results container | |-- Validation/ | |-- AudioUnitValidator Multi-strategy validator (API, async, external auval) | |-- ComponentValidationResult Per-component validation state and metadata | |-- Definitions | |-- AudioUnitManufacturerCollection Manufacturer-grouped component hierarchy | |-- AudioUnitPresets Factory and user preset loading and full state I/O | |-- AudioUnitStateNotifier Parameter change notification via AudioToolbox | |-- HostAUState Musical context + transport state block provider | |-- HostMusicalContext Tempo, time signature, beat position | |-- HostTransportState Transport flags, sample position, cycle boundaries | |-- S_AVAudioUnitComponent Sendable copy of AVAudioUnitComponent properties | |-- Protocols | |-- AudioEngineConnection Node attach/connect abstraction | |-- AudioEngineNode Input/output node, bypass, detach, format access | |-- AudioUnitAvailability Available components and manufacturer collections | |-- Tests |-- TestAudioUnitContent Mock delegate for unit testing without AVAudioEngine ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.