Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 1 | /* |
| 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 | |
Phil Burk | a45be8b | 2017-04-05 14:45:48 -0700 | [diff] [blame] | 17 | /** |
| 18 | * @addtogroup Audio |
| 19 | * @{ |
| 20 | */ |
| 21 | |
| 22 | /** |
| 23 | * @file AAudioDefinitions.h |
| 24 | */ |
| 25 | |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 26 | #ifndef AAUDIO_AAUDIODEFINITIONS_H |
| 27 | #define AAUDIO_AAUDIODEFINITIONS_H |
| 28 | |
| 29 | #include <stdint.h> |
| 30 | |
| 31 | #ifdef __cplusplus |
| 32 | extern "C" { |
| 33 | #endif |
| 34 | |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 35 | /** |
| 36 | * This is used to represent a value that has not been specified. |
| 37 | * For example, an application could use AAUDIO_UNSPECIFIED to indicate |
| 38 | * that is did not not care what the specific value of a parameter was |
| 39 | * and would accept whatever it was given. |
| 40 | */ |
| 41 | #define AAUDIO_UNSPECIFIED 0 |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame^] | 42 | #define AAUDIO_DEVICE_UNSPECIFIED 0 |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 43 | |
Phil Burk | 9d8f98c | 2017-03-10 08:54:01 -0800 | [diff] [blame] | 44 | enum { |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 45 | AAUDIO_DIRECTION_OUTPUT, |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 46 | AAUDIO_DIRECTION_INPUT |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 47 | }; |
Phil Burk | 9d8f98c | 2017-03-10 08:54:01 -0800 | [diff] [blame] | 48 | typedef int32_t aaudio_direction_t; |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 49 | |
Phil Burk | 9d8f98c | 2017-03-10 08:54:01 -0800 | [diff] [blame] | 50 | enum { |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 51 | AAUDIO_FORMAT_INVALID = -1, |
| 52 | AAUDIO_FORMAT_UNSPECIFIED = 0, |
| 53 | AAUDIO_FORMAT_PCM_I16, |
| 54 | AAUDIO_FORMAT_PCM_FLOAT, |
| 55 | AAUDIO_FORMAT_PCM_I8_24, |
| 56 | AAUDIO_FORMAT_PCM_I32 |
| 57 | }; |
Phil Burk | 0229028 | 2017-03-28 12:48:53 -0700 | [diff] [blame] | 58 | typedef int32_t aaudio_format_t; |
| 59 | |
| 60 | /** |
| 61 | * @deprecated use aaudio_format_t instead |
| 62 | * TODO remove when tests and examples are updated |
| 63 | */ |
Phil Burk | 9d8f98c | 2017-03-10 08:54:01 -0800 | [diff] [blame] | 64 | typedef int32_t aaudio_audio_format_t; |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 65 | |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 66 | enum { |
| 67 | AAUDIO_OK, |
| 68 | AAUDIO_ERROR_BASE = -900, // TODO review |
| 69 | AAUDIO_ERROR_DISCONNECTED, |
| 70 | AAUDIO_ERROR_ILLEGAL_ARGUMENT, |
| 71 | AAUDIO_ERROR_INCOMPATIBLE, |
| 72 | AAUDIO_ERROR_INTERNAL, // an underlying API returned an error code |
| 73 | AAUDIO_ERROR_INVALID_STATE, |
| 74 | AAUDIO_ERROR_UNEXPECTED_STATE, |
| 75 | AAUDIO_ERROR_UNEXPECTED_VALUE, |
| 76 | AAUDIO_ERROR_INVALID_HANDLE, |
| 77 | AAUDIO_ERROR_INVALID_QUERY, |
| 78 | AAUDIO_ERROR_UNIMPLEMENTED, |
| 79 | AAUDIO_ERROR_UNAVAILABLE, |
| 80 | AAUDIO_ERROR_NO_FREE_HANDLES, |
| 81 | AAUDIO_ERROR_NO_MEMORY, |
| 82 | AAUDIO_ERROR_NULL, |
| 83 | AAUDIO_ERROR_TIMEOUT, |
| 84 | AAUDIO_ERROR_WOULD_BLOCK, |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame^] | 85 | AAUDIO_ERROR_INVALID_FORMAT, |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 86 | AAUDIO_ERROR_OUT_OF_RANGE, |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame^] | 87 | AAUDIO_ERROR_NO_SERVICE, |
| 88 | AAUDIO_ERROR_INVALID_RATE |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 89 | }; |
Phil Burk | 9d8f98c | 2017-03-10 08:54:01 -0800 | [diff] [blame] | 90 | typedef int32_t aaudio_result_t; |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 91 | |
Phil Burk | 9d8f98c | 2017-03-10 08:54:01 -0800 | [diff] [blame] | 92 | enum |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 93 | { |
| 94 | AAUDIO_STREAM_STATE_UNINITIALIZED = 0, |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 95 | AAUDIO_STREAM_STATE_UNKNOWN, |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 96 | AAUDIO_STREAM_STATE_OPEN, |
| 97 | AAUDIO_STREAM_STATE_STARTING, |
| 98 | AAUDIO_STREAM_STATE_STARTED, |
| 99 | AAUDIO_STREAM_STATE_PAUSING, |
| 100 | AAUDIO_STREAM_STATE_PAUSED, |
| 101 | AAUDIO_STREAM_STATE_FLUSHING, |
| 102 | AAUDIO_STREAM_STATE_FLUSHED, |
| 103 | AAUDIO_STREAM_STATE_STOPPING, |
| 104 | AAUDIO_STREAM_STATE_STOPPED, |
| 105 | AAUDIO_STREAM_STATE_CLOSING, |
| 106 | AAUDIO_STREAM_STATE_CLOSED, |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame^] | 107 | AAUDIO_STREAM_STATE_DISCONNECTED |
Phil Burk | 9d8f98c | 2017-03-10 08:54:01 -0800 | [diff] [blame] | 108 | }; |
| 109 | typedef int32_t aaudio_stream_state_t; |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 110 | |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame^] | 111 | |
Phil Burk | 9d8f98c | 2017-03-10 08:54:01 -0800 | [diff] [blame] | 112 | enum { |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 113 | /** |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 114 | * This will be the only stream using a particular source or sink. |
| 115 | * This mode will provide the lowest possible latency. |
| 116 | * You should close EXCLUSIVE streams immediately when you are not using them. |
| 117 | */ |
| 118 | AAUDIO_SHARING_MODE_EXCLUSIVE, |
| 119 | /** |
| 120 | * Multiple applications will be mixed by the AAudio Server. |
| 121 | * This will have higher latency than the EXCLUSIVE mode. |
| 122 | */ |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 123 | AAUDIO_SHARING_MODE_SHARED |
Phil Burk | 9d8f98c | 2017-03-10 08:54:01 -0800 | [diff] [blame] | 124 | }; |
| 125 | typedef int32_t aaudio_sharing_mode_t; |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 126 | |
| 127 | #ifdef __cplusplus |
| 128 | } |
| 129 | #endif |
| 130 | |
| 131 | #endif // AAUDIO_AAUDIODEFINITIONS_H |
Phil Burk | a45be8b | 2017-04-05 14:45:48 -0700 | [diff] [blame] | 132 | |
| 133 | /** @} */ |