blob: 846318cdc2f95b644a3744907544c8d0edb1196b [file] [log] [blame]
Phil Burk5ed503c2017-02-01 09:38:15 -08001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef AAUDIO_AAUDIODEFINITIONS_H
18#define AAUDIO_AAUDIODEFINITIONS_H
19
20#include <stdint.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
Phil Burk5ed503c2017-02-01 09:38:15 -080026/**
27 * This is used to represent a value that has not been specified.
28 * For example, an application could use AAUDIO_UNSPECIFIED to indicate
29 * that is did not not care what the specific value of a parameter was
30 * and would accept whatever it was given.
31 */
32#define AAUDIO_UNSPECIFIED 0
Phil Burk3316d5e2017-02-15 11:23:01 -080033#define AAUDIO_DEVICE_UNSPECIFIED ((int32_t) -1)
Phil Burk5ed503c2017-02-01 09:38:15 -080034
Phil Burk9d8f98c2017-03-10 08:54:01 -080035enum {
Phil Burk5ed503c2017-02-01 09:38:15 -080036 AAUDIO_DIRECTION_OUTPUT,
Phil Burk3316d5e2017-02-15 11:23:01 -080037 AAUDIO_DIRECTION_INPUT
Phil Burk5ed503c2017-02-01 09:38:15 -080038};
Phil Burk9d8f98c2017-03-10 08:54:01 -080039typedef int32_t aaudio_direction_t;
Phil Burk5ed503c2017-02-01 09:38:15 -080040
Phil Burk9d8f98c2017-03-10 08:54:01 -080041enum {
Phil Burk5ed503c2017-02-01 09:38:15 -080042 AAUDIO_FORMAT_INVALID = -1,
43 AAUDIO_FORMAT_UNSPECIFIED = 0,
44 AAUDIO_FORMAT_PCM_I16,
45 AAUDIO_FORMAT_PCM_FLOAT,
46 AAUDIO_FORMAT_PCM_I8_24,
47 AAUDIO_FORMAT_PCM_I32
48};
Phil Burk02290282017-03-28 12:48:53 -070049typedef int32_t aaudio_format_t;
50
51/**
52 * @deprecated use aaudio_format_t instead
53 * TODO remove when tests and examples are updated
54 */
Phil Burk9d8f98c2017-03-10 08:54:01 -080055typedef int32_t aaudio_audio_format_t;
Phil Burk5ed503c2017-02-01 09:38:15 -080056
Phil Burk5ed503c2017-02-01 09:38:15 -080057enum {
58 AAUDIO_OK,
59 AAUDIO_ERROR_BASE = -900, // TODO review
60 AAUDIO_ERROR_DISCONNECTED,
61 AAUDIO_ERROR_ILLEGAL_ARGUMENT,
62 AAUDIO_ERROR_INCOMPATIBLE,
63 AAUDIO_ERROR_INTERNAL, // an underlying API returned an error code
64 AAUDIO_ERROR_INVALID_STATE,
65 AAUDIO_ERROR_UNEXPECTED_STATE,
66 AAUDIO_ERROR_UNEXPECTED_VALUE,
67 AAUDIO_ERROR_INVALID_HANDLE,
68 AAUDIO_ERROR_INVALID_QUERY,
69 AAUDIO_ERROR_UNIMPLEMENTED,
70 AAUDIO_ERROR_UNAVAILABLE,
71 AAUDIO_ERROR_NO_FREE_HANDLES,
72 AAUDIO_ERROR_NO_MEMORY,
73 AAUDIO_ERROR_NULL,
74 AAUDIO_ERROR_TIMEOUT,
75 AAUDIO_ERROR_WOULD_BLOCK,
76 AAUDIO_ERROR_INVALID_ORDER,
77 AAUDIO_ERROR_OUT_OF_RANGE,
78 AAUDIO_ERROR_NO_SERVICE
79};
Phil Burk9d8f98c2017-03-10 08:54:01 -080080typedef int32_t aaudio_result_t;
Phil Burk5ed503c2017-02-01 09:38:15 -080081
Phil Burk9d8f98c2017-03-10 08:54:01 -080082enum
Phil Burk5ed503c2017-02-01 09:38:15 -080083{
84 AAUDIO_STREAM_STATE_UNINITIALIZED = 0,
Phil Burk3316d5e2017-02-15 11:23:01 -080085 AAUDIO_STREAM_STATE_UNKNOWN,
Phil Burk5ed503c2017-02-01 09:38:15 -080086 AAUDIO_STREAM_STATE_OPEN,
87 AAUDIO_STREAM_STATE_STARTING,
88 AAUDIO_STREAM_STATE_STARTED,
89 AAUDIO_STREAM_STATE_PAUSING,
90 AAUDIO_STREAM_STATE_PAUSED,
91 AAUDIO_STREAM_STATE_FLUSHING,
92 AAUDIO_STREAM_STATE_FLUSHED,
93 AAUDIO_STREAM_STATE_STOPPING,
94 AAUDIO_STREAM_STATE_STOPPED,
95 AAUDIO_STREAM_STATE_CLOSING,
96 AAUDIO_STREAM_STATE_CLOSED,
Phil Burk9d8f98c2017-03-10 08:54:01 -080097};
98typedef int32_t aaudio_stream_state_t;
Phil Burk5ed503c2017-02-01 09:38:15 -080099
Phil Burk9d8f98c2017-03-10 08:54:01 -0800100enum {
Phil Burk5ed503c2017-02-01 09:38:15 -0800101 /**
Phil Burk5ed503c2017-02-01 09:38:15 -0800102 * This will be the only stream using a particular source or sink.
103 * This mode will provide the lowest possible latency.
104 * You should close EXCLUSIVE streams immediately when you are not using them.
105 */
106 AAUDIO_SHARING_MODE_EXCLUSIVE,
107 /**
108 * Multiple applications will be mixed by the AAudio Server.
109 * This will have higher latency than the EXCLUSIVE mode.
110 */
Phil Burk3316d5e2017-02-15 11:23:01 -0800111 AAUDIO_SHARING_MODE_SHARED
Phil Burk9d8f98c2017-03-10 08:54:01 -0800112};
113typedef int32_t aaudio_sharing_mode_t;
Phil Burk5ed503c2017-02-01 09:38:15 -0800114
115#ifdef __cplusplus
116}
117#endif
118
119#endif // AAUDIO_AAUDIODEFINITIONS_H