Contents

instantiate(with:options:completionHandler:)

Asynchronously creates an audio unit instance.

Declaration

class func instantiate(with componentDescription: AudioComponentDescription, options: AudioComponentInstantiationOptions = [], completionHandler: @escaping  @Sendable (AUAudioUnit?, (any Error)?) -> Void)
class func instantiate(with componentDescription: AudioComponentDescription, options: AudioComponentInstantiationOptions = []) async throws -> AUAudioUnit

Parameters

  • componentDescription:

    The component to instantiate.

  • options:

    Options for loading the unit in-process or out-of-process.

  • completionHandler:

    The block called when instantiation has completed. The block parameters are defined as follows:

    audioUnit

    An initialized audio unit if the operation succeeded, or nil if it failed.

    error

    An error if the operation failed, or nil if it succeeded.

Discussion

Certain types of audio units must be instantiated asynchronously, such as version 3 units with a view.

See Also

Creating an Audio Unit