Oboe
A library for creating real-time audio apps on Android
|
Classes | |
class | AudioStream |
class | AudioStreamBase |
class | AudioStreamBuilder |
class | AudioStreamCallback |
class | AudioStreamDataCallback |
class | AudioStreamErrorCallback |
class | DefaultStreamValues |
class | FifoBuffer |
class | FifoControllerBase |
struct | FrameTimestamp |
class | LatencyTuner |
class | OboeExtensions |
class | OboeGlobals |
class | ResultWithValue |
class | StabilizedCallback |
struct | StreamDeleterFunctor |
struct | Version |
Typedefs | |
using | ManagedStream = std::unique_ptr< AudioStream, StreamDeleterFunctor > |
Enumerations | |
enum class | StreamState : int32_t { Uninitialized = 0 , Unknown = 1 , Open = 2 , Starting = 3 , Started = 4 , Pausing = 5 , Paused = 6 , Flushing = 7 , Flushed = 8 , Stopping = 9 , Stopped = 10 , Closing = 11 , Closed = 12 , Disconnected = 13 } |
enum class | Direction : int32_t { Output = 0 , Input = 1 } |
enum class | AudioFormat : int32_t { Invalid = -1 , Unspecified = 0 , I16 = 1 , Float = 2 , I24 = 3 , I32 = 4 } |
enum class | DataCallbackResult : int32_t { Continue = 0 , Stop = 1 } |
enum class | Result : int32_t { OK = 0 , ErrorBase = -900 , ErrorDisconnected = -899 , ErrorIllegalArgument = -898 , ErrorInternal = -896 , ErrorInvalidState = -895 , ErrorInvalidHandle = -892 , ErrorUnimplemented = -890 , ErrorUnavailable = -889 , ErrorNoFreeHandles = -888 , ErrorNoMemory = -887 , ErrorNull = -886 , ErrorTimeout = -885 , ErrorWouldBlock = -884 , ErrorInvalidFormat = -883 , ErrorOutOfRange = -882 , ErrorNoService = -881 , ErrorInvalidRate = -880 , Reserved1 , Reserved2 , Reserved3 , Reserved4 , Reserved5 , Reserved6 , Reserved7 , Reserved8 , Reserved9 , Reserved10 , ErrorClosed = -869 } |
enum class | SharingMode : int32_t { Exclusive = 0 , Shared = 1 } |
enum class | PerformanceMode : int32_t { None = 10 , PowerSaving = 11 , LowLatency = 12 } |
enum class | AudioApi : int32_t { Unspecified = kUnspecified , OpenSLES , AAudio } |
enum class | SampleRateConversionQuality : int32_t { None , Fastest , Low , Medium , High , Best } |
enum class | Usage : int32_t { Media = 1 , VoiceCommunication = 2 , VoiceCommunicationSignalling = 3 , Alarm = 4 , Notification = 5 , NotificationRingtone = 6 , NotificationEvent = 10 , AssistanceAccessibility = 11 , AssistanceNavigationGuidance = 12 , AssistanceSonification = 13 , Game = 14 , Assistant = 16 } |
enum | ContentType : int32_t { Speech = 1 , Music = 2 , Movie = 3 , Sonification = 4 } |
enum | InputPreset : int32_t { Generic = 1 , Camcorder = 5 , VoiceRecognition = 6 , VoiceCommunication = 7 , Unprocessed = 9 , VoicePerformance = 10 } |
enum | SessionId { None = -1 , Allocate = 0 } |
enum | ChannelCount : int32_t { Unspecified = kUnspecified , Mono = 1 , Stereo = 2 } |
enum class | ChannelMask : uint32_t { Unspecified = kUnspecified , FrontLeft = 1 << 0 , FrontRight = 1 << 1 , FrontCenter = 1 << 2 , LowFrequency = 1 << 3 , BackLeft = 1 << 4 , BackRight = 1 << 5 , FrontLeftOfCenter = 1 << 6 , FrontRightOfCenter = 1 << 7 , BackCenter = 1 << 8 , SideLeft = 1 << 9 , SideRight = 1 << 10 , TopCenter = 1 << 11 , TopFrontLeft = 1 << 12 , TopFrontCenter = 1 << 13 , TopFrontRight = 1 << 14 , TopBackLeft = 1 << 15 , TopBackCenter = 1 << 16 , TopBackRight = 1 << 17 , TopSideLeft = 1 << 18 , TopSideRight = 1 << 19 , BottomFrontLeft = 1 << 20 , BottomFrontCenter = 1 << 21 , BottomFrontRight = 1 << 22 , LowFrequency2 = 1 << 23 , FrontWideLeft = 1 << 24 , FrontWideRight = 1 << 25 , Mono = FrontLeft , Stereo , CM2Point1 , Tri , TriBack , CM3Point1 , CM2Point0Point2 , CM2Point1Point2 , CM3Point0Point2 , CM3Point1Point2 , Quad , QuadSide , Surround , Penta , CM5Point1 , CM5Point1Side , CM6Point1 , CM7Point1 , CM5Point1Point2 , CM5Point1Point4 , CM7Point1Point2 , CM7Point1Point4 , CM9Point1Point4 , CM9Point1Point6 , FrontBack } |
Functions | |
template<typename T > | |
std::ostream & | operator<< (std::ostream &strm, const ResultWithValue< T > &result) |
void | convertFloatToPcm16 (const float *source, int16_t *destination, int32_t numSamples) |
void | convertPcm16ToFloat (const int16_t *source, float *destination, int32_t numSamples) |
int32_t | convertFormatToSizeInBytes (AudioFormat format) |
template<typename FromType > | |
const char * | convertToText (FromType input) |
std::string | getPropertyString (const char *name) |
int | getPropertyInteger (const char *name, int defaultValue) |
int | getSdkVersion () |
int | getChannelCountFromChannelMask (ChannelMask channelMask) |
const char * | getVersionText () |
Variables | |
constexpr int64_t | kDefaultTimeoutNanos = (2000 * kNanosPerMillisecond) |
constexpr int32_t | kUnspecified = 0 |
constexpr int64_t | kNanosPerMicrosecond = 1000 |
constexpr int64_t | kNanosPerMillisecond = kNanosPerMicrosecond * 1000 |
constexpr int64_t | kMillisPerSecond = 1000 |
constexpr int64_t | kNanosPerSecond = kNanosPerMillisecond * kMillisPerSecond |
WARNING - UNDER CONSTRUCTION - THIS API WILL CHANGE.
|
strong |
The underlying audio API used by the audio stream.
|
strong |
The format of audio samples.
enum oboe::ChannelCount : int32_t |
The channel count of the audio stream. The underlying type is int32_t
. Use of this enum is convenient to avoid "magic" numbers when specifying the channel count.
For example, you can write builder.setChannelCount(ChannelCount::Stereo)
rather than builder.setChannelCount(2)
Enumerator | |
---|---|
Unspecified | Audio channel count definition, use Mono or Stereo |
Mono | Use this for mono audio |
Stereo | Use this for stereo audio. |
|
strong |
The channel mask of the audio stream. The underlying type is uint32_t
. Use of this enum is convenient.
ChannelMask::Unspecified means this is not specified. The rest of the enums are channel position masks. Use the combinations of the channel position masks defined below instead of using those values directly.
enum oboe::ContentType : int32_t |
The ContentType attribute describes what you are playing. It expresses the general category of the content. This information is optional. But in case it is known (for instance Movie
for a movie streaming service or Speech
for an audio book application) this information might be used by the audio framework to enforce audio focus.
Note that these match the equivalent values in AudioAttributes in the Android Java API.
This attribute only has an effect on Android API 28+.
|
strong |
The result of an audio callback.
|
strong |
enum oboe::InputPreset : int32_t |
Defines the audio source. An audio source defines both a default physical source of audio signal, and a recording configuration.
Note that these match the equivalent values in MediaRecorder.AudioSource in the Android Java API.
This attribute only has an effect on Android API 28+.
|
strong |
|
strong |
The result of an operation. All except the OK
result indicates that an error occurred. The Result
can be converted into a human readable string using convertToText
.
|
strong |
Specifies the quality of the sample rate conversion performed by Oboe. Higher quality will require more CPU load. Higher quality conversion will probably be implemented using a sinc based resampler.
enum oboe::SessionId |
This attribute can be used to allocate a session ID to the audio stream.
This attribute only has an effect on Android API 28+.
|
strong |
The sharing mode of the audio stream.
|
strong |
The state of the audio stream.
|
strong |
The Usage attribute expresses why you are playing a sound, what is this sound used for. This information is used by certain platforms or routing policies to make more refined volume or routing decisions.
Note that these match the equivalent values in AudioAttributes in the Android Java API.
This attribute only has an effect on Android API 28+.
void oboe::convertFloatToPcm16 | ( | const float * | source, |
int16_t * | destination, | ||
int32_t | numSamples | ||
) |
Convert an array of floats to an array of 16-bit integers.
source | the input array. |
destination | the output array. |
numSamples | the number of values to convert. |
int32_t oboe::convertFormatToSizeInBytes | ( | AudioFormat | format | ) |
void oboe::convertPcm16ToFloat | ( | const int16_t * | source, |
float * | destination, | ||
int32_t | numSamples | ||
) |
Convert an array of 16-bit integers to an array of floats.
source | the input array. |
destination | the output array. |
numSamples | the number of values to convert. |
const char * oboe::convertToText | ( | FromType | input | ) |
The text is the ASCII symbol corresponding to the supplied Oboe enum value, or an English message saying the value is unrecognized. This is intended for developers to use when debugging. It is not for displaying to users.
input | object to convert from. |
int oboe::getPropertyInteger | ( | const char * | name, |
int | defaultValue | ||
) |
name | |
defaultValue |
std::string oboe::getPropertyString | ( | const char * | name | ) |
name |
int oboe::getSdkVersion | ( | ) |
Return the version of the SDK that is currently running.
For example, on Android, this would return 27 for Oreo 8.1. If the version number cannot be determined then this will return -1.
std::ostream & oboe::operator<< | ( | std::ostream & | strm, |
const ResultWithValue< T > & | result | ||
) |
If the result is OK
then return the value, otherwise return a human-readable error message.
|
constexpr |
The default number of nanoseconds to wait for when performing state change operations on the stream, such as start
and stop
.
|
constexpr |
The number of milliseconds in a second. 1,000.
|
constexpr |
The number of nanoseconds in a microsecond. 1,000.
|
constexpr |
The number of nanoseconds in a millisecond. 1,000,000.
|
constexpr |
The number of nanoseconds in a second. 1,000,000,000.
|
constexpr |
Represents any attribute, property or value which hasn't been specified.