@game-vir/audio - v15.1.1
    Preparing search index...

    Function setupEffects

    • Allows creating an array of AudioNode instances ("effects") by passing the given AudioContext to createEffects. The effects created by createEffects, if any, are then sequentially connected to each other and finally to the originalOutputNode. If effects are created, the first one is returned as outputNode so all future playback can be routed through all the effects. If no effects were created, originalOutputNode is returned as outputNode.

      Some possible connection chains:

      • 3 effects created: effects[0] (outputNode) -> effects[1] -> effects[2] -> originalOutputNode
      • 1 effect created: effects[0] (outputNode) -> originalOutputNode
      • No effects created: originalOutputNode (outputNode)

      Parameters

      • audioContext: Readonly<BaseAudioContext>
      • originalOutputNode: Readonly<AudioNode>
      • createEffects:
            | undefined
            | (
                (
                    audioContext: BaseAudioContext,
                ) => undefined | void | readonly AudioNode[]
            )

      Returns { outputNode: AudioNode }

      • outputNode: AudioNode

        The node that all future playback should be connected to.