libaaudio: changes for API council
Removed typedefs like aaudio_sample_rate_t
Removed use of handles. Just pass back opaque pointers.
Simplified gettersi in Stream.
Removed getters from Builder.
Update libaaudio.map.txt
Test: CTS test_aaudio.cpp
Change-Id: I63eaec3e5a8ecc516cfc1f950f4b4f54df1bd518
Signed-off-by: Phil Burk <philburk@google.com>
diff --git a/media/libaaudio/include/aaudio/AAudio.h b/media/libaaudio/include/aaudio/AAudio.h
index dad5285..43b5205 100644
--- a/media/libaaudio/include/aaudio/AAudio.h
+++ b/media/libaaudio/include/aaudio/AAudio.h
@@ -20,21 +20,21 @@
#ifndef AAUDIO_AAUDIO_H
#define AAUDIO_AAUDIO_H
+#include <time.h>
#include "AAudioDefinitions.h"
#ifdef __cplusplus
extern "C" {
#endif
-typedef aaudio_handle_t AAudioStream;
-typedef aaudio_handle_t AAudioStreamBuilder;
+typedef struct AAudioStreamStruct * AAudioStream;
+typedef struct AAudioStreamBuilderStruct * AAudioStreamBuilder;
-#define AAUDIO_STREAM_NONE ((AAudioStream)AAUDIO_HANDLE_INVALID)
-#define AAUDIO_STREAM_BUILDER_NONE ((AAudioStreamBuilder)AAUDIO_HANDLE_INVALID)
+#define AAUDIO_STREAM_NONE ((AAudioStream)nullptr)
+#define AAUDIO_STREAM_BUILDER_NONE ((AAudioStreamBuilder)nullptr)
-/* AAUDIO_API will probably get defined in a Makefile for a specific platform. */
#ifndef AAUDIO_API
-#define AAUDIO_API /* for exporting symbols */
+#define AAUDIO_API /* export this symbol */
#endif
// ============================================================
@@ -42,11 +42,6 @@
// ============================================================
/**
- * @return time in the same clock domain as the timestamps
- */
-AAUDIO_API aaudio_nanoseconds_t AAudio_getNanoseconds(aaudio_clockid_t clockid);
-
-/**
* The text is the ASCII symbol corresponding to the returnCode,
* or an English message saying the returnCode is unrecognized.
* This is intended for developers to use when debugging.
@@ -76,7 +71,7 @@
* 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_LEGACY.
+ * The default sharing mode is AAUDIO_SHARING_MODE_SHARED.
* The data format, samplesPerFrames and sampleRate are unspecified and will be
* chosen by the device when it is opened.
*
@@ -86,23 +81,15 @@
/**
* Request an audio device identified device using an ID.
- * The ID is platform specific.
* On Android, for example, the ID could be obtained from the Java AudioManager.
*
* By default, the primary device will be used.
*
- * @param builder handle provided by AAudio_createStreamBuilder()
- * @param deviceId platform specific identifier or AAUDIO_DEVICE_UNSPECIFIED
- * @return AAUDIO_OK or a negative error.
+ * @param builder reference provided by AAudio_createStreamBuilder()
+ * @param deviceId device identifier or AAUDIO_DEVICE_UNSPECIFIED
*/
-AAUDIO_API aaudio_result_t AAudioStreamBuilder_setDeviceId(AAudioStreamBuilder builder,
- aaudio_device_id_t deviceId);
-/**
- * Passes back requested device ID.
- * @return AAUDIO_OK or a negative error.
- */
-AAUDIO_API aaudio_result_t AAudioStreamBuilder_getDeviceId(AAudioStreamBuilder builder,
- aaudio_device_id_t *deviceId);
+AAUDIO_API void AAudioStreamBuilder_setDeviceId(AAudioStreamBuilder builder,
+ int32_t deviceId);
/**
* Request a sample rate in Hz.
@@ -114,19 +101,10 @@
* But it is traditionally called "sample rate". Se we use that term.
*
* Default is AAUDIO_UNSPECIFIED.
- *
- * @return AAUDIO_OK or a negative error.
- */
-AAUDIO_API aaudio_result_t AAudioStreamBuilder_setSampleRate(AAudioStreamBuilder builder,
- aaudio_sample_rate_t sampleRate);
-/**
- * Returns sample rate in Hertz (samples per second).
- * @return AAUDIO_OK or a negative error.
*/
-AAUDIO_API aaudio_result_t AAudioStreamBuilder_getSampleRate(AAudioStreamBuilder builder,
- aaudio_sample_rate_t *sampleRate);
-
+AAUDIO_API void AAudioStreamBuilder_setSampleRate(AAudioStreamBuilder builder,
+ int32_t sampleRate);
/**
* Request a number of samples per frame.
@@ -136,98 +114,48 @@
* Default is AAUDIO_UNSPECIFIED.
*
* Note, this quantity is sometimes referred to as "channel count".
- *
- * @return AAUDIO_OK or a negative error.
*/
-AAUDIO_API aaudio_result_t AAudioStreamBuilder_setSamplesPerFrame(AAudioStreamBuilder builder,
+AAUDIO_API void AAudioStreamBuilder_setSamplesPerFrame(AAudioStreamBuilder builder,
int32_t samplesPerFrame);
/**
- * Note, this quantity is sometimes referred to as "channel count".
- *
- * @param builder handle provided by AAudio_createStreamBuilder()
- * @param samplesPerFrame pointer to a variable to be set to samplesPerFrame.
- * @return AAUDIO_OK or a negative error.
- */
-AAUDIO_API aaudio_result_t AAudioStreamBuilder_getSamplesPerFrame(AAudioStreamBuilder builder,
- int32_t *samplesPerFrame);
-
-
-/**
* Request a sample data format, for example AAUDIO_FORMAT_PCM_I16.
* The application should query for the actual format after the stream is opened.
- *
- * @return AAUDIO_OK or a negative error.
*/
-AAUDIO_API aaudio_result_t AAudioStreamBuilder_setFormat(AAudioStreamBuilder builder,
+AAUDIO_API void AAudioStreamBuilder_setFormat(AAudioStreamBuilder builder,
aaudio_audio_format_t format);
/**
- * @return AAUDIO_OK or a negative error.
- */
-AAUDIO_API aaudio_result_t AAudioStreamBuilder_getFormat(AAudioStreamBuilder builder,
- aaudio_audio_format_t *format);
-
-/**
* Request a mode for sharing the device.
* The requested sharing mode may not be available.
* So the application should query for the actual mode after the stream is opened.
*
- * @param builder handle provided by AAudio_createStreamBuilder()
+ * @param builder reference provided by AAudio_createStreamBuilder()
* @param sharingMode AAUDIO_SHARING_MODE_LEGACY or AAUDIO_SHARING_MODE_EXCLUSIVE
- * @return AAUDIO_OK or a negative error.
*/
-AAUDIO_API aaudio_result_t AAudioStreamBuilder_setSharingMode(AAudioStreamBuilder builder,
+AAUDIO_API void AAudioStreamBuilder_setSharingMode(AAudioStreamBuilder builder,
aaudio_sharing_mode_t sharingMode);
/**
- * Return requested sharing mode.
- * @return AAUDIO_OK or a negative error
- */
-AAUDIO_API aaudio_result_t AAudioStreamBuilder_getSharingMode(AAudioStreamBuilder builder,
- aaudio_sharing_mode_t *sharingMode);
-
-/**
* Request the direction for a stream. The default is AAUDIO_DIRECTION_OUTPUT.
*
- * @param builder handle provided by AAudio_createStreamBuilder()
+ * @param builder reference provided by AAudio_createStreamBuilder()
* @param direction AAUDIO_DIRECTION_OUTPUT or AAUDIO_DIRECTION_INPUT
- * @return AAUDIO_OK or a negative error.
*/
-AAUDIO_API aaudio_result_t AAudioStreamBuilder_setDirection(AAudioStreamBuilder builder,
+AAUDIO_API void AAudioStreamBuilder_setDirection(AAudioStreamBuilder builder,
aaudio_direction_t direction);
/**
- * @param builder handle provided by AAudio_createStreamBuilder()
- * @param direction pointer to a variable to be set to the currently requested direction.
- * @return AAUDIO_OK or a negative error.
- */
-AAUDIO_API aaudio_result_t AAudioStreamBuilder_getDirection(AAudioStreamBuilder builder,
- aaudio_direction_t *direction);
-
-/**
* Set the requested maximum buffer capacity in frames.
* The final AAudioStream capacity may differ, but will probably be at least this big.
*
* Default is AAUDIO_UNSPECIFIED.
*
- * @param builder handle provided by AAudio_createStreamBuilder()
+ * @param builder reference provided by AAudio_createStreamBuilder()
* @param frames the desired buffer capacity in frames or AAUDIO_UNSPECIFIED
- * @return AAUDIO_OK or a negative error.
*/
-AAUDIO_API aaudio_result_t AAudioStreamBuilder_setBufferCapacity(AAudioStreamBuilder builder,
- aaudio_size_frames_t frames);
-
-/**
- * Query the requested maximum buffer capacity in frames that was passed to
- * AAudioStreamBuilder_setBufferCapacity().
- *
- * @param builder handle provided by AAudio_createStreamBuilder()
- * @param frames pointer to variable to receive the requested buffer capacity
- * @return AAUDIO_OK or a negative error.
- */
-AAUDIO_API aaudio_result_t AAudioStreamBuilder_getBufferCapacity(AAudioStreamBuilder builder,
- aaudio_size_frames_t *frames);
+AAUDIO_API void AAudioStreamBuilder_setBufferCapacityInFrames(AAudioStreamBuilder builder,
+ int32_t frames);
/**
* Open a stream based on the options in the StreamBuilder.
@@ -235,8 +163,8 @@
* AAudioStream_close must be called when finished with the stream to recover
* the memory and to free the associated resources.
*
- * @param builder handle provided by AAudio_createStreamBuilder()
- * @param stream pointer to a variable to receive the new stream handle
+ * @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.
*/
AAUDIO_API aaudio_result_t AAudioStreamBuilder_openStream(AAudioStreamBuilder builder,
@@ -245,7 +173,7 @@
/**
* Delete the resources associated with the StreamBuilder.
*
- * @param builder handle provided by AAudio_createStreamBuilder()
+ * @param builder reference provided by AAudio_createStreamBuilder()
* @return AAUDIO_OK or a negative error.
*/
AAUDIO_API aaudio_result_t AAudioStreamBuilder_delete(AAudioStreamBuilder builder);
@@ -257,7 +185,7 @@
/**
* Free the resources associated with a stream created by AAudioStreamBuilder_openStream()
*
- * @param stream handle provided by AAudioStreamBuilder_openStream()
+ * @param stream reference provided by AAudioStreamBuilder_openStream()
* @return AAUDIO_OK or a negative error.
*/
AAUDIO_API aaudio_result_t AAudioStream_close(AAudioStream stream);
@@ -268,7 +196,7 @@
* Otherwise it will underflow.
* After this call the state will be in AAUDIO_STREAM_STATE_STARTING or AAUDIO_STREAM_STATE_STARTED.
*
- * @param stream handle provided by AAudioStreamBuilder_openStream()
+ * @param stream reference provided by AAudioStreamBuilder_openStream()
* @return AAUDIO_OK or a negative error.
*/
AAUDIO_API aaudio_result_t AAudioStream_requestStart(AAudioStream stream);
@@ -279,7 +207,7 @@
* 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.
*
- * @param stream handle provided by AAudioStreamBuilder_openStream()
+ * @param stream reference provided by AAudioStreamBuilder_openStream()
* @return AAUDIO_OK or a negative error.
*/
AAUDIO_API aaudio_result_t AAudioStream_requestPause(AAudioStream stream);
@@ -291,7 +219,7 @@
* 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.
*
- * @param stream handle provided by AAudioStreamBuilder_openStream()
+ * @param stream reference provided by AAudioStreamBuilder_openStream()
* @return AAUDIO_OK or a negative error.
*/
AAUDIO_API aaudio_result_t AAudioStream_requestFlush(AAudioStream stream);
@@ -301,23 +229,29 @@
* 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.
*
- * @param stream handle provided by AAudioStreamBuilder_openStream()
+ * @param stream reference provided by AAudioStreamBuilder_openStream()
* @return AAUDIO_OK or a negative error.
*/
AAUDIO_API aaudio_result_t AAudioStream_requestStop(AAudioStream stream);
/**
- * Query the current state, eg. AAUDIO_STREAM_STATE_PAUSING
+ * Query the current state of the client, eg. AAUDIO_STREAM_STATE_PAUSING
*
- * @param stream handle provided by AAudioStreamBuilder_openStream()
+ * 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.
+ *
+ * @param stream reference provided by AAudioStreamBuilder_openStream()
* @param state pointer to a variable that will be set to the current state
- * @return AAUDIO_OK or a negative error.
*/
-AAUDIO_API aaudio_result_t AAudioStream_getState(AAudioStream stream, aaudio_stream_state_t *state);
+AAUDIO_API aaudio_stream_state_t AAudioStream_getState(AAudioStream stream);
/**
* Wait until the current state no longer matches the input state.
*
+ * This will update the current client state.
+ *
* <pre><code>
* aaudio_stream_state_t currentState;
* aaudio_result_t result = AAudioStream_getState(stream, ¤tState);
@@ -327,7 +261,7 @@
* }
* </code></pre>
*
- * @param stream A handle provided by AAudioStreamBuilder_openStream()
+ * @param stream A reference provided by AAudioStreamBuilder_openStream()
* @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.
@@ -336,7 +270,7 @@
AAUDIO_API aaudio_result_t AAudioStream_waitForStateChange(AAudioStream stream,
aaudio_stream_state_t inputState,
aaudio_stream_state_t *nextState,
- aaudio_nanoseconds_t timeoutNanoseconds);
+ int64_t timeoutNanoseconds);
// ============================================================
// Stream I/O
@@ -358,12 +292,12 @@
* @param buffer The address of the first sample.
* @param numFrames Number of frames to read. Only complete frames will be written.
* @param timeoutNanoseconds Maximum number of nanoseconds to wait for completion.
- * @return The number of frames actually written or a negative error.
+ * @return The number of frames actually read or a negative error.
*/
AAUDIO_API aaudio_result_t AAudioStream_read(AAudioStream stream,
void *buffer,
- aaudio_size_frames_t numFrames,
- aaudio_nanoseconds_t timeoutNanoseconds);
+ int32_t numFrames,
+ int64_t timeoutNanoseconds);
/**
* Write data to the stream.
@@ -385,8 +319,8 @@
*/
AAUDIO_API aaudio_result_t AAudioStream_write(AAudioStream stream,
const void *buffer,
- aaudio_size_frames_t numFrames,
- aaudio_nanoseconds_t timeoutNanoseconds);
+ int32_t numFrames,
+ int64_t timeoutNanoseconds);
// ============================================================
@@ -401,6 +335,11 @@
*
* Only one thread may be associated with a stream.
*
+ * If you are using multiple streams then we recommend that you only do
+ * blocking reads or writes on one stream. You can do non-blocking I/O on the
+ * other streams by setting the timeout to zero.
+ * This thread should be created for the stream that you will block on.
+ *
* Note that this API is in flux.
*
* @param stream A stream created using AAudioStreamBuilder_openStream().
@@ -410,13 +349,12 @@
* @return AAUDIO_OK or a negative error.
*/
AAUDIO_API aaudio_result_t AAudioStream_createThread(AAudioStream stream,
- aaudio_nanoseconds_t periodNanoseconds,
+ int64_t periodNanoseconds,
aaudio_audio_thread_proc_t *threadProc,
void *arg);
/**
* Wait until the thread exits or an error occurs.
- * The thread handle will be deleted.
*
* @param stream A stream created using AAudioStreamBuilder_openStream().
* @param returnArg a pointer to a variable to receive the return value
@@ -425,7 +363,7 @@
*/
AAUDIO_API aaudio_result_t AAudioStream_joinThread(AAudioStream stream,
void **returnArg,
- aaudio_nanoseconds_t timeoutNanoseconds);
+ int64_t timeoutNanoseconds);
// ============================================================
// Stream - queries
@@ -435,49 +373,51 @@
/**
* This can be used to adjust the latency of the buffer by changing
* the threshold where blocking will occur.
- * By combining this with AAudioStream_getUnderrunCount(), the latency can be tuned
+ * By combining this with AAudioStream_getXRunCount(), the latency can be tuned
* at run-time for each device.
*
- * This cannot be set higher than AAudioStream_getBufferCapacity().
+ * This cannot be set higher than AAudioStream_getBufferCapacityInFrames().
*
- * @param stream handle provided by AAudioStreamBuilder_openStream()
+ * Note that you will probably not get the exact size you request.
+ * Call AAudioStream_getBufferSizeInFrames() to see what the actual final size is.
+ *
+ * @param stream reference provided by AAudioStreamBuilder_openStream()
* @param requestedFrames requested number of frames that can be filled without blocking
- * @param actualFrames receives final number of frames
- * @return AAUDIO_OK or a negative error
+ * @return actual buffer size in frames or a negative error
*/
-AAUDIO_API aaudio_result_t AAudioStream_setBufferSize(AAudioStream stream,
- aaudio_size_frames_t requestedFrames,
- aaudio_size_frames_t *actualFrames);
+AAUDIO_API aaudio_result_t AAudioStream_setBufferSizeInFrames(AAudioStream stream,
+ int32_t requestedFrames);
/**
* Query the maximum number of frames that can be filled without blocking.
*
- * @param stream handle provided by AAudioStreamBuilder_openStream()
- * @param frames pointer to variable to receive the buffer size
- * @return AAUDIO_OK or a negative error.
+ * @param stream reference provided by AAudioStreamBuilder_openStream()
+ * @return buffer size in frames.
*/
-AAUDIO_API aaudio_result_t AAudioStream_getBufferSize(AAudioStream stream,
- aaudio_size_frames_t *frames);
+AAUDIO_API int32_t AAudioStream_getBufferSizeInFrames(AAudioStream stream);
/**
- * Query the number of frames that are read or written by the endpoint at one time.
+ * Query the number of frames that the application should read or write at
+ * one time for optimal performance. It is OK if an application writes
+ * a different number of frames. But the buffer size may need to be larger
+ * in order to avoid underruns or overruns.
*
- * @param stream handle provided by AAudioStreamBuilder_openStream()
- * @param frames pointer to variable to receive the burst size
- * @return AAUDIO_OK or a negative error.
+ * Note that this may or may not match the actual device burst size.
+ * For some endpoints, the burst size can vary dynamically.
+ * But these tend to be devices with high latency.
+ *
+ * @param stream reference provided by AAudioStreamBuilder_openStream()
+ * @return burst size
*/
-AAUDIO_API aaudio_result_t AAudioStream_getFramesPerBurst(AAudioStream stream,
- aaudio_size_frames_t *frames);
+AAUDIO_API int32_t AAudioStream_getFramesPerBurst(AAudioStream stream);
/**
* Query maximum buffer capacity in frames.
*
- * @param stream handle provided by AAudioStreamBuilder_openStream()
- * @param frames pointer to variable to receive the buffer capacity
- * @return AAUDIO_OK or a negative error.
+ * @param stream reference provided by AAudioStreamBuilder_openStream()
+ * @return the buffer capacity in frames
*/
-AAUDIO_API aaudio_result_t AAudioStream_getBufferCapacity(AAudioStream stream,
- aaudio_size_frames_t *frames);
+AAUDIO_API int32_t AAudioStream_getBufferCapacityInFrames(AAudioStream stream);
/**
* An XRun is an Underrun or an Overrun.
@@ -488,90 +428,75 @@
*
* An underrun or overrun can cause an audible "pop" or "glitch".
*
- * @param stream handle provided by AAudioStreamBuilder_openStream()
- * @param xRunCount pointer to variable to receive the underrun or overrun count
- * @return AAUDIO_OK or a negative error.
+ * @param stream reference provided by AAudioStreamBuilder_openStream()
+ * @return the underrun or overrun count
*/
-AAUDIO_API aaudio_result_t AAudioStream_getXRunCount(AAudioStream stream, int32_t *xRunCount);
+AAUDIO_API int32_t AAudioStream_getXRunCount(AAudioStream stream);
/**
- * @param stream handle provided by AAudioStreamBuilder_openStream()
- * @param sampleRate pointer to variable to receive the actual sample rate
- * @return AAUDIO_OK or a negative error.
+ * @param stream reference provided by AAudioStreamBuilder_openStream()
+ * @return actual sample rate
*/
-AAUDIO_API aaudio_result_t AAudioStream_getSampleRate(AAudioStream stream,
- aaudio_sample_rate_t *sampleRate);
+AAUDIO_API int32_t AAudioStream_getSampleRate(AAudioStream stream);
/**
* The samplesPerFrame is also known as channelCount.
*
- * @param stream handle provided by AAudioStreamBuilder_openStream()
- * @param samplesPerFrame pointer to variable to receive the actual samples per frame
- * @return AAUDIO_OK or a negative error.
+ * @param stream reference provided by AAudioStreamBuilder_openStream()
+ * @return actual samples per frame
*/
-AAUDIO_API aaudio_result_t AAudioStream_getSamplesPerFrame(AAudioStream stream,
- int32_t *samplesPerFrame);
+AAUDIO_API int32_t AAudioStream_getSamplesPerFrame(AAudioStream stream);
/**
- * @param stream handle provided by AAudioStreamBuilder_openStream()
+ * @param stream reference provided by AAudioStreamBuilder_openStream()
* @param deviceId pointer to variable to receive the actual device ID
* @return AAUDIO_OK or a negative error.
*/
-AAUDIO_API aaudio_result_t AAudioStream_getDeviceId(AAudioStream stream,
- aaudio_device_id_t *deviceId);
+AAUDIO_API int32_t AAudioStream_getDeviceId(AAudioStream stream,
+ int32_t *deviceId);
/**
- * @param stream handle provided by AAudioStreamBuilder_openStream()
- * @param format pointer to variable to receive the actual data format
- * @return AAUDIO_OK or a negative error.
+ * @param stream reference provided by AAudioStreamBuilder_openStream()
+ * @return actual data format
*/
-AAUDIO_API aaudio_result_t AAudioStream_getFormat(AAudioStream stream,
- aaudio_audio_format_t *format);
+AAUDIO_API aaudio_audio_format_t AAudioStream_getFormat(AAudioStream stream);
/**
* Provide actual sharing mode.
- * @param stream handle provided by AAudioStreamBuilder_openStream()
- * @param sharingMode pointer to variable to receive the actual sharing mode
- * @return AAUDIO_OK or a negative error.
+ * @param stream reference provided by AAudioStreamBuilder_openStream()
+ * @return actual sharing mode
*/
-AAUDIO_API aaudio_result_t AAudioStream_getSharingMode(AAudioStream stream,
- aaudio_sharing_mode_t *sharingMode);
+AAUDIO_API aaudio_sharing_mode_t AAudioStream_getSharingMode(AAudioStream stream);
/**
- * @param stream handle provided by AAudioStreamBuilder_openStream()
- * @param direction pointer to a variable to be set to the current direction.
- * @return AAUDIO_OK or a negative error.
+ * @param stream reference provided by AAudioStreamBuilder_openStream()
+ * @return direction
*/
-AAUDIO_API aaudio_result_t AAudioStream_getDirection(AAudioStream stream,
- aaudio_direction_t *direction);
+AAUDIO_API aaudio_direction_t AAudioStream_getDirection(AAudioStream stream);
/**
* Passes back the number of frames that have been written since the stream was created.
* For an output stream, this will be advanced by the application calling write().
- * For an input stream, this will be advanced by the device or service.
+ * For an input stream, this will be advanced by the endpoint.
*
* The frame position is monotonically increasing.
*
- * @param stream handle provided by AAudioStreamBuilder_openStream()
- * @param frames pointer to variable to receive the frames written
- * @return AAUDIO_OK or a negative error.
+ * @param stream reference provided by AAudioStreamBuilder_openStream()
+ * @return frames written
*/
-AAUDIO_API aaudio_result_t AAudioStream_getFramesWritten(AAudioStream stream,
- aaudio_position_frames_t *frames);
+AAUDIO_API int64_t AAudioStream_getFramesWritten(AAudioStream stream);
/**
* Passes back the number of frames that have been read since the stream was created.
- * For an output stream, this will be advanced by the device or service.
+ * For an output stream, this will be advanced by the endpoint.
* For an input stream, this will be advanced by the application calling read().
*
* The frame position is monotonically increasing.
*
- * @param stream handle provided by AAudioStreamBuilder_openStream()
- * @param frames pointer to variable to receive the frames written
- * @return AAUDIO_OK or a negative error.
+ * @param stream reference provided by AAudioStreamBuilder_openStream()
+ * @return frames read
*/
-AAUDIO_API aaudio_result_t AAudioStream_getFramesRead(AAudioStream stream,
- aaudio_position_frames_t *frames);
+AAUDIO_API int64_t AAudioStream_getFramesRead(AAudioStream stream);
/**
* Passes back the time at which a particular frame was presented.
@@ -589,16 +514,16 @@
*
* The position and time passed back are monotonically increasing.
*
- * @param stream A handle provided by AAudioStreamBuilder_openStream()
+ * @param stream reference provided by AAudioStreamBuilder_openStream()
* @param clockid AAUDIO_CLOCK_MONOTONIC or AAUDIO_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
*/
AAUDIO_API aaudio_result_t AAudioStream_getTimestamp(AAudioStream stream,
- aaudio_clockid_t clockid,
- aaudio_position_frames_t *framePosition,
- aaudio_nanoseconds_t *timeNanoseconds);
+ clockid_t clockid,
+ int64_t *framePosition,
+ int64_t *timeNanoseconds);
#ifdef __cplusplus
}