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