TVIAudioDeviceCapturer Protocol Reference

Conforms to NSObject
Declared in TVIAudioDevice.h

Overview

TVIAudioDeviceCapturer defines the capturing half of TVIAudioDevice. An audio capturer produces samples by repeatedly calling TVIAudioDeviceWriteCaptureData() 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 TVIAudioFormat *)captureFormat

Return Value

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

Declared In

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

TVIAudioDevice.h

– startCapturing: required method

Starts the capturer.

- (BOOL)startCapturing:(nonnull TVIAudioDeviceContext)context

Parameters

context

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

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

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

TVIAudioDevice.h