blob: e5b7d7af92ae2de26ff73d16546e92bb6dfbdeaf [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 Burk9d8f98c2017-03-10 08:54:01 -080049typedef int32_t aaudio_audio_format_t;
Phil Burk5ed503c2017-02-01 09:38:15 -080050
Phil Burk5ed503c2017-02-01 09:38:15 -080051enum {
52 AAUDIO_OK,
53 AAUDIO_ERROR_BASE = -900, // TODO review
54 AAUDIO_ERROR_DISCONNECTED,
55 AAUDIO_ERROR_ILLEGAL_ARGUMENT,
56 AAUDIO_ERROR_INCOMPATIBLE,
57 AAUDIO_ERROR_INTERNAL, // an underlying API returned an error code
58 AAUDIO_ERROR_INVALID_STATE,
59 AAUDIO_ERROR_UNEXPECTED_STATE,
60 AAUDIO_ERROR_UNEXPECTED_VALUE,
61 AAUDIO_ERROR_INVALID_HANDLE,
62 AAUDIO_ERROR_INVALID_QUERY,
63 AAUDIO_ERROR_UNIMPLEMENTED,
64 AAUDIO_ERROR_UNAVAILABLE,
65 AAUDIO_ERROR_NO_FREE_HANDLES,
66 AAUDIO_ERROR_NO_MEMORY,
67 AAUDIO_ERROR_NULL,
68 AAUDIO_ERROR_TIMEOUT,
69 AAUDIO_ERROR_WOULD_BLOCK,
70 AAUDIO_ERROR_INVALID_ORDER,
71 AAUDIO_ERROR_OUT_OF_RANGE,
72 AAUDIO_ERROR_NO_SERVICE
73};
Phil Burk9d8f98c2017-03-10 08:54:01 -080074typedef int32_t aaudio_result_t;
Phil Burk5ed503c2017-02-01 09:38:15 -080075
Phil Burk9d8f98c2017-03-10 08:54:01 -080076enum
Phil Burk5ed503c2017-02-01 09:38:15 -080077{
78 AAUDIO_STREAM_STATE_UNINITIALIZED = 0,
Phil Burk3316d5e2017-02-15 11:23:01 -080079 AAUDIO_STREAM_STATE_UNKNOWN,
Phil Burk5ed503c2017-02-01 09:38:15 -080080 AAUDIO_STREAM_STATE_OPEN,
81 AAUDIO_STREAM_STATE_STARTING,
82 AAUDIO_STREAM_STATE_STARTED,
83 AAUDIO_STREAM_STATE_PAUSING,
84 AAUDIO_STREAM_STATE_PAUSED,
85 AAUDIO_STREAM_STATE_FLUSHING,
86 AAUDIO_STREAM_STATE_FLUSHED,
87 AAUDIO_STREAM_STATE_STOPPING,
88 AAUDIO_STREAM_STATE_STOPPED,
89 AAUDIO_STREAM_STATE_CLOSING,
90 AAUDIO_STREAM_STATE_CLOSED,
Phil Burk9d8f98c2017-03-10 08:54:01 -080091};
92typedef int32_t aaudio_stream_state_t;
Phil Burk5ed503c2017-02-01 09:38:15 -080093
Phil Burk9d8f98c2017-03-10 08:54:01 -080094enum {
Phil Burk5ed503c2017-02-01 09:38:15 -080095 /**
Phil Burk5ed503c2017-02-01 09:38:15 -080096 * This will be the only stream using a particular source or sink.
97 * This mode will provide the lowest possible latency.
98 * You should close EXCLUSIVE streams immediately when you are not using them.
99 */
100 AAUDIO_SHARING_MODE_EXCLUSIVE,
101 /**
102 * Multiple applications will be mixed by the AAudio Server.
103 * This will have higher latency than the EXCLUSIVE mode.
104 */
Phil Burk3316d5e2017-02-15 11:23:01 -0800105 AAUDIO_SHARING_MODE_SHARED
Phil Burk9d8f98c2017-03-10 08:54:01 -0800106};
107typedef int32_t aaudio_sharing_mode_t;
Phil Burk5ed503c2017-02-01 09:38:15 -0800108
109#ifdef __cplusplus
110}
111#endif
112
113#endif // AAUDIO_AAUDIODEFINITIONS_H