TVOAudioDeviceRenderer
Objective-C
@protocol TVOAudioDeviceRenderer <NSObject>
Swift
protocol TVOAudioDeviceRenderer : NSObjectProtocol
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.
-
@brief Provides the format to be used for rendering audio.
@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.Declaration
Objective-C
- (nullable TVOAudioFormat *)renderFormat;Swift
func renderFormat() -> TVOAudioFormat?Return Value
A
TVOAudioFormatinstance which describes the audio which will be rendered. Returningnilindicates that audio rendering is not supported. -
@brief Initializes the renderer.
@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.Declaration
Objective-C
- (BOOL)initializeRenderer;Swift
func initializeRenderer() -> BoolReturn Value
YESif initialization succeeded, orNOif it did not. -
@brief Starts the renderer.
@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.Declaration
Objective-C
- (BOOL)startRendering:(nonnull TVOAudioDeviceContext)context;Swift
func startRendering(_ context: TVOAudioDeviceContext) -> BoolParameters
contextA context pointer to be used with the audio renderer function callbacks TVOAudioDeviceReinitialize(), TVOAudioDeviceReadRenderData() and TVOAudioDeviceExecuteWorkerBlock().
Return Value
YESif rendering started, orNOif it did not. -
@brief Stops the renderer.
@discussion This method is called some time after
startRenderingwhen audio rendering is no longer needed by the media engine. Before your implementation returns it should have stopped your audio rendering pipeline.Declaration
Objective-C
- (BOOL)stopRendering;Swift
func stopRendering() -> BoolReturn Value
YESif rendering stopped, orNOif it did not.