playAudio(configuration:_:)
Prepares and plays a real-time audio playback instance.
Declaration
@MainActor @preconcurrency func playAudio(configuration: AudioGeneratorConfiguration = .init(), _ generatorRenderHandler: @escaping Audio.GeneratorRenderHandler) throws -> AudioGeneratorControllerParameters
- configuration:
A set of configuration parameters necessary for initializing and rendering the
generatorRenderHandler. - generatorRenderHandler:
The audio render handler to play. The system runs this handler to generate real-time audio.
Return Value
An AudioGeneratorController instance that you use to manage audio playback. Use the controller to set the volume and start or stop playback.
Discussion
Maintain playback by keeping a reference to the generator controller.