TVOAudioDeviceRenderer Protocol Reference

Conforms to NSObject
Declared in TVOAudioDevice.h

Overview

TVOAudioDeviceRenderer defines the rendering half of TVOAudioDevice. An audio renderer consumes samples by repeatedly calling TVOAudioDeviceReadRenderData() when it needs new data. A renderer need not playback audio through the device loudspeaker, it could perform other operations such as writing audio samples to disk instead.

– renderFormat required method

Provides the format to be used for rendering audio.

- (nullable TVOAudioFormat *)renderFormat

Return Value

A TVOAudioFormat instance which describes the audio which will be rendered. Returning nil indicates that audio rendering is not supported.

Discussion

This method is called once before rendering starts. If you wish to change the format after you’ve started rendering audio then you should call TVOAudioDeviceReinitialize() and prepare for this method to be queried again.

Declared In

TVOAudioDevice.h

– initializeRenderer required method

Initializes the renderer.

- (BOOL)initializeRenderer

Return Value

YES if initialization succeeded, or NO if it did not.

Discussion

This method is called before startRendering:. You should use this opportunity to pre-allocate any fixed size buffers or other resources that you need for audio processing.

Declared In

TVOAudioDevice.h

– startRendering: required method

Starts the renderer.

- (BOOL)startRendering:(nonnull TVOAudioDeviceContext)context

Parameters

context

A context pointer to be used with the audio renderer function callbacks TVOAudioDeviceReinitialize(), TVOAudioDeviceReadRenderData() and TVOAudioDeviceExecuteWorkerBlock().

Return Value

YES if rendering started, or NO if it did not.

Discussion

This method is called after initializeRenderer. Before your implementation returns it should have started your audio rendering pipeline. This may involve spinning up audio threads via CoreAudio or starting your own high priority rendering thread.

Declared In

TVOAudioDevice.h

– stopRendering required method

Stops the renderer.

- (BOOL)stopRendering

Return Value

YES if rendering stopped, or NO if it did not.

Discussion

This method is called some time after startRendering when audio rendering is no longer needed by the media engine. Before your implementation returns it should have stopped your audio rendering pipeline.

Declared In

TVOAudioDevice.h