# OTAudioDevice Protocol Reference

Conforms to | NSObject
Declared in | OTAudioKit.h

## Overview

Defines an audio device for use in a session. See [OTAudioDeviceManager setAudioDevice:].

## Setting the audio bus

### `– setAudioBus:` required method

Sets the OTAudioBus instance that this audio device uses.

`- (BOOL)setAudioBus:(_Nullable id<OTAudioBus>)audioBus`

#### Parameters

`audioBus` | An OTAudioBus implementation.

#### Return Value

BOOL YES if successful; NO otherwise.

#### Discussion

OTAudioDevice implementors use this bus to send and receive audio samples to and from a session. The implementor should retain this instance for the lifetime of the implementing object.

#### Declared In

`OTAudioKit.h`

## Adjusting the audio format

### `– captureFormat` required method

The capture format used by this device.

`- (nonnull OTAudioFormat *)captureFormat`

#### Declared In

`OTAudioKit.h`

### `– renderFormat` required method

The render format used by this device.

`- (nonnull OTAudioFormat *)renderFormat`

#### Declared In

`OTAudioKit.h`

## Rendering audio

### `– renderingIsAvailable` required method

Used to check if audio rendering is available on the audio device.

`- (BOOL)renderingIsAvailable`

#### Return Value

BOOL YES if rendering is available.

#### Declared In

`OTAudioKit.h`

### `– initializeRendering` required method

Requests the audio device to initialize itself for rendering. Call this method before attempting to start rendering.

`- (BOOL)initializeRendering`

#### Return Value

BOOL YES if rendering is initialized.

#### Declared In

`OTAudioKit.h`

### `– renderingIsInitialized` required method

Checks if audio rendering is initialized.

`- (BOOL)renderingIsInitialized`

#### Return Value

BOOL YES if audio rendering is initialized.

#### Declared In

`OTAudioKit.h`

### `– startRendering` required method

Requests that the device start rendering audio. After successful return from this function, audio samples become available on the audio bus.

`- (BOOL)startRendering`

#### Return Value

BOOL YES if rendering starts.

#### Declared In

`OTAudioKit.h`

### `– stopRendering` required method

Requests that the device stop rendering audio.

`- (BOOL)stopRendering`

#### Return Value

BOOL YES if rendering stops.

#### Declared In

`OTAudioKit.h`

### `– isRendering` required method

Checks if audio rendering has started.

`- (BOOL)isRendering`

#### Return Value

BOOL YES if rendering has started.

#### Declared In

`OTAudioKit.h`

### `– estimatedRenderDelay` required method

Returns the estimated rendering delay in ms. This is used to adjust audio signal processing and rendering.

`- (uint16_t)estimatedRenderDelay`

#### Return Value

uint16_t

#### Declared In

`OTAudioKit.h`

## Capturing audio

### `– captureIsAvailable` required method

Checks if audio sampling is available on the audio device.

`- (BOOL)captureIsAvailable`

#### Return Value

BOOL YES if audio sampling is available.

#### Declared In

`OTAudioKit.h`

### `– initializeCapture` required method

Requests the audio device to initialize itself for audio sampling. Call this method before attempting to start sampling.

`- (BOOL)initializeCapture`

#### Return Value

BOOL YES if audio sampling was initialized.

#### Declared In

`OTAudioKit.h`

### `– captureIsInitialized` required method

Checks if audio sampling is initialized.

`- (BOOL)captureIsInitialized`

#### Return Value

BOOL YES if sampling is initialized.

#### Declared In

`OTAudioKit.h`

### `– startCapture` required method

Requests that the device start capturing audio samples. After successful return from this function, the audio bus is ready to receive audio sample data.

`- (BOOL)startCapture`

#### Return Value

BOOL YES if audio capture starts.

#### Declared In

`OTAudioKit.h`

### `– stopCapture` required method

Requests that the device stop sampling audio.

`- (BOOL)stopCapture`

#### Return Value

BOOL YES if audio sampling stops.

#### Declared In

`OTAudioKit.h`

### `– isCapturing` required method

Checks if the device is caputuring audio samples.

`- (BOOL)isCapturing`

#### Return Value

BOOL YES if audio capture is initialized.

#### Declared In

`OTAudioKit.h`

### `– estimatedCaptureDelay` required method

Returns the estimated capturing delay in ms. This is used to adjust timing transmission information for encoded audio samples.

`- (uint16_t)estimatedCaptureDelay`

#### Return Value

uint16_t

#### Declared In

`OTAudioKit.h`