TVIAudioDeviceRenderer Protocol Reference

Conforms to NSObject
Declared in TVIAudioDevice.h

Overview

TVIAudioDeviceRenderer defines the rendering half of TVIAudioDevice. An audio renderer consumes samples by repeatedly calling TVIAudioDeviceReadRenderData() 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 TVIAudioFormat *)renderFormat

Return Value

A TVIAudioFormat 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 TVIAudioDeviceReinitialize() and prepare for this method to be queried again.

Declared In

TVIAudioDevice.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

TVIAudioDevice.h

– startRendering: required method

Starts the renderer.

- (BOOL)startRendering:(nonnull TVIAudioDeviceContext)context

Parameters

context

A context pointer to be used with the audio renderer function callbacks TVIAudioDeviceFormatChanged(), TVIAudioDeviceReinitialize(), TVIAudioDeviceReadRenderData() and TVIAudioDeviceExecuteWorkerBlock().

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

TVIAudioDevice.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

TVIAudioDevice.h