1.0 release
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
// HardwareInputPassThrough.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import LyrebirdSynth
|
||||
|
||||
/// Internal synthesizer that copies one hardware input bus to a board head bus.
|
||||
///
|
||||
/// When `ShoeGaze` is configured with `.liveInput`, a `HardwareInputPassThrough` is
|
||||
/// added to the engine before the first pedal. It reads the hardware input bus at
|
||||
/// `inputBusIndex` and writes its samples to the board's head bus at `outputBusIndex`.
|
||||
/// This ensures the first pedal reads from a user-space bus that the board controls,
|
||||
/// rather than from the raw hardware input bus directly.
|
||||
///
|
||||
/// - Note: The synthesizer must be removed from the engine before the board's
|
||||
/// `teardown()` releases the head bus back to the allocator.
|
||||
final class HardwareInputPassThrough: SynthesizerBase {
|
||||
|
||||
// MARK: - Routing
|
||||
|
||||
/// Index of the hardware input bus to read from (typically `engine.numOutputChannels`).
|
||||
private let inputBusIndex: Int
|
||||
|
||||
/// Index of the board head bus to write to.
|
||||
private let outputBusIndex: Int
|
||||
|
||||
// MARK: - Init
|
||||
|
||||
/// Creates a pass-through that copies `inputBusIndex` to `outputBusIndex`.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - inputBusIndex: Hardware input bus index to read from.
|
||||
/// Typically `engine.numOutputChannels` for the first input channel.
|
||||
/// - outputBusIndex: Board head bus index to write to.
|
||||
init(inputBusIndex: Int, outputBusIndex: Int) {
|
||||
self.inputBusIndex = inputBusIndex
|
||||
self.outputBusIndex = outputBusIndex
|
||||
super.init()
|
||||
}
|
||||
|
||||
// MARK: - Build
|
||||
|
||||
override func build() {
|
||||
output(bus: outputBusIndex, source: input(bus: inputBusIndex))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user