Loading media/libaaudio/include/aaudio/AAudio.h +86 −78 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ extern "C" { /** * This is used to represent a value that has not been specified. * For example, an application could use AAUDIO_UNSPECIFIED to indicate * For example, an application could use {@link #AAUDIO_UNSPECIFIED} to indicate * that is did not not care what the specific value of a parameter was * and would accept whatever it was given. */ Loading Loading @@ -304,8 +304,8 @@ typedef int32_t aaudio_usage_t; /** * The CONTENT_TYPE 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 {@link #AAUDIO_CONTENT_TYPE_MOVIE} for a * movie streaming service or {@link #AAUDIO_CONTENT_TYPE_SPEECH} for * But in case it is known (for instance AAUDIO_CONTENT_TYPE_MOVIE for a * movie streaming service or AAUDIO_CONTENT_TYPE_SPEECH for * an audio book application) this information might be used by the audio framework to * enforce audio focus. * Loading Loading @@ -398,12 +398,12 @@ enum { * Indicates that the audio may be captured by any app. * * For privacy, the following usages can not be recorded: AAUDIO_VOICE_COMMUNICATION*, * AAUDIO_USAGE_NOTIFICATION*, AAUDIO_USAGE_ASSISTANCE* and AAUDIO_USAGE_ASSISTANT. * AAUDIO_USAGE_NOTIFICATION*, AAUDIO_USAGE_ASSISTANCE* and {@link #AAUDIO_USAGE_ASSISTANT}. * * On {@link Android.os.Build.VERSION_CODES.Q}, this means only {@link AAUDIO_USAGE_MEDIA} * and {@link AAUDIO_USAGE_GAME} may be captured. * On {@link android.os.Build.VERSION_CODES#Q}, this means only {@link #AAUDIO_USAGE_MEDIA} * and {@link #AAUDIO_USAGE_GAME} may be captured. * * See {@link android.media.AudioAttributes.ALLOW_CAPTURE_BY_ALL}. * See {@link android.media.AudioAttributes#ALLOW_CAPTURE_BY_ALL}. */ AAUDIO_ALLOW_CAPTURE_BY_ALL = 1, /** Loading @@ -411,16 +411,16 @@ enum { * * System apps can capture for many purposes like accessibility, user guidance... * but have strong restriction. See * {@link android.media.AudioAttributes.ALLOW_CAPTURE_BY_SYSTEM} for what the system apps * {@link android.media.AudioAttributes#ALLOW_CAPTURE_BY_SYSTEM} for what the system apps * can do with the capture audio. */ AAUDIO_ALLOW_CAPTURE_BY_SYSTEM = 2, /** * Indicates that the audio may not be recorded by any app, even if it is a system app. * * It is encouraged to use {@link ALLOW_CAPTURE_BY_SYSTEM} instead of this value as system apps * It is encouraged to use {@link #AAUDIO_ALLOW_CAPTURE_BY_SYSTEM} instead of this value as system apps * provide significant and useful features for the user (eg. accessibility). * See {@link android.media.AudioAttributes.ALLOW_CAPTURE_BY_NONE}. * See {@link android.media.AudioAttributes#ALLOW_CAPTURE_BY_NONE}. */ AAUDIO_ALLOW_CAPTURE_BY_NONE = 3, }; Loading Loading @@ -496,8 +496,8 @@ AAUDIO_API const char * AAudio_convertStreamStateToText(aaudio_stream_state_t st * * The deviceId is initially unspecified, meaning that the current default device will be used. * * The default direction is AAUDIO_DIRECTION_OUTPUT. * The default sharing mode is AAUDIO_SHARING_MODE_SHARED. * The default direction is {@link #AAUDIO_DIRECTION_OUTPUT}. * The default sharing mode is {@link #AAUDIO_SHARING_MODE_SHARED}. * The data format, samplesPerFrames and sampleRate are unspecified and will be * chosen by the device when it is opened. * Loading @@ -522,7 +522,7 @@ AAUDIO_API void AAudioStreamBuilder_setDeviceId(AAudioStreamBuilder* builder, /** * Request a sample rate in Hertz. * * The default, if you do not call this function, is AAUDIO_UNSPECIFIED. * The default, if you do not call this function, is {@link #AAUDIO_UNSPECIFIED}. * An optimal value will then be chosen when the stream is opened. * After opening a stream with an unspecified value, the application must * query for the actual value, which may vary by device. Loading @@ -539,7 +539,7 @@ AAUDIO_API void AAudioStreamBuilder_setSampleRate(AAudioStreamBuilder* builder, /** * Request a number of channels for the stream. * * The default, if you do not call this function, is AAUDIO_UNSPECIFIED. * The default, if you do not call this function, is {@link #AAUDIO_UNSPECIFIED}. * An optimal value will then be chosen when the stream is opened. * After opening a stream with an unspecified value, the application must * query for the actual value, which may vary by device. Loading @@ -563,9 +563,9 @@ AAUDIO_API void AAudioStreamBuilder_setSamplesPerFrame(AAudioStreamBuilder* buil int32_t samplesPerFrame) __INTRODUCED_IN(26); /** * Request a sample data format, for example AAUDIO_FORMAT_PCM_I16. * Request a sample data format, for example {@link #AAUDIO_FORMAT_PCM_I16}. * * The default, if you do not call this function, is AAUDIO_UNSPECIFIED. * The default, if you do not call this function, is {@link #AAUDIO_UNSPECIFIED}. * An optimal value will then be chosen when the stream is opened. * After opening a stream with an unspecified value, the application must * query for the actual value, which may vary by device. Loading @@ -574,7 +574,8 @@ AAUDIO_API void AAudioStreamBuilder_setSamplesPerFrame(AAudioStreamBuilder* buil * If a stream cannot be opened with the specified value then the open will fail. * * @param builder reference provided by AAudio_createStreamBuilder() * @param format common formats are AAUDIO_FORMAT_PCM_FLOAT and AAUDIO_FORMAT_PCM_I16. * @param format common formats are {@link #AAUDIO_FORMAT_PCM_FLOAT} and * {@link #AAUDIO_FORMAT_PCM_I16}. */ AAUDIO_API void AAudioStreamBuilder_setFormat(AAudioStreamBuilder* builder, aaudio_format_t format) __INTRODUCED_IN(26); Loading @@ -582,13 +583,13 @@ AAUDIO_API void AAudioStreamBuilder_setFormat(AAudioStreamBuilder* builder, /** * Request a mode for sharing the device. * * The default, if you do not call this function, is AAUDIO_SHARING_MODE_SHARED. * The default, if you do not call this function, is {@link #AAUDIO_SHARING_MODE_SHARED}. * * The requested sharing mode may not be available. * The application can query for the actual mode after the stream is opened. * * @param builder reference provided by AAudio_createStreamBuilder() * @param sharingMode AAUDIO_SHARING_MODE_SHARED or AAUDIO_SHARING_MODE_EXCLUSIVE * @param sharingMode {@link #AAUDIO_SHARING_MODE_SHARED} or {@link #AAUDIO_SHARING_MODE_EXCLUSIVE} */ AAUDIO_API void AAudioStreamBuilder_setSharingMode(AAudioStreamBuilder* builder, aaudio_sharing_mode_t sharingMode) __INTRODUCED_IN(26); Loading @@ -596,10 +597,10 @@ AAUDIO_API void AAudioStreamBuilder_setSharingMode(AAudioStreamBuilder* builder, /** * Request the direction for a stream. * * The default, if you do not call this function, is AAUDIO_DIRECTION_OUTPUT. * The default, if you do not call this function, is {@link #AAUDIO_DIRECTION_OUTPUT}. * * @param builder reference provided by AAudio_createStreamBuilder() * @param direction AAUDIO_DIRECTION_OUTPUT or AAUDIO_DIRECTION_INPUT * @param direction {@link #AAUDIO_DIRECTION_OUTPUT} or {@link #AAUDIO_DIRECTION_INPUT} */ AAUDIO_API void AAudioStreamBuilder_setDirection(AAudioStreamBuilder* builder, aaudio_direction_t direction) __INTRODUCED_IN(26); Loading @@ -608,10 +609,10 @@ AAUDIO_API void AAudioStreamBuilder_setDirection(AAudioStreamBuilder* builder, * Set the requested buffer capacity in frames. * The final AAudioStream capacity may differ, but will probably be at least this big. * * The default, if you do not call this function, is AAUDIO_UNSPECIFIED. * The default, if you do not call this function, is {@link #AAUDIO_UNSPECIFIED}. * * @param builder reference provided by AAudio_createStreamBuilder() * @param numFrames the desired buffer capacity in frames or AAUDIO_UNSPECIFIED * @param numFrames the desired buffer capacity in frames or {@link #AAUDIO_UNSPECIFIED} */ AAUDIO_API void AAudioStreamBuilder_setBufferCapacityInFrames(AAudioStreamBuilder* builder, int32_t numFrames) __INTRODUCED_IN(26); Loading @@ -619,16 +620,17 @@ AAUDIO_API void AAudioStreamBuilder_setBufferCapacityInFrames(AAudioStreamBuilde /** * Set the requested performance mode. * * Supported modes are AAUDIO_PERFORMANCE_MODE_NONE, AAUDIO_PERFORMANCE_MODE_POWER_SAVING * and AAUDIO_PERFORMANCE_MODE_LOW_LATENCY. * Supported modes are {@link #AAUDIO_PERFORMANCE_MODE_NONE}, * {@link #AAUDIO_PERFORMANCE_MODE_POWER_SAVING} * and {@link #AAUDIO_PERFORMANCE_MODE_LOW_LATENCY}. * * The default, if you do not call this function, is AAUDIO_PERFORMANCE_MODE_NONE. * The default, if you do not call this function, is {@link #AAUDIO_PERFORMANCE_MODE_NONE}. * * You may not get the mode you requested. * You can call AAudioStream_getPerformanceMode() to find out the final mode for the stream. * You can call AAudioStream_getPerformanceMode() * to find out the final mode for the stream. * * @param builder reference provided by AAudio_createStreamBuilder() * @param mode the desired performance mode, eg. AAUDIO_PERFORMANCE_MODE_LOW_LATENCY * @param mode the desired performance mode, eg. {@link #AAUDIO_PERFORMANCE_MODE_LOW_LATENCY} */ AAUDIO_API void AAudioStreamBuilder_setPerformanceMode(AAudioStreamBuilder* builder, aaudio_performance_mode_t mode) __INTRODUCED_IN(26); Loading @@ -640,12 +642,12 @@ AAUDIO_API void AAudioStreamBuilder_setPerformanceMode(AAudioStreamBuilder* buil * behavior of the stream. * This could, for example, affect how volume and focus is handled for the stream. * * The default, if you do not call this function, is AAUDIO_USAGE_MEDIA. * The default, if you do not call this function, is {@link #AAUDIO_USAGE_MEDIA}. * * Added in API level 28. * * @param builder reference provided by AAudio_createStreamBuilder() * @param usage the desired usage, eg. AAUDIO_USAGE_GAME * @param usage the desired usage, eg. {@link #AAUDIO_USAGE_GAME} */ AAUDIO_API void AAudioStreamBuilder_setUsage(AAudioStreamBuilder* builder, aaudio_usage_t usage) __INTRODUCED_IN(28); Loading @@ -657,12 +659,12 @@ AAUDIO_API void AAudioStreamBuilder_setUsage(AAudioStreamBuilder* builder, * behavior of the stream. * This could, for example, affect whether a stream is paused when a notification occurs. * * The default, if you do not call this function, is AAUDIO_CONTENT_TYPE_MUSIC. * The default, if you do not call this function, is {@link #AAUDIO_CONTENT_TYPE_MUSIC}. * * Added in API level 28. * * @param builder reference provided by AAudio_createStreamBuilder() * @param contentType the type of audio data, eg. AAUDIO_CONTENT_TYPE_SPEECH * @param contentType the type of audio data, eg. {@link #AAUDIO_CONTENT_TYPE_SPEECH} */ AAUDIO_API void AAudioStreamBuilder_setContentType(AAudioStreamBuilder* builder, aaudio_content_type_t contentType) __INTRODUCED_IN(28); Loading @@ -675,7 +677,7 @@ AAUDIO_API void AAudioStreamBuilder_setContentType(AAudioStreamBuilder* builder, * This could, for example, affect which microphones are used and how the * recorded data is processed. * * The default, if you do not call this function, is AAUDIO_INPUT_PRESET_VOICE_RECOGNITION. * The default, if you do not call this function, is {@link #AAUDIO_INPUT_PRESET_VOICE_RECOGNITION}. * That is because VOICE_RECOGNITION is the preset with the lowest latency * on many platforms. * Loading @@ -690,10 +692,10 @@ AAUDIO_API void AAudioStreamBuilder_setInputPreset(AAudioStreamBuilder* builder, /** * Specify whether this stream audio may or may not be captured by other apps or the system. * * The default is AAUDIO_ALLOW_CAPTURE_BY_ALL. * The default is {@link #AAUDIO_ALLOW_CAPTURE_BY_ALL}. * * Note that an application can also set its global policy, in which case the most restrictive * policy is always applied. See {@link android.media.AudioAttributes.setAllowedCapturePolicy} * policy is always applied. See {@link android.media.AudioAttributes#setAllowedCapturePolicy(int)} * * Added in API level 29. * Loading @@ -708,9 +710,9 @@ AAUDIO_API void AAudioStreamBuilder_setAllowedCapturePolicy(AAudioStreamBuilder* * The session ID can be used to associate a stream with effects processors. * The effects are controlled using the Android AudioEffect Java API. * * The default, if you do not call this function, is AAUDIO_SESSION_ID_NONE. * The default, if you do not call this function, is {@link #AAUDIO_SESSION_ID_NONE}. * * If set to AAUDIO_SESSION_ID_ALLOCATE then a session ID will be allocated * If set to {@link #AAUDIO_SESSION_ID_ALLOCATE} then a session ID will be allocated * when the stream is opened. * * The allocated session ID can be obtained by calling AAudioStream_getSessionId() Loading @@ -728,7 +730,7 @@ AAUDIO_API void AAudioStreamBuilder_setAllowedCapturePolicy(AAudioStreamBuilder* * Added in API level 28. * * @param builder reference provided by AAudio_createStreamBuilder() * @param sessionId an allocated sessionID or AAUDIO_SESSION_ID_ALLOCATE * @param sessionId an allocated sessionID or {@link #AAUDIO_SESSION_ID_ALLOCATE} */ AAUDIO_API void AAudioStreamBuilder_setSessionId(AAudioStreamBuilder* builder, aaudio_session_id_t sessionId) __INTRODUCED_IN(28); Loading Loading @@ -811,15 +813,16 @@ typedef aaudio_data_callback_result_t (*AAudioStream_dataCallback)( * * Note that when using this callback, the audio data will be passed in or out * of the function as an argument. * So you cannot call AAudioStream_write() or AAudioStream_read() on the same stream * that has an active data callback. * So you cannot call AAudioStream_write() or AAudioStream_read() * on the same stream that has an active data callback. * * The callback function will start being called after AAudioStream_requestStart() is called. * The callback function will start being called after AAudioStream_requestStart() * is called. * It will stop being called after AAudioStream_requestPause() or * AAudioStream_requestStop() is called. * * This callback function will be called on a real-time thread owned by AAudio. See * {@link AAudioStream_dataCallback} for more information. * {@link #AAudioStream_dataCallback} for more information. * * Note that the AAudio callbacks will never be called simultaneously from multiple threads. * Loading @@ -833,9 +836,9 @@ AAUDIO_API void AAudioStreamBuilder_setDataCallback(AAudioStreamBuilder* builder /** * Set the requested data callback buffer size in frames. * See {@link AAudioStream_dataCallback}. * See {@link #AAudioStream_dataCallback}. * * The default, if you do not call this function, is AAUDIO_UNSPECIFIED. * The default, if you do not call this function, is {@link #AAUDIO_UNSPECIFIED}. * * For the lowest possible latency, do not call this function. AAudio will then * call the dataProc callback function with whatever size is optimal. Loading @@ -852,7 +855,7 @@ AAUDIO_API void AAudioStreamBuilder_setDataCallback(AAudioStreamBuilder* builder * half the buffer capacity, to allow double buffering. * * @param builder reference provided by AAudio_createStreamBuilder() * @param numFrames the desired buffer size in frames or AAUDIO_UNSPECIFIED * @param numFrames the desired buffer size in frames or {@link #AAUDIO_UNSPECIFIED} */ AAUDIO_API void AAudioStreamBuilder_setFramesPerDataCallback(AAudioStreamBuilder* builder, int32_t numFrames) __INTRODUCED_IN(26); Loading Loading @@ -913,12 +916,12 @@ AAUDIO_API void AAudioStreamBuilder_setErrorCallback(AAudioStreamBuilder* builde /** * Open a stream based on the options in the StreamBuilder. * * AAudioStream_close must be called when finished with the stream to recover * AAudioStream_close() must be called when finished with the stream to recover * the memory and to free the associated resources. * * @param builder reference provided by AAudio_createStreamBuilder() * @param stream pointer to a variable to receive the new stream reference * @return AAUDIO_OK or a negative error. * @return {@link #AAUDIO_OK} or a negative error. */ AAUDIO_API aaudio_result_t AAudioStreamBuilder_openStream(AAudioStreamBuilder* builder, AAudioStream** stream) __INTRODUCED_IN(26); Loading @@ -927,7 +930,7 @@ AAUDIO_API aaudio_result_t AAudioStreamBuilder_openStream(AAudioStreamBuilder* * Delete the resources associated with the StreamBuilder. * * @param builder reference provided by AAudio_createStreamBuilder() * @return AAUDIO_OK or a negative error. * @return {@link #AAUDIO_OK} or a negative error. */ AAUDIO_API aaudio_result_t AAudioStreamBuilder_delete(AAudioStreamBuilder* builder) __INTRODUCED_IN(26); Loading @@ -940,7 +943,7 @@ AAUDIO_API aaudio_result_t AAudioStreamBuilder_delete(AAudioStreamBuilder* buil * Free the resources associated with a stream created by AAudioStreamBuilder_openStream() * * @param stream reference provided by AAudioStreamBuilder_openStream() * @return AAUDIO_OK or a negative error. * @return {@link #AAUDIO_OK} or a negative error. */ AAUDIO_API aaudio_result_t AAudioStream_close(AAudioStream* stream) __INTRODUCED_IN(26); Loading @@ -948,24 +951,26 @@ AAUDIO_API aaudio_result_t AAudioStream_close(AAudioStream* stream) __INTRODUCE * Asynchronously request to start playing the stream. For output streams, one should * write to the stream to fill the buffer before starting. * Otherwise it will underflow. * After this call the state will be in AAUDIO_STREAM_STATE_STARTING or AAUDIO_STREAM_STATE_STARTED. * After this call the state will be in {@link #AAUDIO_STREAM_STATE_STARTING} or * {@link #AAUDIO_STREAM_STATE_STARTED}. * * @param stream reference provided by AAudioStreamBuilder_openStream() * @return AAUDIO_OK or a negative error. * @return {@link #AAUDIO_OK} or a negative error. */ AAUDIO_API aaudio_result_t AAudioStream_requestStart(AAudioStream* stream) __INTRODUCED_IN(26); /** * Asynchronous request for the stream to pause. * Pausing a stream will freeze the data flow but not flush any buffers. * Use AAudioStream_Start() to resume playback after a pause. * After this call the state will be in AAUDIO_STREAM_STATE_PAUSING or AAUDIO_STREAM_STATE_PAUSED. * Use AAudioStream_requestStart() to resume playback after a pause. * After this call the state will be in {@link #AAUDIO_STREAM_STATE_PAUSING} or * {@link #AAUDIO_STREAM_STATE_PAUSED}. * * This will return AAUDIO_ERROR_UNIMPLEMENTED for input streams. * This will return {@link #AAUDIO_ERROR_UNIMPLEMENTED} for input streams. * For input streams use AAudioStream_requestStop(). * * @param stream reference provided by AAudioStreamBuilder_openStream() * @return AAUDIO_OK or a negative error. * @return {@link #AAUDIO_OK} or a negative error. */ AAUDIO_API aaudio_result_t AAudioStream_requestPause(AAudioStream* stream) __INTRODUCED_IN(26); Loading @@ -974,32 +979,34 @@ AAUDIO_API aaudio_result_t AAudioStream_requestPause(AAudioStream* stream) __IN * Flushing will discard any pending data. * This call only works if the stream is pausing or paused. TODO review * Frame counters are not reset by a flush. They may be advanced. * After this call the state will be in AAUDIO_STREAM_STATE_FLUSHING or AAUDIO_STREAM_STATE_FLUSHED. * After this call the state will be in {@link #AAUDIO_STREAM_STATE_FLUSHING} or * {@link #AAUDIO_STREAM_STATE_FLUSHED}. * * This will return AAUDIO_ERROR_UNIMPLEMENTED for input streams. * This will return {@link #AAUDIO_ERROR_UNIMPLEMENTED} for input streams. * * @param stream reference provided by AAudioStreamBuilder_openStream() * @return AAUDIO_OK or a negative error. * @return {@link #AAUDIO_OK} or a negative error. */ AAUDIO_API aaudio_result_t AAudioStream_requestFlush(AAudioStream* stream) __INTRODUCED_IN(26); /** * Asynchronous request for the stream to stop. * The stream will stop after all of the data currently buffered has been played. * After this call the state will be in AAUDIO_STREAM_STATE_STOPPING or AAUDIO_STREAM_STATE_STOPPED. * After this call the state will be in {@link #AAUDIO_STREAM_STATE_STOPPING} or * {@link #AAUDIO_STREAM_STATE_STOPPED}. * * @param stream reference provided by AAudioStreamBuilder_openStream() * @return AAUDIO_OK or a negative error. * @return {@link #AAUDIO_OK} or a negative error. */ AAUDIO_API aaudio_result_t AAudioStream_requestStop(AAudioStream* stream) __INTRODUCED_IN(26); /** * Query the current state of the client, eg. AAUDIO_STREAM_STATE_PAUSING * Query the current state of the client, eg. {@link #AAUDIO_STREAM_STATE_PAUSING} * * This function will immediately return the state without updating the state. * If you want to update the client state based on the server state then * call AAudioStream_waitForStateChange() with currentState * set to AAUDIO_STREAM_STATE_UNKNOWN and a zero timeout. * set to {@link #AAUDIO_STREAM_STATE_UNKNOWN} and a zero timeout. * * @param stream reference provided by AAudioStreamBuilder_openStream() */ Loading @@ -1025,7 +1032,7 @@ AAUDIO_API aaudio_stream_state_t AAudioStream_getState(AAudioStream* stream) __I * @param inputState The state we want to avoid. * @param nextState Pointer to a variable that will be set to the new state. * @param timeoutNanoseconds Maximum number of nanoseconds to wait for completion. * @return AAUDIO_OK or a negative error. * @return {@link #AAUDIO_OK} or a negative error. */ AAUDIO_API aaudio_result_t AAudioStream_waitForStateChange(AAudioStream* stream, aaudio_stream_state_t inputState, aaudio_stream_state_t *nextState, Loading Loading @@ -1142,17 +1149,17 @@ AAUDIO_API int32_t AAudioStream_getBufferCapacityInFrames(AAudioStream* stream) * This call can be used if the application needs to know the value of numFrames before * the stream is started. This is not normally necessary. * * If a specific size was requested by calling AAudioStreamBuilder_setFramesPerDataCallback() * then this will be the same size. * If a specific size was requested by calling * AAudioStreamBuilder_setFramesPerDataCallback() then this will be the same size. * * If AAudioStreamBuilder_setFramesPerDataCallback() was not called then this will * return the size chosen by AAudio, or AAUDIO_UNSPECIFIED. * return the size chosen by AAudio, or {@link #AAUDIO_UNSPECIFIED}. * * AAUDIO_UNSPECIFIED indicates that the callback buffer size for this stream * {@link #AAUDIO_UNSPECIFIED} indicates that the callback buffer size for this stream * may vary from one dataProc callback to the next. * * @param stream reference provided by AAudioStreamBuilder_openStream() * @return callback buffer size in frames or AAUDIO_UNSPECIFIED * @return callback buffer size in frames or {@link #AAUDIO_UNSPECIFIED} */ AAUDIO_API int32_t AAudioStream_getFramesPerDataCallback(AAudioStream* stream) __INTRODUCED_IN(26); Loading Loading @@ -1262,21 +1269,22 @@ AAUDIO_API int64_t AAudioStream_getFramesRead(AAudioStream* stream) __INTRODUCED * The session ID can be used to associate a stream with effects processors. * The effects are controlled using the Android AudioEffect Java API. * * If AAudioStreamBuilder_setSessionId() was called with AAUDIO_SESSION_ID_ALLOCATE * If AAudioStreamBuilder_setSessionId() was * called with {@link #AAUDIO_SESSION_ID_ALLOCATE} * then a new session ID should be allocated once when the stream is opened. * * If AAudioStreamBuilder_setSessionId() was called with a previously allocated * session ID then that value should be returned. * * If AAudioStreamBuilder_setSessionId() was not called then this function should * return AAUDIO_SESSION_ID_NONE. * return {@link #AAUDIO_SESSION_ID_NONE}. * * The sessionID for a stream should not change once the stream has been opened. * * Added in API level 28. * * @param stream reference provided by AAudioStreamBuilder_openStream() * @return session ID or AAUDIO_SESSION_ID_NONE * @return session ID or {@link #AAUDIO_SESSION_ID_NONE} */ AAUDIO_API aaudio_session_id_t AAudioStream_getSessionId(AAudioStream* stream) __INTRODUCED_IN(28); Loading @@ -1285,11 +1293,11 @@ AAUDIO_API aaudio_session_id_t AAudioStream_getSessionId(AAudioStream* stream) _ * This can be used to synchronize audio with video or MIDI. * It can also be used to align a recorded stream with a playback stream. * * Timestamps are only valid when the stream is in AAUDIO_STREAM_STATE_STARTED. * AAUDIO_ERROR_INVALID_STATE will be returned if the stream is not started. * Timestamps are only valid when the stream is in {@link #AAUDIO_STREAM_STATE_STARTED}. * {@link #AAUDIO_ERROR_INVALID_STATE} will be returned if the stream is not started. * Note that because requestStart() is asynchronous, timestamps will not be valid until * a short time after calling requestStart(). * So AAUDIO_ERROR_INVALID_STATE should not be considered a fatal error. * So {@link #AAUDIO_ERROR_INVALID_STATE} should not be considered a fatal error. * Just try calling again later. * * If an error occurs, then the position and time will not be modified. Loading @@ -1300,7 +1308,7 @@ AAUDIO_API aaudio_session_id_t AAudioStream_getSessionId(AAudioStream* stream) _ * @param clockid CLOCK_MONOTONIC or CLOCK_BOOTTIME * @param framePosition pointer to a variable to receive the position * @param timeNanoseconds pointer to a variable to receive the time * @return AAUDIO_OK or a negative error * @return {@link #AAUDIO_OK} or a negative error */ AAUDIO_API aaudio_result_t AAudioStream_getTimestamp(AAudioStream* stream, clockid_t clockid, int64_t *framePosition, int64_t *timeNanoseconds) __INTRODUCED_IN(26); Loading @@ -1321,7 +1329,7 @@ AAUDIO_API aaudio_usage_t AAudioStream_getUsage(AAudioStream* stream) __INTRODUC * Added in API level 28. * * @param stream reference provided by AAudioStreamBuilder_openStream() * @return content type, for example AAUDIO_CONTENT_TYPE_MUSIC * @return content type, for example {@link #AAUDIO_CONTENT_TYPE_MUSIC} */ AAUDIO_API aaudio_content_type_t AAudioStream_getContentType(AAudioStream* stream) __INTRODUCED_IN(28); Loading @@ -1332,7 +1340,7 @@ AAUDIO_API aaudio_content_type_t AAudioStream_getContentType(AAudioStream* strea * Added in API level 28. * * @param stream reference provided by AAudioStreamBuilder_openStream() * @return input preset, for example AAUDIO_INPUT_PRESET_CAMCORDER * @return input preset, for example {@link #AAUDIO_INPUT_PRESET_CAMCORDER} */ AAUDIO_API aaudio_input_preset_t AAudioStream_getInputPreset(AAudioStream* stream) __INTRODUCED_IN(28); Loading @@ -1344,7 +1352,7 @@ AAUDIO_API aaudio_input_preset_t AAudioStream_getInputPreset(AAudioStream* strea * Added in API level 29. * * @param stream reference provided by AAudioStreamBuilder_openStream() * @return the allowed capture policy, for example AAUDIO_ALLOW_CAPTURE_BY_ALL * @return the allowed capture policy, for example {@link #AAUDIO_ALLOW_CAPTURE_BY_ALL} */ AAUDIO_API aaudio_allowed_capture_policy_t AAudioStream_getAllowedCapturePolicy( AAudioStream* stream) __INTRODUCED_IN(29); Loading Loading
media/libaaudio/include/aaudio/AAudio.h +86 −78 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ extern "C" { /** * This is used to represent a value that has not been specified. * For example, an application could use AAUDIO_UNSPECIFIED to indicate * For example, an application could use {@link #AAUDIO_UNSPECIFIED} to indicate * that is did not not care what the specific value of a parameter was * and would accept whatever it was given. */ Loading Loading @@ -304,8 +304,8 @@ typedef int32_t aaudio_usage_t; /** * The CONTENT_TYPE 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 {@link #AAUDIO_CONTENT_TYPE_MOVIE} for a * movie streaming service or {@link #AAUDIO_CONTENT_TYPE_SPEECH} for * But in case it is known (for instance AAUDIO_CONTENT_TYPE_MOVIE for a * movie streaming service or AAUDIO_CONTENT_TYPE_SPEECH for * an audio book application) this information might be used by the audio framework to * enforce audio focus. * Loading Loading @@ -398,12 +398,12 @@ enum { * Indicates that the audio may be captured by any app. * * For privacy, the following usages can not be recorded: AAUDIO_VOICE_COMMUNICATION*, * AAUDIO_USAGE_NOTIFICATION*, AAUDIO_USAGE_ASSISTANCE* and AAUDIO_USAGE_ASSISTANT. * AAUDIO_USAGE_NOTIFICATION*, AAUDIO_USAGE_ASSISTANCE* and {@link #AAUDIO_USAGE_ASSISTANT}. * * On {@link Android.os.Build.VERSION_CODES.Q}, this means only {@link AAUDIO_USAGE_MEDIA} * and {@link AAUDIO_USAGE_GAME} may be captured. * On {@link android.os.Build.VERSION_CODES#Q}, this means only {@link #AAUDIO_USAGE_MEDIA} * and {@link #AAUDIO_USAGE_GAME} may be captured. * * See {@link android.media.AudioAttributes.ALLOW_CAPTURE_BY_ALL}. * See {@link android.media.AudioAttributes#ALLOW_CAPTURE_BY_ALL}. */ AAUDIO_ALLOW_CAPTURE_BY_ALL = 1, /** Loading @@ -411,16 +411,16 @@ enum { * * System apps can capture for many purposes like accessibility, user guidance... * but have strong restriction. See * {@link android.media.AudioAttributes.ALLOW_CAPTURE_BY_SYSTEM} for what the system apps * {@link android.media.AudioAttributes#ALLOW_CAPTURE_BY_SYSTEM} for what the system apps * can do with the capture audio. */ AAUDIO_ALLOW_CAPTURE_BY_SYSTEM = 2, /** * Indicates that the audio may not be recorded by any app, even if it is a system app. * * It is encouraged to use {@link ALLOW_CAPTURE_BY_SYSTEM} instead of this value as system apps * It is encouraged to use {@link #AAUDIO_ALLOW_CAPTURE_BY_SYSTEM} instead of this value as system apps * provide significant and useful features for the user (eg. accessibility). * See {@link android.media.AudioAttributes.ALLOW_CAPTURE_BY_NONE}. * See {@link android.media.AudioAttributes#ALLOW_CAPTURE_BY_NONE}. */ AAUDIO_ALLOW_CAPTURE_BY_NONE = 3, }; Loading Loading @@ -496,8 +496,8 @@ AAUDIO_API const char * AAudio_convertStreamStateToText(aaudio_stream_state_t st * * The deviceId is initially unspecified, meaning that the current default device will be used. * * The default direction is AAUDIO_DIRECTION_OUTPUT. * The default sharing mode is AAUDIO_SHARING_MODE_SHARED. * The default direction is {@link #AAUDIO_DIRECTION_OUTPUT}. * The default sharing mode is {@link #AAUDIO_SHARING_MODE_SHARED}. * The data format, samplesPerFrames and sampleRate are unspecified and will be * chosen by the device when it is opened. * Loading @@ -522,7 +522,7 @@ AAUDIO_API void AAudioStreamBuilder_setDeviceId(AAudioStreamBuilder* builder, /** * Request a sample rate in Hertz. * * The default, if you do not call this function, is AAUDIO_UNSPECIFIED. * The default, if you do not call this function, is {@link #AAUDIO_UNSPECIFIED}. * An optimal value will then be chosen when the stream is opened. * After opening a stream with an unspecified value, the application must * query for the actual value, which may vary by device. Loading @@ -539,7 +539,7 @@ AAUDIO_API void AAudioStreamBuilder_setSampleRate(AAudioStreamBuilder* builder, /** * Request a number of channels for the stream. * * The default, if you do not call this function, is AAUDIO_UNSPECIFIED. * The default, if you do not call this function, is {@link #AAUDIO_UNSPECIFIED}. * An optimal value will then be chosen when the stream is opened. * After opening a stream with an unspecified value, the application must * query for the actual value, which may vary by device. Loading @@ -563,9 +563,9 @@ AAUDIO_API void AAudioStreamBuilder_setSamplesPerFrame(AAudioStreamBuilder* buil int32_t samplesPerFrame) __INTRODUCED_IN(26); /** * Request a sample data format, for example AAUDIO_FORMAT_PCM_I16. * Request a sample data format, for example {@link #AAUDIO_FORMAT_PCM_I16}. * * The default, if you do not call this function, is AAUDIO_UNSPECIFIED. * The default, if you do not call this function, is {@link #AAUDIO_UNSPECIFIED}. * An optimal value will then be chosen when the stream is opened. * After opening a stream with an unspecified value, the application must * query for the actual value, which may vary by device. Loading @@ -574,7 +574,8 @@ AAUDIO_API void AAudioStreamBuilder_setSamplesPerFrame(AAudioStreamBuilder* buil * If a stream cannot be opened with the specified value then the open will fail. * * @param builder reference provided by AAudio_createStreamBuilder() * @param format common formats are AAUDIO_FORMAT_PCM_FLOAT and AAUDIO_FORMAT_PCM_I16. * @param format common formats are {@link #AAUDIO_FORMAT_PCM_FLOAT} and * {@link #AAUDIO_FORMAT_PCM_I16}. */ AAUDIO_API void AAudioStreamBuilder_setFormat(AAudioStreamBuilder* builder, aaudio_format_t format) __INTRODUCED_IN(26); Loading @@ -582,13 +583,13 @@ AAUDIO_API void AAudioStreamBuilder_setFormat(AAudioStreamBuilder* builder, /** * Request a mode for sharing the device. * * The default, if you do not call this function, is AAUDIO_SHARING_MODE_SHARED. * The default, if you do not call this function, is {@link #AAUDIO_SHARING_MODE_SHARED}. * * The requested sharing mode may not be available. * The application can query for the actual mode after the stream is opened. * * @param builder reference provided by AAudio_createStreamBuilder() * @param sharingMode AAUDIO_SHARING_MODE_SHARED or AAUDIO_SHARING_MODE_EXCLUSIVE * @param sharingMode {@link #AAUDIO_SHARING_MODE_SHARED} or {@link #AAUDIO_SHARING_MODE_EXCLUSIVE} */ AAUDIO_API void AAudioStreamBuilder_setSharingMode(AAudioStreamBuilder* builder, aaudio_sharing_mode_t sharingMode) __INTRODUCED_IN(26); Loading @@ -596,10 +597,10 @@ AAUDIO_API void AAudioStreamBuilder_setSharingMode(AAudioStreamBuilder* builder, /** * Request the direction for a stream. * * The default, if you do not call this function, is AAUDIO_DIRECTION_OUTPUT. * The default, if you do not call this function, is {@link #AAUDIO_DIRECTION_OUTPUT}. * * @param builder reference provided by AAudio_createStreamBuilder() * @param direction AAUDIO_DIRECTION_OUTPUT or AAUDIO_DIRECTION_INPUT * @param direction {@link #AAUDIO_DIRECTION_OUTPUT} or {@link #AAUDIO_DIRECTION_INPUT} */ AAUDIO_API void AAudioStreamBuilder_setDirection(AAudioStreamBuilder* builder, aaudio_direction_t direction) __INTRODUCED_IN(26); Loading @@ -608,10 +609,10 @@ AAUDIO_API void AAudioStreamBuilder_setDirection(AAudioStreamBuilder* builder, * Set the requested buffer capacity in frames. * The final AAudioStream capacity may differ, but will probably be at least this big. * * The default, if you do not call this function, is AAUDIO_UNSPECIFIED. * The default, if you do not call this function, is {@link #AAUDIO_UNSPECIFIED}. * * @param builder reference provided by AAudio_createStreamBuilder() * @param numFrames the desired buffer capacity in frames or AAUDIO_UNSPECIFIED * @param numFrames the desired buffer capacity in frames or {@link #AAUDIO_UNSPECIFIED} */ AAUDIO_API void AAudioStreamBuilder_setBufferCapacityInFrames(AAudioStreamBuilder* builder, int32_t numFrames) __INTRODUCED_IN(26); Loading @@ -619,16 +620,17 @@ AAUDIO_API void AAudioStreamBuilder_setBufferCapacityInFrames(AAudioStreamBuilde /** * Set the requested performance mode. * * Supported modes are AAUDIO_PERFORMANCE_MODE_NONE, AAUDIO_PERFORMANCE_MODE_POWER_SAVING * and AAUDIO_PERFORMANCE_MODE_LOW_LATENCY. * Supported modes are {@link #AAUDIO_PERFORMANCE_MODE_NONE}, * {@link #AAUDIO_PERFORMANCE_MODE_POWER_SAVING} * and {@link #AAUDIO_PERFORMANCE_MODE_LOW_LATENCY}. * * The default, if you do not call this function, is AAUDIO_PERFORMANCE_MODE_NONE. * The default, if you do not call this function, is {@link #AAUDIO_PERFORMANCE_MODE_NONE}. * * You may not get the mode you requested. * You can call AAudioStream_getPerformanceMode() to find out the final mode for the stream. * You can call AAudioStream_getPerformanceMode() * to find out the final mode for the stream. * * @param builder reference provided by AAudio_createStreamBuilder() * @param mode the desired performance mode, eg. AAUDIO_PERFORMANCE_MODE_LOW_LATENCY * @param mode the desired performance mode, eg. {@link #AAUDIO_PERFORMANCE_MODE_LOW_LATENCY} */ AAUDIO_API void AAudioStreamBuilder_setPerformanceMode(AAudioStreamBuilder* builder, aaudio_performance_mode_t mode) __INTRODUCED_IN(26); Loading @@ -640,12 +642,12 @@ AAUDIO_API void AAudioStreamBuilder_setPerformanceMode(AAudioStreamBuilder* buil * behavior of the stream. * This could, for example, affect how volume and focus is handled for the stream. * * The default, if you do not call this function, is AAUDIO_USAGE_MEDIA. * The default, if you do not call this function, is {@link #AAUDIO_USAGE_MEDIA}. * * Added in API level 28. * * @param builder reference provided by AAudio_createStreamBuilder() * @param usage the desired usage, eg. AAUDIO_USAGE_GAME * @param usage the desired usage, eg. {@link #AAUDIO_USAGE_GAME} */ AAUDIO_API void AAudioStreamBuilder_setUsage(AAudioStreamBuilder* builder, aaudio_usage_t usage) __INTRODUCED_IN(28); Loading @@ -657,12 +659,12 @@ AAUDIO_API void AAudioStreamBuilder_setUsage(AAudioStreamBuilder* builder, * behavior of the stream. * This could, for example, affect whether a stream is paused when a notification occurs. * * The default, if you do not call this function, is AAUDIO_CONTENT_TYPE_MUSIC. * The default, if you do not call this function, is {@link #AAUDIO_CONTENT_TYPE_MUSIC}. * * Added in API level 28. * * @param builder reference provided by AAudio_createStreamBuilder() * @param contentType the type of audio data, eg. AAUDIO_CONTENT_TYPE_SPEECH * @param contentType the type of audio data, eg. {@link #AAUDIO_CONTENT_TYPE_SPEECH} */ AAUDIO_API void AAudioStreamBuilder_setContentType(AAudioStreamBuilder* builder, aaudio_content_type_t contentType) __INTRODUCED_IN(28); Loading @@ -675,7 +677,7 @@ AAUDIO_API void AAudioStreamBuilder_setContentType(AAudioStreamBuilder* builder, * This could, for example, affect which microphones are used and how the * recorded data is processed. * * The default, if you do not call this function, is AAUDIO_INPUT_PRESET_VOICE_RECOGNITION. * The default, if you do not call this function, is {@link #AAUDIO_INPUT_PRESET_VOICE_RECOGNITION}. * That is because VOICE_RECOGNITION is the preset with the lowest latency * on many platforms. * Loading @@ -690,10 +692,10 @@ AAUDIO_API void AAudioStreamBuilder_setInputPreset(AAudioStreamBuilder* builder, /** * Specify whether this stream audio may or may not be captured by other apps or the system. * * The default is AAUDIO_ALLOW_CAPTURE_BY_ALL. * The default is {@link #AAUDIO_ALLOW_CAPTURE_BY_ALL}. * * Note that an application can also set its global policy, in which case the most restrictive * policy is always applied. See {@link android.media.AudioAttributes.setAllowedCapturePolicy} * policy is always applied. See {@link android.media.AudioAttributes#setAllowedCapturePolicy(int)} * * Added in API level 29. * Loading @@ -708,9 +710,9 @@ AAUDIO_API void AAudioStreamBuilder_setAllowedCapturePolicy(AAudioStreamBuilder* * The session ID can be used to associate a stream with effects processors. * The effects are controlled using the Android AudioEffect Java API. * * The default, if you do not call this function, is AAUDIO_SESSION_ID_NONE. * The default, if you do not call this function, is {@link #AAUDIO_SESSION_ID_NONE}. * * If set to AAUDIO_SESSION_ID_ALLOCATE then a session ID will be allocated * If set to {@link #AAUDIO_SESSION_ID_ALLOCATE} then a session ID will be allocated * when the stream is opened. * * The allocated session ID can be obtained by calling AAudioStream_getSessionId() Loading @@ -728,7 +730,7 @@ AAUDIO_API void AAudioStreamBuilder_setAllowedCapturePolicy(AAudioStreamBuilder* * Added in API level 28. * * @param builder reference provided by AAudio_createStreamBuilder() * @param sessionId an allocated sessionID or AAUDIO_SESSION_ID_ALLOCATE * @param sessionId an allocated sessionID or {@link #AAUDIO_SESSION_ID_ALLOCATE} */ AAUDIO_API void AAudioStreamBuilder_setSessionId(AAudioStreamBuilder* builder, aaudio_session_id_t sessionId) __INTRODUCED_IN(28); Loading Loading @@ -811,15 +813,16 @@ typedef aaudio_data_callback_result_t (*AAudioStream_dataCallback)( * * Note that when using this callback, the audio data will be passed in or out * of the function as an argument. * So you cannot call AAudioStream_write() or AAudioStream_read() on the same stream * that has an active data callback. * So you cannot call AAudioStream_write() or AAudioStream_read() * on the same stream that has an active data callback. * * The callback function will start being called after AAudioStream_requestStart() is called. * The callback function will start being called after AAudioStream_requestStart() * is called. * It will stop being called after AAudioStream_requestPause() or * AAudioStream_requestStop() is called. * * This callback function will be called on a real-time thread owned by AAudio. See * {@link AAudioStream_dataCallback} for more information. * {@link #AAudioStream_dataCallback} for more information. * * Note that the AAudio callbacks will never be called simultaneously from multiple threads. * Loading @@ -833,9 +836,9 @@ AAUDIO_API void AAudioStreamBuilder_setDataCallback(AAudioStreamBuilder* builder /** * Set the requested data callback buffer size in frames. * See {@link AAudioStream_dataCallback}. * See {@link #AAudioStream_dataCallback}. * * The default, if you do not call this function, is AAUDIO_UNSPECIFIED. * The default, if you do not call this function, is {@link #AAUDIO_UNSPECIFIED}. * * For the lowest possible latency, do not call this function. AAudio will then * call the dataProc callback function with whatever size is optimal. Loading @@ -852,7 +855,7 @@ AAUDIO_API void AAudioStreamBuilder_setDataCallback(AAudioStreamBuilder* builder * half the buffer capacity, to allow double buffering. * * @param builder reference provided by AAudio_createStreamBuilder() * @param numFrames the desired buffer size in frames or AAUDIO_UNSPECIFIED * @param numFrames the desired buffer size in frames or {@link #AAUDIO_UNSPECIFIED} */ AAUDIO_API void AAudioStreamBuilder_setFramesPerDataCallback(AAudioStreamBuilder* builder, int32_t numFrames) __INTRODUCED_IN(26); Loading Loading @@ -913,12 +916,12 @@ AAUDIO_API void AAudioStreamBuilder_setErrorCallback(AAudioStreamBuilder* builde /** * Open a stream based on the options in the StreamBuilder. * * AAudioStream_close must be called when finished with the stream to recover * AAudioStream_close() must be called when finished with the stream to recover * the memory and to free the associated resources. * * @param builder reference provided by AAudio_createStreamBuilder() * @param stream pointer to a variable to receive the new stream reference * @return AAUDIO_OK or a negative error. * @return {@link #AAUDIO_OK} or a negative error. */ AAUDIO_API aaudio_result_t AAudioStreamBuilder_openStream(AAudioStreamBuilder* builder, AAudioStream** stream) __INTRODUCED_IN(26); Loading @@ -927,7 +930,7 @@ AAUDIO_API aaudio_result_t AAudioStreamBuilder_openStream(AAudioStreamBuilder* * Delete the resources associated with the StreamBuilder. * * @param builder reference provided by AAudio_createStreamBuilder() * @return AAUDIO_OK or a negative error. * @return {@link #AAUDIO_OK} or a negative error. */ AAUDIO_API aaudio_result_t AAudioStreamBuilder_delete(AAudioStreamBuilder* builder) __INTRODUCED_IN(26); Loading @@ -940,7 +943,7 @@ AAUDIO_API aaudio_result_t AAudioStreamBuilder_delete(AAudioStreamBuilder* buil * Free the resources associated with a stream created by AAudioStreamBuilder_openStream() * * @param stream reference provided by AAudioStreamBuilder_openStream() * @return AAUDIO_OK or a negative error. * @return {@link #AAUDIO_OK} or a negative error. */ AAUDIO_API aaudio_result_t AAudioStream_close(AAudioStream* stream) __INTRODUCED_IN(26); Loading @@ -948,24 +951,26 @@ AAUDIO_API aaudio_result_t AAudioStream_close(AAudioStream* stream) __INTRODUCE * Asynchronously request to start playing the stream. For output streams, one should * write to the stream to fill the buffer before starting. * Otherwise it will underflow. * After this call the state will be in AAUDIO_STREAM_STATE_STARTING or AAUDIO_STREAM_STATE_STARTED. * After this call the state will be in {@link #AAUDIO_STREAM_STATE_STARTING} or * {@link #AAUDIO_STREAM_STATE_STARTED}. * * @param stream reference provided by AAudioStreamBuilder_openStream() * @return AAUDIO_OK or a negative error. * @return {@link #AAUDIO_OK} or a negative error. */ AAUDIO_API aaudio_result_t AAudioStream_requestStart(AAudioStream* stream) __INTRODUCED_IN(26); /** * Asynchronous request for the stream to pause. * Pausing a stream will freeze the data flow but not flush any buffers. * Use AAudioStream_Start() to resume playback after a pause. * After this call the state will be in AAUDIO_STREAM_STATE_PAUSING or AAUDIO_STREAM_STATE_PAUSED. * Use AAudioStream_requestStart() to resume playback after a pause. * After this call the state will be in {@link #AAUDIO_STREAM_STATE_PAUSING} or * {@link #AAUDIO_STREAM_STATE_PAUSED}. * * This will return AAUDIO_ERROR_UNIMPLEMENTED for input streams. * This will return {@link #AAUDIO_ERROR_UNIMPLEMENTED} for input streams. * For input streams use AAudioStream_requestStop(). * * @param stream reference provided by AAudioStreamBuilder_openStream() * @return AAUDIO_OK or a negative error. * @return {@link #AAUDIO_OK} or a negative error. */ AAUDIO_API aaudio_result_t AAudioStream_requestPause(AAudioStream* stream) __INTRODUCED_IN(26); Loading @@ -974,32 +979,34 @@ AAUDIO_API aaudio_result_t AAudioStream_requestPause(AAudioStream* stream) __IN * Flushing will discard any pending data. * This call only works if the stream is pausing or paused. TODO review * Frame counters are not reset by a flush. They may be advanced. * After this call the state will be in AAUDIO_STREAM_STATE_FLUSHING or AAUDIO_STREAM_STATE_FLUSHED. * After this call the state will be in {@link #AAUDIO_STREAM_STATE_FLUSHING} or * {@link #AAUDIO_STREAM_STATE_FLUSHED}. * * This will return AAUDIO_ERROR_UNIMPLEMENTED for input streams. * This will return {@link #AAUDIO_ERROR_UNIMPLEMENTED} for input streams. * * @param stream reference provided by AAudioStreamBuilder_openStream() * @return AAUDIO_OK or a negative error. * @return {@link #AAUDIO_OK} or a negative error. */ AAUDIO_API aaudio_result_t AAudioStream_requestFlush(AAudioStream* stream) __INTRODUCED_IN(26); /** * Asynchronous request for the stream to stop. * The stream will stop after all of the data currently buffered has been played. * After this call the state will be in AAUDIO_STREAM_STATE_STOPPING or AAUDIO_STREAM_STATE_STOPPED. * After this call the state will be in {@link #AAUDIO_STREAM_STATE_STOPPING} or * {@link #AAUDIO_STREAM_STATE_STOPPED}. * * @param stream reference provided by AAudioStreamBuilder_openStream() * @return AAUDIO_OK or a negative error. * @return {@link #AAUDIO_OK} or a negative error. */ AAUDIO_API aaudio_result_t AAudioStream_requestStop(AAudioStream* stream) __INTRODUCED_IN(26); /** * Query the current state of the client, eg. AAUDIO_STREAM_STATE_PAUSING * Query the current state of the client, eg. {@link #AAUDIO_STREAM_STATE_PAUSING} * * This function will immediately return the state without updating the state. * If you want to update the client state based on the server state then * call AAudioStream_waitForStateChange() with currentState * set to AAUDIO_STREAM_STATE_UNKNOWN and a zero timeout. * set to {@link #AAUDIO_STREAM_STATE_UNKNOWN} and a zero timeout. * * @param stream reference provided by AAudioStreamBuilder_openStream() */ Loading @@ -1025,7 +1032,7 @@ AAUDIO_API aaudio_stream_state_t AAudioStream_getState(AAudioStream* stream) __I * @param inputState The state we want to avoid. * @param nextState Pointer to a variable that will be set to the new state. * @param timeoutNanoseconds Maximum number of nanoseconds to wait for completion. * @return AAUDIO_OK or a negative error. * @return {@link #AAUDIO_OK} or a negative error. */ AAUDIO_API aaudio_result_t AAudioStream_waitForStateChange(AAudioStream* stream, aaudio_stream_state_t inputState, aaudio_stream_state_t *nextState, Loading Loading @@ -1142,17 +1149,17 @@ AAUDIO_API int32_t AAudioStream_getBufferCapacityInFrames(AAudioStream* stream) * This call can be used if the application needs to know the value of numFrames before * the stream is started. This is not normally necessary. * * If a specific size was requested by calling AAudioStreamBuilder_setFramesPerDataCallback() * then this will be the same size. * If a specific size was requested by calling * AAudioStreamBuilder_setFramesPerDataCallback() then this will be the same size. * * If AAudioStreamBuilder_setFramesPerDataCallback() was not called then this will * return the size chosen by AAudio, or AAUDIO_UNSPECIFIED. * return the size chosen by AAudio, or {@link #AAUDIO_UNSPECIFIED}. * * AAUDIO_UNSPECIFIED indicates that the callback buffer size for this stream * {@link #AAUDIO_UNSPECIFIED} indicates that the callback buffer size for this stream * may vary from one dataProc callback to the next. * * @param stream reference provided by AAudioStreamBuilder_openStream() * @return callback buffer size in frames or AAUDIO_UNSPECIFIED * @return callback buffer size in frames or {@link #AAUDIO_UNSPECIFIED} */ AAUDIO_API int32_t AAudioStream_getFramesPerDataCallback(AAudioStream* stream) __INTRODUCED_IN(26); Loading Loading @@ -1262,21 +1269,22 @@ AAUDIO_API int64_t AAudioStream_getFramesRead(AAudioStream* stream) __INTRODUCED * The session ID can be used to associate a stream with effects processors. * The effects are controlled using the Android AudioEffect Java API. * * If AAudioStreamBuilder_setSessionId() was called with AAUDIO_SESSION_ID_ALLOCATE * If AAudioStreamBuilder_setSessionId() was * called with {@link #AAUDIO_SESSION_ID_ALLOCATE} * then a new session ID should be allocated once when the stream is opened. * * If AAudioStreamBuilder_setSessionId() was called with a previously allocated * session ID then that value should be returned. * * If AAudioStreamBuilder_setSessionId() was not called then this function should * return AAUDIO_SESSION_ID_NONE. * return {@link #AAUDIO_SESSION_ID_NONE}. * * The sessionID for a stream should not change once the stream has been opened. * * Added in API level 28. * * @param stream reference provided by AAudioStreamBuilder_openStream() * @return session ID or AAUDIO_SESSION_ID_NONE * @return session ID or {@link #AAUDIO_SESSION_ID_NONE} */ AAUDIO_API aaudio_session_id_t AAudioStream_getSessionId(AAudioStream* stream) __INTRODUCED_IN(28); Loading @@ -1285,11 +1293,11 @@ AAUDIO_API aaudio_session_id_t AAudioStream_getSessionId(AAudioStream* stream) _ * This can be used to synchronize audio with video or MIDI. * It can also be used to align a recorded stream with a playback stream. * * Timestamps are only valid when the stream is in AAUDIO_STREAM_STATE_STARTED. * AAUDIO_ERROR_INVALID_STATE will be returned if the stream is not started. * Timestamps are only valid when the stream is in {@link #AAUDIO_STREAM_STATE_STARTED}. * {@link #AAUDIO_ERROR_INVALID_STATE} will be returned if the stream is not started. * Note that because requestStart() is asynchronous, timestamps will not be valid until * a short time after calling requestStart(). * So AAUDIO_ERROR_INVALID_STATE should not be considered a fatal error. * So {@link #AAUDIO_ERROR_INVALID_STATE} should not be considered a fatal error. * Just try calling again later. * * If an error occurs, then the position and time will not be modified. Loading @@ -1300,7 +1308,7 @@ AAUDIO_API aaudio_session_id_t AAudioStream_getSessionId(AAudioStream* stream) _ * @param clockid CLOCK_MONOTONIC or CLOCK_BOOTTIME * @param framePosition pointer to a variable to receive the position * @param timeNanoseconds pointer to a variable to receive the time * @return AAUDIO_OK or a negative error * @return {@link #AAUDIO_OK} or a negative error */ AAUDIO_API aaudio_result_t AAudioStream_getTimestamp(AAudioStream* stream, clockid_t clockid, int64_t *framePosition, int64_t *timeNanoseconds) __INTRODUCED_IN(26); Loading @@ -1321,7 +1329,7 @@ AAUDIO_API aaudio_usage_t AAudioStream_getUsage(AAudioStream* stream) __INTRODUC * Added in API level 28. * * @param stream reference provided by AAudioStreamBuilder_openStream() * @return content type, for example AAUDIO_CONTENT_TYPE_MUSIC * @return content type, for example {@link #AAUDIO_CONTENT_TYPE_MUSIC} */ AAUDIO_API aaudio_content_type_t AAudioStream_getContentType(AAudioStream* stream) __INTRODUCED_IN(28); Loading @@ -1332,7 +1340,7 @@ AAUDIO_API aaudio_content_type_t AAudioStream_getContentType(AAudioStream* strea * Added in API level 28. * * @param stream reference provided by AAudioStreamBuilder_openStream() * @return input preset, for example AAUDIO_INPUT_PRESET_CAMCORDER * @return input preset, for example {@link #AAUDIO_INPUT_PRESET_CAMCORDER} */ AAUDIO_API aaudio_input_preset_t AAudioStream_getInputPreset(AAudioStream* stream) __INTRODUCED_IN(28); Loading @@ -1344,7 +1352,7 @@ AAUDIO_API aaudio_input_preset_t AAudioStream_getInputPreset(AAudioStream* strea * Added in API level 29. * * @param stream reference provided by AAudioStreamBuilder_openStream() * @return the allowed capture policy, for example AAUDIO_ALLOW_CAPTURE_BY_ALL * @return the allowed capture policy, for example {@link #AAUDIO_ALLOW_CAPTURE_BY_ALL} */ AAUDIO_API aaudio_allowed_capture_policy_t AAudioStream_getAllowedCapturePolicy( AAudioStream* stream) __INTRODUCED_IN(29); Loading