Instance Method

prepareAudio(_:)

Prepares an audio resource for playback.

Declaration

func prepareAudio(_ resource: AudioResource) -> AudioPlaybackController

Parameters

resource

The audio resource to prepare. You typically use the loadAsync(named:in:inputMode:loadingStrategy:loops:) method to get a resource from a file on disk, or the loadAsync(contentsOf:withName:inputMode:loadingStrategy:loops:) method to retrieve a resource from a URL.

Return Value

An AudioPlaybackController instance that you use to manage audio playback. Use the controller to set playback characteristics like volume and reverb, and then start or stop playback.

Discussion

If you want to start playback right away, use the playAudio(_:) method instead.

See Also

Playing Audio

func playAudio(AudioResource) -> AudioPlaybackController

Plays sound from an audio resource on this entity.

func stopAllAudio()

Stops audio playback.