// PostChainOutput.swift // Lyrebird // // Copyright (c) 2026 Joshua Parmenter / realizedsound // SPDX-License-Identifier: MIT import LyrebirdSynth /// Internal synthesizer that copies the post-board chain's stereo tail onto the hardware output /// buses — the final node of the ``PostChain``. /// /// The board masters write the shared mix bus, the post-chain's pedals process it, and this node /// copies the processed tail (left / right) to the hardware outputs. It carries no gain: the /// rig-wide volume / mute live on the board masters, upstream of the post-chain. /// /// - Note: Must be removed from the engine before the tail / hardware buses it reads are released. final class PostChainOutput: SynthesizerBase { private let leftInputBus: Int private let rightInputBus: Int private let leftOutputBus: Int private let rightOutputBus: Int /// Creates a stereo copy from the chain tail to the hardware outputs. /// /// - Parameters: /// - leftInputBus: Chain-tail left bus to read. /// - rightInputBus: Chain-tail right bus to read. /// - leftOutputBus: Hardware output for the left channel (default `0`). /// - rightOutputBus: Hardware output for the right channel (default `1`). init(leftInputBus: Int, rightInputBus: Int, leftOutputBus: Int = 0, rightOutputBus: Int = 1) { self.leftInputBus = leftInputBus self.rightInputBus = rightInputBus self.leftOutputBus = leftOutputBus self.rightOutputBus = rightOutputBus super.init() } override func build() { output(bus: leftOutputBus, source: input(bus: leftInputBus)) output(bus: rightOutputBus, source: input(bus: rightInputBus)) } }