38 lines
1.4 KiB
Swift
38 lines
1.4 KiB
Swift
// LyrebirdAUBusSpec.swift
|
|
// Lyrebird
|
|
//
|
|
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
import Foundation
|
|
|
|
/// Declarative bus spec used by ``LyrebirdAudioUnit/lyrebirdOutputBusses`` and
|
|
/// ``LyrebirdAudioUnit/lyrebirdInputBusses`` to describe an audio bus the
|
|
/// AU exposes to the host.
|
|
///
|
|
/// Subclasses override the class hooks to return an array of these specs;
|
|
/// the AU base class constructs one `AUAudioUnitBus` per entry, allocates
|
|
/// engine channels = `Σ channelCount` across output/input specs, and
|
|
/// maintains a per-bus engine-channel-offset map so `AUv3Driver.render`
|
|
/// can route the right channel slice to the right host bus.
|
|
///
|
|
/// - Parameters:
|
|
/// - name: Human-readable bus name. Hosts show this in their I/O
|
|
/// routing UI (e.g. "Main Out", "Aux Send", "Sidechain In").
|
|
/// - channelCount: Number of audio channels on this bus. Must be ≥ 1.
|
|
public struct LyrebirdAUBusSpec: Sendable {
|
|
|
|
public let name: String
|
|
public let channelCount: Int
|
|
|
|
/// - Parameters:
|
|
/// - name: Human-readable bus name.
|
|
/// - channelCount: Number of audio channels on this bus.
|
|
public init(name: String, channelCount: Int) {
|
|
precondition(channelCount >= 1,
|
|
"LyrebirdAUBusSpec: channelCount must be >= 1")
|
|
self.name = name
|
|
self.channelCount = channelCount
|
|
}
|
|
}
|