Oboe 1.5 A library for creating real-time audio apps on Android

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
oboe::AudioStreamBase Class Reference

`#include <AudioStreamBase.h>`

Inheritance diagram for oboe::AudioStreamBase:

## Public Member Functions
| AudioStreamBase (const AudioStreamBase &)=default
AudioStreamBase & | operator= (const AudioStreamBase &)=default
int32_t | getChannelCount () const
Direction | getDirection () const
int32_t | getSampleRate () const
int32_t | getFramesPerCallback () const
int32_t | getFramesPerDataCallback () const
AudioFormat | getFormat () const
virtual int32_t | getBufferSizeInFrames ()
virtual int32_t | getBufferCapacityInFrames () const
SharingMode | getSharingMode () const
PerformanceMode | getPerformanceMode () const
int32_t | getDeviceId () const
AudioStreamDataCallback * | getDataCallback () const
AudioStreamErrorCallback * | getErrorCallback () const
bool | isDataCallbackSpecified () const
bool | isErrorCallbackSpecified () const
Usage | getUsage () const
ContentType | getContentType () const
InputPreset | getInputPreset () const
SessionId | getSessionId () const
bool | isChannelConversionAllowed () const
bool | isFormatConversionAllowed () const
SampleRateConversionQuality | getSampleRateConversionQuality () const

## Protected Member Functions
virtual Result | isValidConfig ()

## Protected Attributes
AudioStreamDataCallback * | mDataCallback = nullptr
AudioStreamErrorCallback * | mErrorCallback = nullptr
int32_t | mFramesPerCallback = kUnspecified
int32_t | mChannelCount = kUnspecified
int32_t | mSampleRate = kUnspecified
int32_t | mDeviceId = kUnspecified
int32_t | mBufferCapacityInFrames = kUnspecified
int32_t | mBufferSizeInFrames = kUnspecified
int32_t | mFramesPerBurst = kUnspecified
SharingMode | mSharingMode = SharingMode::Shared
AudioFormat | mFormat = AudioFormat::Unspecified
Direction | mDirection = Direction::Output
PerformanceMode | mPerformanceMode = PerformanceMode::None
Usage | mUsage = Usage::Media
ContentType | mContentType = ContentType::Music
InputPreset | mInputPreset = InputPreset::VoiceRecognition
SessionId | mSessionId = SessionId::None
bool | mChannelConversionAllowed = false
bool | mFormatConversionAllowed = false
SampleRateConversionQuality | mSampleRateConversionQuality = SampleRateConversionQuality::None

## Detailed Description

Base class containing parameters for audio streams and builders.

## Constructor & Destructor Documentation

## ◆ AudioStreamBase()

oboe::AudioStreamBase::AudioStreamBase | ( | const AudioStreamBase & |  | ) |
| default

Default copy constructor

## Member Function Documentation

## ◆ getBufferCapacityInFrames()

virtual int32_t oboe::AudioStreamBase::getBufferCapacityInFrames | ( |  | ) | const
| inline virtual

Returns
  capacityInFrames or kUnspecified

## ◆ getBufferSizeInFrames()

virtual int32_t oboe::AudioStreamBase::getBufferSizeInFrames | ( |  | ) |
| inline virtual

Query the maximum number of frames that can be filled without blocking. If the stream has been closed the last known value will be returned.

Returns
  buffer size

## ◆ getChannelCount()

int32_t oboe::AudioStreamBase::getChannelCount | ( |  | ) | const
| inline

Returns
  number of channels, for example 2 for stereo, or kUnspecified

## ◆ getContentType()

ContentType oboe::AudioStreamBase::getContentType | ( |  | ) | const
| inline

Returns
  the stream's content type.

## ◆ getDataCallback()

AudioStreamDataCallback* oboe::AudioStreamBase::getDataCallback | ( |  | ) | const
| inline

For internal use only.

Returns
  the data callback object for this stream, if set.

## ◆ getDeviceId()

int32_t oboe::AudioStreamBase::getDeviceId | ( |  | ) | const
| inline

Returns
  the device ID of the stream.

## ◆ getDirection()

Direction oboe::AudioStreamBase::getDirection | ( |  | ) | const
| inline

Returns
  Direction::Input or Direction::Output

## ◆ getErrorCallback()

AudioStreamErrorCallback* oboe::AudioStreamBase::getErrorCallback | ( |  | ) | const
| inline

For internal use only.

Returns
  the error callback object for this stream, if set.

## ◆ getFormat()

AudioFormat oboe::AudioStreamBase::getFormat | ( |  | ) | const
| inline

Returns
  the audio sample format (e.g. Float or I16)

## ◆ getFramesPerCallback()

int32_t oboe::AudioStreamBase::getFramesPerCallback | ( |  | ) | const
| inline

Deprecated:
  use `getFramesPerDataCallback` instead.

## ◆ getFramesPerDataCallback()

int32_t oboe::AudioStreamBase::getFramesPerDataCallback | ( |  | ) | const
| inline

Returns
  the number of frames in each data callback or kUnspecified.

## ◆ getInputPreset()

InputPreset oboe::AudioStreamBase::getInputPreset | ( |  | ) | const
| inline

Returns
  the stream's input preset.

## ◆ getPerformanceMode()

PerformanceMode oboe::AudioStreamBase::getPerformanceMode | ( |  | ) | const
| inline

Returns
  the performance mode of the stream.

## ◆ getSampleRate()

int32_t oboe::AudioStreamBase::getSampleRate | ( |  | ) | const
| inline

Returns
  sample rate for the stream or kUnspecified

## ◆ getSampleRateConversionQuality()

SampleRateConversionQuality oboe::AudioStreamBase::getSampleRateConversionQuality | ( |  | ) | const
| inline

Returns
  whether and how Oboe can convert sample rates to achieve optimal results.

## ◆ getSessionId()

SessionId oboe::AudioStreamBase::getSessionId | ( |  | ) | const
| inline

Returns
  the stream's session ID allocation strategy (None or Allocate).

## ◆ getSharingMode()

SharingMode oboe::AudioStreamBase::getSharingMode | ( |  | ) | const
| inline

Returns
  the sharing mode of the stream.

## ◆ getUsage()

Usage oboe::AudioStreamBase::getUsage | ( |  | ) | const
| inline

Returns
  the usage for this stream.

## ◆ isChannelConversionAllowed()

bool oboe::AudioStreamBase::isChannelConversionAllowed | ( |  | ) | const
| inline

Returns
  true if Oboe can convert channel counts to achieve optimal results.

## ◆ isDataCallbackSpecified()

bool oboe::AudioStreamBase::isDataCallbackSpecified | ( |  | ) | const
| inline

Returns
  true if a data callback was set for this stream

## ◆ isErrorCallbackSpecified()

bool oboe::AudioStreamBase::isErrorCallbackSpecified | ( |  | ) | const
| inline

Note that if the app does not set an error callback then a default one may be provided.

Returns
  true if an error callback was set for this stream

## ◆ isFormatConversionAllowed()

bool oboe::AudioStreamBase::isFormatConversionAllowed | ( |  | ) | const
| inline

Returns
  true if Oboe can convert data formats to achieve optimal results.

## ◆ isValidConfig()

virtual Result oboe::AudioStreamBase::isValidConfig | ( |  | ) |
| inline protected virtual

Validate stream parameters that might not be checked in lower layers

## ◆ operator=()

AudioStreamBase& oboe::AudioStreamBase::operator= | ( | const AudioStreamBase & |  | ) |
| default

Default assignment operator

## Member Data Documentation

## ◆ mBufferCapacityInFrames

int32_t oboe::AudioStreamBase::mBufferCapacityInFrames = kUnspecified
| protected

Stream buffer capacity specified as a number of audio frames

## ◆ mBufferSizeInFrames

int32_t oboe::AudioStreamBase::mBufferSizeInFrames = kUnspecified
| protected

Stream buffer size specified as a number of audio frames

## ◆ mChannelCount

int32_t oboe::AudioStreamBase::mChannelCount = kUnspecified
| protected

Stream channel count

## ◆ mContentType

ContentType oboe::AudioStreamBase::mContentType = ContentType::Music
| protected

Stream content type. Only active on Android 28+

## ◆ mDataCallback

AudioStreamDataCallback* oboe::AudioStreamBase::mDataCallback = nullptr
| protected

The callback which will be fired when new data is ready to be read/written.

## ◆ mDeviceId

int32_t oboe::AudioStreamBase::mDeviceId = kUnspecified
| protected

Stream audio device ID

## ◆ mDirection

Direction oboe::AudioStreamBase::mDirection = Direction::Output
| protected

Stream direction

## ◆ mErrorCallback

AudioStreamErrorCallback* oboe::AudioStreamBase::mErrorCallback = nullptr
| protected

The callback which will be fired when an error or a disconnect occurs.

## ◆ mFormat

AudioFormat oboe::AudioStreamBase::mFormat = AudioFormat::Unspecified
| protected

Format of audio frames

## ◆ mFramesPerBurst

int32_t oboe::AudioStreamBase::mFramesPerBurst = kUnspecified
| protected

Number of frames which will be copied to/from the audio device in a single read/write operation

## ◆ mFramesPerCallback

int32_t oboe::AudioStreamBase::mFramesPerCallback = kUnspecified
| protected

Number of audio frames which will be requested in each callback

## ◆ mInputPreset

InputPreset oboe::AudioStreamBase::mInputPreset = InputPreset::VoiceRecognition
| protected

Stream input preset. Only active on Android 28+ TODO InputPreset::Unspecified should be considered as a possible default alternative.

## ◆ mPerformanceMode

PerformanceMode oboe::AudioStreamBase::mPerformanceMode = PerformanceMode::None
| protected

Stream performance mode

## ◆ mSampleRate

int32_t oboe::AudioStreamBase::mSampleRate = kUnspecified
| protected

Stream sample rate

## ◆ mSessionId

SessionId oboe::AudioStreamBase::mSessionId = SessionId::None
| protected

Stream session ID allocation strategy. Only active on Android 28+

## ◆ mSharingMode

SharingMode oboe::AudioStreamBase::mSharingMode = SharingMode::Shared
| protected

Stream sharing mode

## ◆ mUsage

Usage oboe::AudioStreamBase::mUsage = Usage::Media
| protected

Stream usage. Only active on Android 28+

The documentation for this class was generated from the following file:

- include/oboe/AudioStreamBase.h