TVOAudioDeviceCapturer Protocol Reference

Conforms to NSObject
Declared in TVOAudioDevice.h

Overview

TVOAudioDeviceCapturer defines the capturing half of TVOAudioDevice. An audio capturer produces samples by repeatedly calling TVOAudioDeviceWriteCaptureData() when it needs to deliver new data. A capturer need not record audio from the device microphone, it could perform other operations such as reading audio samples from disk instead.

– captureFormat required method

Provides the format to be used for capturing audio.

- (nullable TVOAudioFormat *)captureFormat

Return Value

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

Discussion

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

Declared In

TVOAudioDevice.h

– initializeCapturer required method

Initializes the capturer.

- (BOOL)initializeCapturer

Return Value

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

Discussion

This method is called before startCapturing:. 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

– startCapturing: required method

Starts the capturer.

- (BOOL)startCapturing:(nonnull TVOAudioDeviceContext)context

Parameters

context

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

Return Value

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

Discussion

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

Declared In

TVOAudioDevice.h

– stopCapturing required method

Stops the capturer.

- (BOOL)stopCapturing

Return Value

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

Discussion

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

Declared In

TVOAudioDevice.h