Oboe
A library for creating real-time audio apps on Android
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
oboe::AudioStreamBase Class Reference

#include <AudioStreamBase.h>

Inheritance diagram for oboe::AudioStreamBase:
oboe::AudioStream oboe::AudioStreamBuilder

Public Member Functions

 AudioStreamBase (const AudioStreamBase &)=default
 
AudioStreamBaseoperator= (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
 
AudioStreamDataCallbackgetDataCallback () const
 
AudioStreamErrorCallbackgetErrorCallback () const
 
bool isDataCallbackSpecified () const
 
bool isErrorCallbackSpecified () const
 
Usage getUsage () const
 
ContentType getContentType () const
 
InputPreset getInputPreset () const
 
SessionId getSessionId () const
 
bool isContentSpatialized () const
 
SpatializationBehavior getSpatializationBehavior () const
 
AllowedCapturePolicy getAllowedCapturePolicy () const
 
PrivacySensitiveMode getPrivacySensitiveMode () const
 
bool isChannelConversionAllowed () const
 
bool isFormatConversionAllowed () const
 
SampleRateConversionQuality getSampleRateConversionQuality () const
 
ChannelMask getChannelMask () const
 
int32_t getHardwareChannelCount () const
 
int32_t getHardwareSampleRate () const
 
AudioFormat getHardwareFormat () const
 

Protected Member Functions

virtual Result isValidConfig ()
 

Protected Attributes

AudioStreamDataCallbackmDataCallback = nullptr
 
std::shared_ptr< AudioStreamDataCallbackmSharedDataCallback
 
AudioStreamErrorCallbackmErrorCallback = nullptr
 
std::shared_ptr< AudioStreamErrorCallbackmSharedErrorCallback
 
int32_t mFramesPerCallback = kUnspecified
 
int32_t mChannelCount = kUnspecified
 
int32_t mSampleRate = kUnspecified
 
int32_t mDeviceId = kUnspecified
 
int32_t mBufferCapacityInFrames = kUnspecified
 
int32_t mBufferSizeInFrames = kUnspecified
 
ChannelMask mChannelMask = ChannelMask::Unspecified
 
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
 
AllowedCapturePolicy mAllowedCapturePolicy = AllowedCapturePolicy::Unspecified
 
PrivacySensitiveMode mPrivacySensitiveMode = PrivacySensitiveMode::Unspecified
 
std::string mPackageName
 
std::string mAttributionTag
 
bool mIsContentSpatialized = false
 
SpatializationBehavior mSpatializationBehavior = SpatializationBehavior::Unspecified
 
int32_t mHardwareChannelCount = kUnspecified
 
int32_t mHardwareSampleRate = kUnspecified
 
AudioFormat mHardwareFormat = AudioFormat::Unspecified
 
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

◆ getAllowedCapturePolicy()

AllowedCapturePolicy oboe::AudioStreamBase::getAllowedCapturePolicy ( ) const
inline

Return the policy that determines whether the audio may or may not be captured by other apps or the system.

See AudioStreamBuilder_setAllowedCapturePolicy().

Added in API level 29 to AAudio.

Returns
the allowed capture policy, for example AllowedCapturePolicy::All

◆ getBufferCapacityInFrames()

virtual int32_t oboe::AudioStreamBase::getBufferCapacityInFrames ( ) const
inlinevirtual
Returns
capacityInFrames or kUnspecified

◆ getBufferSizeInFrames()

virtual int32_t oboe::AudioStreamBase::getBufferSizeInFrames ( )
inlinevirtual

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

◆ getChannelMask()

ChannelMask oboe::AudioStreamBase::getChannelMask ( ) const
inline
Returns
the stream's channel mask.

◆ 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

◆ 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.

◆ getHardwareChannelCount()

int32_t oboe::AudioStreamBase::getHardwareChannelCount ( ) const
inline
Returns
number of channels for the hardware, for example 2 for stereo, or kUnspecified.

◆ getHardwareFormat()

AudioFormat oboe::AudioStreamBase::getHardwareFormat ( ) const
inline
Returns
the audio sample format of the hardware (e.g. Float or I16)

◆ getHardwareSampleRate()

int32_t oboe::AudioStreamBase::getHardwareSampleRate ( ) const
inline
Returns
hardware sample rate for the stream 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.

◆ getPrivacySensitiveMode()

PrivacySensitiveMode oboe::AudioStreamBase::getPrivacySensitiveMode ( ) const
inline

Return whether this input stream is marked as privacy sensitive.

See AudioStreamBuilder_setPrivacySensitiveMode().

Added in API level 30 to AAudio.

Returns
PrivacySensitiveMode::Enabled if privacy sensitive, PrivacySensitiveMode::Disabled if not privacy sensitive, and PrivacySensitiveMode::Unspecified if API is not supported.

◆ 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.

◆ getSpatializationBehavior()

SpatializationBehavior oboe::AudioStreamBase::getSpatializationBehavior ( ) const
inline
Returns
the spatialization behavior for 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.

◆ isContentSpatialized()

bool oboe::AudioStreamBase::isContentSpatialized ( ) const
inline
Returns
whether the content of the stream is spatialized.

◆ 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 ( )
inlineprotectedvirtual

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

◆ mAllowedCapturePolicy

AllowedCapturePolicy oboe::AudioStreamBase::mAllowedCapturePolicy = AllowedCapturePolicy::Unspecified
protected

Allowed Capture Policy. Only active on Android 29+

◆ mAttributionTag

std::string oboe::AudioStreamBase::mAttributionTag
protected

Control the attribution tag of the context creating the stream. Only active on Android 31+

◆ 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

◆ mChannelMask

ChannelMask oboe::AudioStreamBase::mChannelMask = ChannelMask::Unspecified
protected

Stream channel mask. Only active on Android 32+

◆ 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

◆ mFramesPerCallback

int32_t oboe::AudioStreamBase::mFramesPerCallback = kUnspecified
protected

Number of audio frames which will be requested in each callback

◆ mHardwareChannelCount

int32_t oboe::AudioStreamBase::mHardwareChannelCount = kUnspecified
protected

Hardware channel count. Only specified on Android 34+ AAudio streams

◆ mHardwareFormat

AudioFormat oboe::AudioStreamBase::mHardwareFormat = AudioFormat::Unspecified
protected

Hardware format. Only specified on Android 34+ AAudio streams

◆ mHardwareSampleRate

int32_t oboe::AudioStreamBase::mHardwareSampleRate = kUnspecified
protected

Hardware sample rate. Only specified on Android 34+ AAudio streams

◆ 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.

◆ mIsContentSpatialized

bool oboe::AudioStreamBase::mIsContentSpatialized = false
protected

Whether the content is already spatialized. Only used on Android 32+

◆ mPackageName

std::string oboe::AudioStreamBase::mPackageName
protected

Control the name of the package creating the stream. Only active on Android 31+

◆ mPerformanceMode

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

Stream performance mode

◆ mPrivacySensitiveMode

PrivacySensitiveMode oboe::AudioStreamBase::mPrivacySensitiveMode = PrivacySensitiveMode::Unspecified
protected

Privacy Sensitive Mode. Only active on Android 30+

◆ 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

◆ mSpatializationBehavior

SpatializationBehavior oboe::AudioStreamBase::mSpatializationBehavior = SpatializationBehavior::Unspecified
protected

Spatialization Behavior. Only active on Android 32+

◆ 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: