aaudio: merge contents of AAudioDefinitions.h into AAudio.h
As requested by native API council.
Bug: 30210002
Bug: 33398120
Test: CTS test_aaudio
Change-Id: I5ea7c53d09469221263d84cf6f82082e67c2523b
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 25ad5f8..bc65acc 100644
--- a/media/libaaudio/include/aaudio/AAudio.h
+++ b/media/libaaudio/include/aaudio/AAudio.h
@@ -30,12 +30,103 @@
#define AAUDIO_AAUDIO_H
#include <time.h>
-#include "AAudioDefinitions.h"
#ifdef __cplusplus
extern "C" {
#endif
+/**
+ * This is used to represent a value that has not been specified.
+ * For example, an application could use 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.
+ */
+#define AAUDIO_UNSPECIFIED 0
+#define AAUDIO_DEVICE_UNSPECIFIED 0
+
+enum {
+ AAUDIO_DIRECTION_OUTPUT,
+ AAUDIO_DIRECTION_INPUT
+};
+typedef int32_t aaudio_direction_t;
+
+enum {
+ AAUDIO_FORMAT_INVALID = -1,
+ AAUDIO_FORMAT_UNSPECIFIED = 0,
+ AAUDIO_FORMAT_PCM_I16,
+ AAUDIO_FORMAT_PCM_FLOAT,
+ AAUDIO_FORMAT_PCM_I8_24,
+ AAUDIO_FORMAT_PCM_I32
+};
+typedef int32_t aaudio_format_t;
+
+/**
+ * @deprecated use aaudio_format_t instead
+ * TODO remove when tests and examples are updated
+ */
+typedef int32_t aaudio_audio_format_t;
+
+enum {
+ AAUDIO_OK,
+ AAUDIO_ERROR_BASE = -900, // TODO review
+ AAUDIO_ERROR_DISCONNECTED,
+ AAUDIO_ERROR_ILLEGAL_ARGUMENT,
+ AAUDIO_ERROR_INCOMPATIBLE,
+ AAUDIO_ERROR_INTERNAL, // an underlying API returned an error code
+ AAUDIO_ERROR_INVALID_STATE,
+ AAUDIO_ERROR_UNEXPECTED_STATE,
+ AAUDIO_ERROR_UNEXPECTED_VALUE,
+ AAUDIO_ERROR_INVALID_HANDLE,
+ AAUDIO_ERROR_INVALID_QUERY,
+ AAUDIO_ERROR_UNIMPLEMENTED,
+ 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
+};
+typedef int32_t aaudio_result_t;
+
+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
+};
+typedef int32_t aaudio_stream_state_t;
+
+
+enum {
+ /**
+ * This will be the only stream using a particular source or sink.
+ * This mode will provide the lowest possible latency.
+ * You should close EXCLUSIVE streams immediately when you are not using them.
+ */
+ AAUDIO_SHARING_MODE_EXCLUSIVE,
+ /**
+ * Multiple applications will be mixed by the AAudio Server.
+ * This will have higher latency than the EXCLUSIVE mode.
+ */
+ AAUDIO_SHARING_MODE_SHARED
+};
+typedef int32_t aaudio_sharing_mode_t;
+
typedef struct AAudioStreamStruct AAudioStream;
typedef struct AAudioStreamBuilderStruct AAudioStreamBuilder;