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 | |
| 17 | #ifndef AAUDIO_AAUDIODEFINITIONS_H |
| 18 | #define AAUDIO_AAUDIODEFINITIONS_H |
| 19 | |
| 20 | #include <stdint.h> |
| 21 | |
| 22 | #ifdef __cplusplus |
| 23 | extern "C" { |
| 24 | #endif |
| 25 | |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 26 | /** |
| 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 Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 33 | #define AAUDIO_DEVICE_UNSPECIFIED ((int32_t) -1) |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 34 | |
Phil Burk | 9d8f98c | 2017-03-10 08:54:01 -0800 | [diff] [blame] | 35 | enum { |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 36 | AAUDIO_DIRECTION_OUTPUT, |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 37 | AAUDIO_DIRECTION_INPUT |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 38 | }; |
Phil Burk | 9d8f98c | 2017-03-10 08:54:01 -0800 | [diff] [blame] | 39 | typedef int32_t aaudio_direction_t; |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 40 | |
Phil Burk | 9d8f98c | 2017-03-10 08:54:01 -0800 | [diff] [blame] | 41 | enum { |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 42 | 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 Burk | 0229028 | 2017-03-28 12:48:53 -0700 | [diff] [blame] | 49 | typedef 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 Burk | 9d8f98c | 2017-03-10 08:54:01 -0800 | [diff] [blame] | 55 | typedef int32_t aaudio_audio_format_t; |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 56 | |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 57 | enum { |
| 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 Burk | 9d8f98c | 2017-03-10 08:54:01 -0800 | [diff] [blame] | 80 | typedef int32_t aaudio_result_t; |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 81 | |
Phil Burk | 9d8f98c | 2017-03-10 08:54:01 -0800 | [diff] [blame] | 82 | enum |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 83 | { |
| 84 | AAUDIO_STREAM_STATE_UNINITIALIZED = 0, |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 85 | AAUDIO_STREAM_STATE_UNKNOWN, |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 86 | 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 Burk | 9d8f98c | 2017-03-10 08:54:01 -0800 | [diff] [blame] | 97 | }; |
| 98 | typedef int32_t aaudio_stream_state_t; |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 99 | |
Phil Burk | 9d8f98c | 2017-03-10 08:54:01 -0800 | [diff] [blame] | 100 | enum { |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 101 | /** |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 102 | * 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 Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 111 | AAUDIO_SHARING_MODE_SHARED |
Phil Burk | 9d8f98c | 2017-03-10 08:54:01 -0800 | [diff] [blame] | 112 | }; |
| 113 | typedef int32_t aaudio_sharing_mode_t; |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 114 | |
| 115 | #ifdef __cplusplus |
| 116 | } |
| 117 | #endif |
| 118 | |
| 119 | #endif // AAUDIO_AAUDIODEFINITIONS_H |