Contents

prepare(completion:)

Enables a sound event to play and runs the argument code when the sound event plays back.

Declaration

func prepare(completion handler: (@Sendable (PHASESoundEvent.PrepareHandlerReason) -> Void)? = nil)
func prepare() async -> PHASESoundEvent.PrepareHandlerReason

Parameters

  • handler:

    Code the framework runs when sound event preparation completes. If you pass nil, no code runs when preparation completes.

Discussion

This function instructs the engine to prepare a sound event and returns immediately. When the preparation completes or fails, the framework runs completionHandler.

If you call start(completion:) before completionHandler runs, the framework queues the sound event to occur when preparation completes.

See Also

Preparing Playback