# OTAudioBus Protocol Reference

Conforms to | NSObject
Declared in | OTAudioKit.h

## Overview

The audio bus marshals audio data between the network and the audio device. Call the [OTAudioDevice setAudioBus:] method to define the object that implements the OTAudioBus protocol. The audio device pushes captured audio samples to and fetches unrendered audio samples from the audio bus.

The object that implements this protocol must invoke the [OTAudioBus writeCaptureData:numberOfSamples:] and [OTAudioBus readRenderData:numberOfSamples:] methods to provide audio capture and render sample buffers.

### `– writeCaptureData:numberOfSamples:` required method

Passes audio data to transmit to a session.

`- (void)writeCaptureData:(nonnull void *)data numberOfSamples:(uint32_t)count`

#### Parameters

`data` | A pointer to an audio buffer.
`count` | The number of samples available for copying.

#### Declared In

`OTAudioKit.h`

### `– readRenderData:numberOfSamples:` required method

Retrieves unrendered audio samples from the session. This is most commonly used to send audio to the speakers, but is also an entry point for further audio processing.

`- (uint32_t)readRenderData:(nonnull void *)data numberOfSamples:(uint32_t)count`

#### Parameters

`data` | A pointer to an audio buffer.
`count` | The number of samples requested.

#### Return Value

uint32_t The number of samples copied out of the audio buffer.

#### Declared In

`OTAudioKit.h`