---
name: "ost_AudioDevice"
section: "3"
platform: "linux"
package: "libccaudio2-doc"
version: "1.0.0-2"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/ost_AudioDevice"
---

# ost\_AudioDevice(3)

## NAME

ost::AudioDevice -

## SYNOPSIS

`#include <audio2.h>`

Inherits **ost::AudioBase**.

### Public Member Functions

virtual **~AudioDevice** ()\
 virtual unsigned **putSamples** (**Linear** buffer, unsigned count)=0\
 *Copy linear samples to an audio device through its virtual.*  virtual unsigned **getSamples** (**Linear** buffer, unsigned count)=0\
 *Copy linear samples from an audio device through its virtual.*  virtual ssize\_t **putBuffer** (**Encoded** data, size\_t count)\
 *Copy audio encoded in the currently selected encoding for the audio device.*  virtual ssize\_t **getBuffer** (**Encoded** data, size\_t count)\
 *Record audio encoded in the currently selected encoding for the audio device.*  virtual bool **setEncoded** (**Info** &**info**)\
 *Use encoding source descriptor to select the audio encoding format the audio device should be using.*  virtual bool **setAudio** (**Rate** rate=rate8khz, bool stereo=false, **timeout\_t** framing=20)=0\
 *Set properties for audio device.*  virtual void **sync** (void)\
 *Synchronize timing for audio device to next audio frame.*  virtual void **flush** (void)=0\
 *Flush any pending buffered samples in audio device.*  unsigned **bufMono** (**Linear** buffer, unsigned count)\
 *Process linear mono audio and automatically convert to the encoding format the audio device is currently using.*  unsigned **bufStereo** (**Linear** buffer, unsigned count)\
 *Process linear stereo audio and automatically convert to the encoding format the audio device is currently using.*  **Info** \* **getInfo** (void)\
 *Get audio device source descriptor in effect for the device.*  bool **isEnabled** (void)\
 *Whether device is currently enabled.*

### Protected Attributes

bool **enabled**\

## Constructor & Destructor Documentation

### virtual ost::AudioDevice::~AudioDevice ()` [inline, virtual]`

## Member Function Documentation

### virtual unsigned ost::AudioDevice::putSamples (Linear buffer, unsigned count)` [pure virtual]`

Copy linear samples to an audio device through its virtual.

**Parameters:**

*buffer* to linear audio data to play. \
 *count* of audio samples to play.

**Returns:**

number of audio samples played.

### virtual unsigned ost::AudioDevice::getSamples (Linear buffer, unsigned count)` [pure virtual]`

Copy linear samples from an audio device through its virtual.

**Parameters:**

*buffer* for recording. \
 *count* of audio samples to record.

**Returns:**

number of audio samples recorded.

### virtual ssize\_t ost::AudioDevice::putBuffer (Encoded data, size\_t count)` [virtual]`

Copy audio encoded in the currently selected encoding for the audio device.

**Parameters:**

*data* pointer to encoded data to play. \
 *count* of encoded bytes to play.

**Returns:**

number of encoded bytes played.

Implements **ost::AudioBase**.

### virtual ssize\_t ost::AudioDevice::getBuffer (Encoded data, size\_t count)` [virtual]`

Record audio encoded in the currently selected encoding for the audio device.

**Parameters:**

*data* buffer for recording encoded audio. \
 *count* of encoded bytes to record.

**Returns:**

number of encoded bytes recorded.

Implements **ost::AudioBase**.

### virtual bool ost::AudioDevice::setEncoded (Info & info)` [inline, virtual]`

Use encoding source descriptor to select the audio encoding format the audio device should be using.

**Returns:**

false if encoding format specified is unsupported by device

**Parameters:**

*info* source description for device settings.

### virtual bool ost::AudioDevice::setAudio (Rate rate = `rate8khz`, bool stereo = `false`, timeout\_t framing = `20`)` [pure virtual]`

Set properties for audio device.

**Parameters:**

*rate* of audio samples device should operate at. \
 *stereo* flag. \
 *framing* timer for default i/o framing for device.

**Returns:**

false if settings not supported by device.

### virtual void ost::AudioDevice::sync (void)` [inline, virtual]`

Synchronize timing for audio device to next audio frame.

this is needed for audio devices which do not block i/o to assure one does not push too much data before the device can handle it.

### virtual void ost::AudioDevice::flush (void)` [pure virtual]`

Flush any pending buffered samples in audio device.

### unsigned ost::AudioDevice::bufMono (Linear buffer, unsigned count)

Process linear mono audio and automatically convert to the encoding format the audio device is currently using.

If needed, automatically convert from mono to stereo.

**Returns:**

number of samples played.

**Parameters:**

*buffer* to linear mono audio data to play. \
 *count* of linear mono audio samples to play.

### unsigned ost::AudioDevice::bufStereo (Linear buffer, unsigned count)

Process linear stereo audio and automatically convert to the encoding format the audio device is currently using.

If needed, automatically convert from stereo to mono.

**Returns:**

number of samples played.

**Parameters:**

*buffer* to linear stereo audio data to play. \
 *count* of linear stereo audio samples to play.

### Info\* ost::AudioDevice::getInfo (void)` [inline]`

Get audio device source descriptor in effect for the device.

**Returns:**

audio device descriptor.

### bool ost::AudioDevice::isEnabled (void)` [inline]`

Whether device is currently enabled.

If invalid audio settings are selected, it will be disabled until supported values are supplied.

**Returns:**

enable state.

**See also:**

**setAudio** setInfo

## Member Data Documentation

### bool ost::AudioDevice::enabled` [protected]`

## Author

Generated automatically by Doxygen for ccAudio from the source code.
