Contents

installAudioTap(onBus:bufferSize:format:tapProvider:)

Install a tap on a bus using a sendable block

Declaration

func installAudioTap(onBus bus: AVAudioNodeBus, bufferSize: AVAudioFrameCount, format: AVAudioFormat?, tapProvider: @escaping  @Sendable (AVReadOnlyAudioPCMBuffer, AVAudioTime) -> Void) throws

Parameters

  • bus:

    The node output bus to which to attach the tap

  • bufferSize:

    The requested size of incoming buffers in sample frames. Supported range is [100, 400] ms.

  • format:

    If non-nil, attempts to apply this as the format of the specified output bus

  • tapProvider:

    A sendable closure to be called with read-only audio buffers

Discussion

This method installs a tap that receives read-only buffers safe for concurrent use. The tap block is sendable and can be safely called from any isolation domain.

Only one tap may be installed on any bus. Taps may be safely installed and removed while the engine is running.

See Also

Installing and Removing an Audio Tap