Skip to content

Most visited

Recently visited

navigation

AAudio.h File Reference

AAudio.h File Reference

Typedefs

typedef int32_t aaudio_direction_t
 
typedef int32_t aaudio_format_t
 
typedef int32_t aaudio_result_t
 
typedef int32_t aaudio_stream_state_t
 
typedef int32_t aaudio_sharing_mode_t
 
typedef int32_t aaudio_performance_mode_t
 
typedef struct AAudioStreamStruct AAudioStream
 
typedef struct AAudioStreamBuilderStruct AAudioStreamBuilder
 
typedef int32_t aaudio_data_callback_result_t
 
typedef aaudio_data_callback_result_t(* AAudioStream_dataCallback) (AAudioStream *stream, void *userData, void *audioData, int32_t numFrames)
 
typedef void(* AAudioStream_errorCallback) (AAudioStream *stream, void *userData, aaudio_result_t error)
 

Enumerations

enum  { AAUDIO_DIRECTION_OUTPUT, AAUDIO_DIRECTION_INPUT }
 
enum  { AAUDIO_FORMAT_INVALID = -1, AAUDIO_FORMAT_UNSPECIFIED = 0, AAUDIO_FORMAT_PCM_I16, AAUDIO_FORMAT_PCM_FLOAT }
 
enum  {
  AAUDIO_OK, AAUDIO_ERROR_BASE = -900, AAUDIO_ERROR_DISCONNECTED, AAUDIO_ERROR_ILLEGAL_ARGUMENT,
  AAUDIO_ERROR_INTERNAL = AAUDIO_ERROR_ILLEGAL_ARGUMENT + 2, AAUDIO_ERROR_INVALID_STATE, AAUDIO_ERROR_INVALID_HANDLE = AAUDIO_ERROR_INVALID_STATE + 3, AAUDIO_ERROR_UNIMPLEMENTED = AAUDIO_ERROR_INVALID_HANDLE + 2,
  AAUDIO_ERROR_UNAVAILABLE, AAUDIO_ERROR_NO_FREE_HANDLES, AAUDIO_ERROR_NO_MEMORY, AAUDIO_ERROR_NULL,
  AAUDIO_ERROR_TIMEOUT, AAUDIO_ERROR_WOULD_BLOCK, AAUDIO_ERROR_INVALID_FORMAT, AAUDIO_ERROR_OUT_OF_RANGE,
  AAUDIO_ERROR_NO_SERVICE, AAUDIO_ERROR_INVALID_RATE
}
 
enum  {
  AAUDIO_STREAM_STATE_UNINITIALIZED = 0, AAUDIO_STREAM_STATE_UNKNOWN, AAUDIO_STREAM_STATE_OPEN, AAUDIO_STREAM_STATE_STARTING,
  AAUDIO_STREAM_STATE_STARTED, AAUDIO_STREAM_STATE_PAUSING, AAUDIO_STREAM_STATE_PAUSED, AAUDIO_STREAM_STATE_FLUSHING,
  AAUDIO_STREAM_STATE_FLUSHED, AAUDIO_STREAM_STATE_STOPPING, AAUDIO_STREAM_STATE_STOPPED, AAUDIO_STREAM_STATE_CLOSING,
  AAUDIO_STREAM_STATE_CLOSED, AAUDIO_STREAM_STATE_DISCONNECTED
}
 
enum  { AAUDIO_SHARING_MODE_EXCLUSIVE, AAUDIO_SHARING_MODE_SHARED }
 
enum  { AAUDIO_PERFORMANCE_MODE_NONE = 10, AAUDIO_PERFORMANCE_MODE_POWER_SAVING, AAUDIO_PERFORMANCE_MODE_LOW_LATENCY }
 
enum  { AAUDIO_CALLBACK_RESULT_CONTINUE = 0, AAUDIO_CALLBACK_RESULT_STOP }
 

Functions

AAUDIO_API const char * AAudio_convertResultToText (aaudio_result_t returnCode)
 
AAUDIO_API const char * AAudio_convertStreamStateToText (aaudio_stream_state_t state)
 
AAUDIO_API aaudio_result_t AAudio_createStreamBuilder (AAudioStreamBuilder **builder)
 
AAUDIO_API void AAudioStreamBuilder_setDeviceId (AAudioStreamBuilder *builder, int32_t deviceId)
 
AAUDIO_API void AAudioStreamBuilder_setSampleRate (AAudioStreamBuilder *builder, int32_t sampleRate)
 
AAUDIO_API void AAudioStreamBuilder_setChannelCount (AAudioStreamBuilder *builder, int32_t channelCount)
 
AAUDIO_API void AAudioStreamBuilder_setSamplesPerFrame (AAudioStreamBuilder *builder, int32_t samplesPerFrame)
 
AAUDIO_API void AAudioStreamBuilder_setFormat (AAudioStreamBuilder *builder, aaudio_format_t format)
 
AAUDIO_API void AAudioStreamBuilder_setSharingMode (AAudioStreamBuilder *builder, aaudio_sharing_mode_t sharingMode)
 
AAUDIO_API void AAudioStreamBuilder_setDirection (AAudioStreamBuilder *builder, aaudio_direction_t direction)
 
AAUDIO_API void AAudioStreamBuilder_setBufferCapacityInFrames (AAudioStreamBuilder *builder, int32_t numFrames)
 
AAUDIO_API void AAudioStreamBuilder_setPerformanceMode (AAudioStreamBuilder *builder, aaudio_performance_mode_t mode)
 
AAUDIO_API void AAudioStreamBuilder_setDataCallback (AAudioStreamBuilder *builder, AAudioStream_dataCallback callback, void *userData)
 
AAUDIO_API void AAudioStreamBuilder_setFramesPerDataCallback (AAudioStreamBuilder *builder, int32_t numFrames)
 
AAUDIO_API void AAudioStreamBuilder_setErrorCallback (AAudioStreamBuilder *builder, AAudioStream_errorCallback callback, void *userData)
 
AAUDIO_API aaudio_result_t AAudioStreamBuilder_openStream (AAudioStreamBuilder *builder, AAudioStream **stream)
 
AAUDIO_API aaudio_result_t AAudioStreamBuilder_delete (AAudioStreamBuilder *builder)
 
AAUDIO_API aaudio_result_t AAudioStream_close (AAudioStream *stream)
 
AAUDIO_API aaudio_result_t AAudioStream_requestStart (AAudioStream *stream)
 
AAUDIO_API aaudio_result_t AAudioStream_requestPause (AAudioStream *stream)
 
AAUDIO_API aaudio_result_t AAudioStream_requestFlush (AAudioStream *stream)
 
AAUDIO_API aaudio_result_t AAudioStream_requestStop (AAudioStream *stream)
 
AAUDIO_API aaudio_stream_state_t AAudioStream_getState (AAudioStream *stream)
 
AAUDIO_API aaudio_result_t AAudioStream_waitForStateChange (AAudioStream *stream, aaudio_stream_state_t inputState, aaudio_stream_state_t *nextState, int64_t timeoutNanoseconds)
 
AAUDIO_API aaudio_result_t AAudioStream_read (AAudioStream *stream, void *buffer, int32_t numFrames, int64_t timeoutNanoseconds)
 
AAUDIO_API aaudio_result_t AAudioStream_write (AAudioStream *stream, const void *buffer, int32_t numFrames, int64_t timeoutNanoseconds)
 
AAUDIO_API aaudio_result_t AAudioStream_setBufferSizeInFrames (AAudioStream *stream, int32_t numFrames)
 
AAUDIO_API int32_t AAudioStream_getBufferSizeInFrames (AAudioStream *stream)
 
AAUDIO_API int32_t AAudioStream_getFramesPerBurst (AAudioStream *stream)
 
AAUDIO_API int32_t AAudioStream_getBufferCapacityInFrames (AAudioStream *stream)
 
AAUDIO_API int32_t AAudioStream_getFramesPerDataCallback (AAudioStream *stream)
 
AAUDIO_API int32_t AAudioStream_getXRunCount (AAudioStream *stream)
 
AAUDIO_API int32_t AAudioStream_getSampleRate (AAudioStream *stream)
 
AAUDIO_API int32_t AAudioStream_getChannelCount (AAudioStream *stream)
 
AAUDIO_API int32_t AAudioStream_getSamplesPerFrame (AAudioStream *stream)
 
AAUDIO_API int32_t AAudioStream_getDeviceId (AAudioStream *stream)
 
AAUDIO_API aaudio_format_t AAudioStream_getFormat (AAudioStream *stream)
 
AAUDIO_API aaudio_sharing_mode_t AAudioStream_getSharingMode (AAudioStream *stream)
 
AAUDIO_API aaudio_performance_mode_t AAudioStream_getPerformanceMode (AAudioStream *stream)
 
AAUDIO_API aaudio_direction_t AAudioStream_getDirection (AAudioStream *stream)
 
AAUDIO_API int64_t AAudioStream_getFramesWritten (AAudioStream *stream)
 
AAUDIO_API int64_t AAudioStream_getFramesRead (AAudioStream *stream)
 
AAUDIO_API aaudio_result_t AAudioStream_getTimestamp (AAudioStream *stream, clockid_t clockid, int64_t *framePosition, int64_t *timeNanoseconds)
 
This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (Dec 2017 Android Platform & Tools Survey)