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 | /** |
Phil Burk | a45be8b | 2017-04-05 14:45:48 -0700 | [diff] [blame] | 18 | * @addtogroup Audio |
| 19 | * @{ |
| 20 | */ |
| 21 | |
| 22 | /** |
| 23 | * @file AAudio.h |
| 24 | */ |
| 25 | |
| 26 | /** |
| 27 | * This is the 'C' API for AAudio. |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 28 | */ |
| 29 | #ifndef AAUDIO_AAUDIO_H |
| 30 | #define AAUDIO_AAUDIO_H |
| 31 | |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 32 | #include <time.h> |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 33 | |
| 34 | #ifdef __cplusplus |
| 35 | extern "C" { |
| 36 | #endif |
| 37 | |
Phil Burk | a4eb0d8 | 2017-04-12 15:44:06 -0700 | [diff] [blame] | 38 | /** |
| 39 | * This is used to represent a value that has not been specified. |
| 40 | * For example, an application could use AAUDIO_UNSPECIFIED to indicate |
| 41 | * that is did not not care what the specific value of a parameter was |
| 42 | * and would accept whatever it was given. |
| 43 | */ |
| 44 | #define AAUDIO_UNSPECIFIED 0 |
Phil Burk | a4eb0d8 | 2017-04-12 15:44:06 -0700 | [diff] [blame] | 45 | |
| 46 | enum { |
| 47 | AAUDIO_DIRECTION_OUTPUT, |
| 48 | AAUDIO_DIRECTION_INPUT |
| 49 | }; |
| 50 | typedef int32_t aaudio_direction_t; |
| 51 | |
| 52 | enum { |
| 53 | AAUDIO_FORMAT_INVALID = -1, |
| 54 | AAUDIO_FORMAT_UNSPECIFIED = 0, |
| 55 | AAUDIO_FORMAT_PCM_I16, |
Phil Burk | 7473345 | 2017-04-18 19:50:28 -0700 | [diff] [blame] | 56 | AAUDIO_FORMAT_PCM_FLOAT |
Phil Burk | a4eb0d8 | 2017-04-12 15:44:06 -0700 | [diff] [blame] | 57 | }; |
| 58 | typedef int32_t aaudio_format_t; |
| 59 | |
Phil Burk | a4eb0d8 | 2017-04-12 15:44:06 -0700 | [diff] [blame] | 60 | enum { |
| 61 | AAUDIO_OK, |
| 62 | AAUDIO_ERROR_BASE = -900, // TODO review |
| 63 | AAUDIO_ERROR_DISCONNECTED, |
| 64 | AAUDIO_ERROR_ILLEGAL_ARGUMENT, |
Phil Burk | 17fff38 | 2017-05-16 14:06:45 -0700 | [diff] [blame] | 65 | // reserved |
| 66 | AAUDIO_ERROR_INTERNAL = AAUDIO_ERROR_ILLEGAL_ARGUMENT + 2, |
Phil Burk | a4eb0d8 | 2017-04-12 15:44:06 -0700 | [diff] [blame] | 67 | AAUDIO_ERROR_INVALID_STATE, |
Phil Burk | 17fff38 | 2017-05-16 14:06:45 -0700 | [diff] [blame] | 68 | // reserved |
| 69 | // reserved |
| 70 | AAUDIO_ERROR_INVALID_HANDLE = AAUDIO_ERROR_INVALID_STATE + 3, |
| 71 | // reserved |
| 72 | AAUDIO_ERROR_UNIMPLEMENTED = AAUDIO_ERROR_INVALID_HANDLE + 2, |
Phil Burk | a4eb0d8 | 2017-04-12 15:44:06 -0700 | [diff] [blame] | 73 | AAUDIO_ERROR_UNAVAILABLE, |
| 74 | AAUDIO_ERROR_NO_FREE_HANDLES, |
| 75 | AAUDIO_ERROR_NO_MEMORY, |
| 76 | AAUDIO_ERROR_NULL, |
| 77 | AAUDIO_ERROR_TIMEOUT, |
| 78 | AAUDIO_ERROR_WOULD_BLOCK, |
| 79 | AAUDIO_ERROR_INVALID_FORMAT, |
| 80 | AAUDIO_ERROR_OUT_OF_RANGE, |
| 81 | AAUDIO_ERROR_NO_SERVICE, |
| 82 | AAUDIO_ERROR_INVALID_RATE |
| 83 | }; |
| 84 | typedef int32_t aaudio_result_t; |
| 85 | |
| 86 | enum |
| 87 | { |
| 88 | AAUDIO_STREAM_STATE_UNINITIALIZED = 0, |
| 89 | AAUDIO_STREAM_STATE_UNKNOWN, |
| 90 | AAUDIO_STREAM_STATE_OPEN, |
| 91 | AAUDIO_STREAM_STATE_STARTING, |
| 92 | AAUDIO_STREAM_STATE_STARTED, |
| 93 | AAUDIO_STREAM_STATE_PAUSING, |
| 94 | AAUDIO_STREAM_STATE_PAUSED, |
| 95 | AAUDIO_STREAM_STATE_FLUSHING, |
| 96 | AAUDIO_STREAM_STATE_FLUSHED, |
| 97 | AAUDIO_STREAM_STATE_STOPPING, |
| 98 | AAUDIO_STREAM_STATE_STOPPED, |
| 99 | AAUDIO_STREAM_STATE_CLOSING, |
| 100 | AAUDIO_STREAM_STATE_CLOSED, |
| 101 | AAUDIO_STREAM_STATE_DISCONNECTED |
| 102 | }; |
| 103 | typedef int32_t aaudio_stream_state_t; |
| 104 | |
| 105 | |
| 106 | enum { |
| 107 | /** |
| 108 | * This will be the only stream using a particular source or sink. |
| 109 | * This mode will provide the lowest possible latency. |
| 110 | * You should close EXCLUSIVE streams immediately when you are not using them. |
| 111 | */ |
| 112 | AAUDIO_SHARING_MODE_EXCLUSIVE, |
| 113 | /** |
| 114 | * Multiple applications will be mixed by the AAudio Server. |
| 115 | * This will have higher latency than the EXCLUSIVE mode. |
| 116 | */ |
| 117 | AAUDIO_SHARING_MODE_SHARED |
| 118 | }; |
| 119 | typedef int32_t aaudio_sharing_mode_t; |
| 120 | |
Phil Burk | e2fbb59 | 2017-05-01 15:05:52 -0700 | [diff] [blame] | 121 | |
| 122 | enum { |
| 123 | /** |
| 124 | * No particular performance needs. Default. |
| 125 | */ |
| 126 | AAUDIO_PERFORMANCE_MODE_NONE = 10, |
| 127 | |
| 128 | /** |
| 129 | * Extending battery life is most important. |
| 130 | */ |
| 131 | AAUDIO_PERFORMANCE_MODE_POWER_SAVING, |
| 132 | |
| 133 | /** |
| 134 | * Reducing latency is most important. |
| 135 | */ |
| 136 | AAUDIO_PERFORMANCE_MODE_LOW_LATENCY |
| 137 | }; |
| 138 | typedef int32_t aaudio_performance_mode_t; |
| 139 | |
Phil Burk | 361b142 | 2017-12-20 14:24:16 -0800 | [diff] [blame^] | 140 | /** |
| 141 | * The USAGE attribute expresses "why" you are playing a sound, what is this sound used for. |
| 142 | * This information is used by certain platforms or routing policies |
| 143 | * to make more refined volume or routing decisions. |
| 144 | * |
| 145 | * Note that these match the equivalent values in AudioAttributes in the Android Java API. |
| 146 | */ |
| 147 | enum { |
| 148 | /** |
| 149 | * Use this for streaming media, music performance, video, podcasts, etcetera. |
| 150 | */ |
| 151 | AAUDIO_USAGE_MEDIA = 1, |
| 152 | |
| 153 | /** |
| 154 | * Use this for voice over IP, telephony, etcetera. |
| 155 | */ |
| 156 | AAUDIO_USAGE_VOICE_COMMUNICATION = 2, |
| 157 | |
| 158 | /** |
| 159 | * Use this for sounds associated with telephony such as busy tones, DTMF, etcetera. |
| 160 | */ |
| 161 | AAUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING = 3, |
| 162 | |
| 163 | /** |
| 164 | * Use this to demand the users attention. |
| 165 | */ |
| 166 | AAUDIO_USAGE_ALARM = 4, |
| 167 | |
| 168 | /** |
| 169 | * Use this for notifying the user when a message has arrived or some |
| 170 | * other background event has occured. |
| 171 | */ |
| 172 | AAUDIO_USAGE_NOTIFICATION = 5, |
| 173 | |
| 174 | /** |
| 175 | * Use this when the phone rings. |
| 176 | */ |
| 177 | AAUDIO_USAGE_NOTIFICATION_RINGTONE = 6, |
| 178 | |
| 179 | /** |
| 180 | * Use this to attract the users attention when, for example, the battery is low. |
| 181 | */ |
| 182 | AAUDIO_USAGE_NOTIFICATION_EVENT = 10, |
| 183 | |
| 184 | /** |
| 185 | * Use this for screen readers, etcetera. |
| 186 | */ |
| 187 | AAUDIO_USAGE_ASSISTANCE_ACCESSIBILITY = 11, |
| 188 | |
| 189 | /** |
| 190 | * Use this for driving or navigation directions. |
| 191 | */ |
| 192 | AAUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE = 12, |
| 193 | |
| 194 | /** |
| 195 | * Use this for user interface sounds, beeps, etcetera. |
| 196 | */ |
| 197 | AAUDIO_USAGE_ASSISTANCE_SONIFICATION = 13, |
| 198 | |
| 199 | /** |
| 200 | * Use this for game audio and sound effects. |
| 201 | */ |
| 202 | AAUDIO_USAGE_GAME = 14, |
| 203 | |
| 204 | /** |
| 205 | * Use this for audio responses to user queries, audio instructions or help utterances. |
| 206 | */ |
| 207 | AAUDIO_USAGE_ASSISTANT = 16 |
| 208 | }; |
| 209 | typedef int32_t aaudio_usage_t; |
| 210 | |
| 211 | /** |
| 212 | * The CONTENT_TYPE attribute describes "what" you are playing. |
| 213 | * It expresses the general category of the content. This information is optional. |
| 214 | * But in case it is known (for instance {@link #AAUDIO_CONTENT_TYPE_MOVIE} for a |
| 215 | * movie streaming service or {@link #AAUDIO_CONTENT_TYPE_SPEECH} for |
| 216 | * an audio book application) this information might be used by the audio framework to |
| 217 | * enforce audio focus. |
| 218 | * |
| 219 | * Note that these match the equivalent values in AudioAttributes in the Android Java API. |
| 220 | */ |
| 221 | enum { |
| 222 | |
| 223 | /** |
| 224 | * Use this for spoken voice, audio books, etcetera. |
| 225 | */ |
| 226 | AAUDIO_CONTENT_TYPE_SPEECH = 1, |
| 227 | |
| 228 | /** |
| 229 | * Use this for pre-recorded or live music. |
| 230 | */ |
| 231 | AAUDIO_CONTENT_TYPE_MUSIC = 2, |
| 232 | |
| 233 | /** |
| 234 | * Use this for a movie or video soundtrack. |
| 235 | */ |
| 236 | AAUDIO_CONTENT_TYPE_MOVIE = 3, |
| 237 | |
| 238 | /** |
| 239 | * Use this for sound is designed to accompany a user action, |
| 240 | * such as a click or beep sound made when the user presses a button. |
| 241 | */ |
| 242 | AAUDIO_CONTENT_TYPE_SONIFICATION = 4 |
| 243 | }; |
| 244 | typedef int32_t aaudio_content_type_t; |
| 245 | |
| 246 | /** |
| 247 | * Defines the audio source. |
| 248 | * An audio source defines both a default physical source of audio signal, and a recording |
| 249 | * configuration. |
| 250 | * |
| 251 | * Note that these match the equivalent values in MediaRecorder.AudioSource in the Android Java API. |
| 252 | */ |
| 253 | enum { |
| 254 | /** |
| 255 | * Use this preset when other presets do not apply. |
| 256 | */ |
| 257 | AAUDIO_INPUT_PRESET_GENERIC = 1, |
| 258 | |
| 259 | /** |
| 260 | * Use this preset when recording video. |
| 261 | */ |
| 262 | AAUDIO_INPUT_PRESET_CAMCORDER = 5, |
| 263 | |
| 264 | /** |
| 265 | * Use this preset when doing speech recognition. |
| 266 | */ |
| 267 | AAUDIO_INPUT_PRESET_VOICE_RECOGNITION = 6, |
| 268 | |
| 269 | /** |
| 270 | * Use this preset when doing telephony or voice messaging. |
| 271 | */ |
| 272 | AAUDIO_INPUT_PRESET_VOICE_COMMUNICATION = 7, |
| 273 | |
| 274 | /** |
| 275 | * Use this preset to obtain an input with no effects. |
| 276 | * Note that this input will not have automatic gain control |
| 277 | * so the recorded volume may be very low. |
| 278 | */ |
| 279 | AAUDIO_INPUT_PRESET_UNPROCESSED = 9, |
| 280 | }; |
| 281 | typedef int32_t aaudio_input_preset_t; |
| 282 | |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 283 | typedef struct AAudioStreamStruct AAudioStream; |
| 284 | typedef struct AAudioStreamBuilderStruct AAudioStreamBuilder; |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 285 | |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 286 | #ifndef AAUDIO_API |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 287 | #define AAUDIO_API /* export this symbol */ |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 288 | #endif |
| 289 | |
| 290 | // ============================================================ |
| 291 | // Audio System |
| 292 | // ============================================================ |
| 293 | |
| 294 | /** |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 295 | * The text is the ASCII symbol corresponding to the returnCode, |
| 296 | * or an English message saying the returnCode is unrecognized. |
| 297 | * This is intended for developers to use when debugging. |
| 298 | * It is not for display to users. |
| 299 | * |
| 300 | * @return pointer to a text representation of an AAudio result code. |
| 301 | */ |
| 302 | AAUDIO_API const char * AAudio_convertResultToText(aaudio_result_t returnCode); |
| 303 | |
| 304 | /** |
| 305 | * The text is the ASCII symbol corresponding to the stream state, |
| 306 | * or an English message saying the state is unrecognized. |
| 307 | * This is intended for developers to use when debugging. |
| 308 | * It is not for display to users. |
| 309 | * |
| 310 | * @return pointer to a text representation of an AAudio state. |
| 311 | */ |
| 312 | AAUDIO_API const char * AAudio_convertStreamStateToText(aaudio_stream_state_t state); |
| 313 | |
| 314 | // ============================================================ |
| 315 | // StreamBuilder |
| 316 | // ============================================================ |
| 317 | |
| 318 | /** |
| 319 | * Create a StreamBuilder that can be used to open a Stream. |
| 320 | * |
| 321 | * The deviceId is initially unspecified, meaning that the current default device will be used. |
| 322 | * |
| 323 | * The default direction is AAUDIO_DIRECTION_OUTPUT. |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 324 | * The default sharing mode is AAUDIO_SHARING_MODE_SHARED. |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 325 | * The data format, samplesPerFrames and sampleRate are unspecified and will be |
| 326 | * chosen by the device when it is opened. |
| 327 | * |
| 328 | * AAudioStreamBuilder_delete() must be called when you are done using the builder. |
| 329 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 330 | AAUDIO_API aaudio_result_t AAudio_createStreamBuilder(AAudioStreamBuilder** builder); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 331 | |
| 332 | /** |
| 333 | * Request an audio device identified device using an ID. |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 334 | * On Android, for example, the ID could be obtained from the Java AudioManager. |
| 335 | * |
Glenn Kasten | 5f510d2 | 2017-05-30 15:52:15 -0700 | [diff] [blame] | 336 | * The default, if you do not call this function, is AAUDIO_UNSPECIFIED, |
Phil Burk | e057ca9 | 2017-03-28 11:31:34 -0700 | [diff] [blame] | 337 | * in which case the primary device will be used. |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 338 | * |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 339 | * @param builder reference provided by AAudio_createStreamBuilder() |
Glenn Kasten | 5f510d2 | 2017-05-30 15:52:15 -0700 | [diff] [blame] | 340 | * @param deviceId device identifier or AAUDIO_UNSPECIFIED |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 341 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 342 | AAUDIO_API void AAudioStreamBuilder_setDeviceId(AAudioStreamBuilder* builder, |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 343 | int32_t deviceId); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 344 | |
| 345 | /** |
Phil Burk | e057ca9 | 2017-03-28 11:31:34 -0700 | [diff] [blame] | 346 | * Request a sample rate in Hertz. |
| 347 | * |
Phil Burk | e057ca9 | 2017-03-28 11:31:34 -0700 | [diff] [blame] | 348 | * The default, if you do not call this function, is AAUDIO_UNSPECIFIED. |
Phil Burk | 8f62489 | 2017-05-11 11:44:20 -0700 | [diff] [blame] | 349 | * An optimal value will then be chosen when the stream is opened. |
| 350 | * After opening a stream with an unspecified value, the application must |
| 351 | * query for the actual value, which may vary by device. |
| 352 | * |
| 353 | * If an exact value is specified then an opened stream will use that value. |
| 354 | * If a stream cannot be opened with the specified value then the open will fail. |
Phil Burk | e057ca9 | 2017-03-28 11:31:34 -0700 | [diff] [blame] | 355 | * |
| 356 | * @param builder reference provided by AAudio_createStreamBuilder() |
| 357 | * @param sampleRate frames per second. Common rates include 44100 and 48000 Hz. |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 358 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 359 | AAUDIO_API void AAudioStreamBuilder_setSampleRate(AAudioStreamBuilder* builder, |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 360 | int32_t sampleRate); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 361 | |
| 362 | /** |
Phil Burk | 20523ed | 2017-04-24 17:04:01 -0700 | [diff] [blame] | 363 | * Request a number of channels for the stream. |
Phil Burk | e057ca9 | 2017-03-28 11:31:34 -0700 | [diff] [blame] | 364 | * |
Phil Burk | e057ca9 | 2017-03-28 11:31:34 -0700 | [diff] [blame] | 365 | * The default, if you do not call this function, is AAUDIO_UNSPECIFIED. |
Phil Burk | 8f62489 | 2017-05-11 11:44:20 -0700 | [diff] [blame] | 366 | * An optimal value will then be chosen when the stream is opened. |
| 367 | * After opening a stream with an unspecified value, the application must |
| 368 | * query for the actual value, which may vary by device. |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 369 | * |
Phil Burk | 8f62489 | 2017-05-11 11:44:20 -0700 | [diff] [blame] | 370 | * If an exact value is specified then an opened stream will use that value. |
| 371 | * If a stream cannot be opened with the specified value then the open will fail. |
Phil Burk | e057ca9 | 2017-03-28 11:31:34 -0700 | [diff] [blame] | 372 | * |
| 373 | * @param builder reference provided by AAudio_createStreamBuilder() |
Phil Burk | 20523ed | 2017-04-24 17:04:01 -0700 | [diff] [blame] | 374 | * @param channelCount Number of channels desired. |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 375 | */ |
Phil Burk | 20523ed | 2017-04-24 17:04:01 -0700 | [diff] [blame] | 376 | AAUDIO_API void AAudioStreamBuilder_setChannelCount(AAudioStreamBuilder* builder, |
| 377 | int32_t channelCount); |
| 378 | |
| 379 | /** |
Phil Burk | e74240d | 2017-08-03 15:25:43 -0700 | [diff] [blame] | 380 | * Identical to AAudioStreamBuilder_setChannelCount(). |
| 381 | * |
| 382 | * @param builder reference provided by AAudio_createStreamBuilder() |
| 383 | * @param samplesPerFrame Number of samples in a frame. |
| 384 | */ |
| 385 | AAUDIO_API void AAudioStreamBuilder_setSamplesPerFrame(AAudioStreamBuilder* builder, |
| 386 | int32_t samplesPerFrame); |
| 387 | |
| 388 | /** |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 389 | * Request a sample data format, for example AAUDIO_FORMAT_PCM_I16. |
Phil Burk | e057ca9 | 2017-03-28 11:31:34 -0700 | [diff] [blame] | 390 | * |
| 391 | * The default, if you do not call this function, is AAUDIO_UNSPECIFIED. |
Phil Burk | 8f62489 | 2017-05-11 11:44:20 -0700 | [diff] [blame] | 392 | * An optimal value will then be chosen when the stream is opened. |
| 393 | * After opening a stream with an unspecified value, the application must |
| 394 | * query for the actual value, which may vary by device. |
Phil Burk | e057ca9 | 2017-03-28 11:31:34 -0700 | [diff] [blame] | 395 | * |
Phil Burk | 8f62489 | 2017-05-11 11:44:20 -0700 | [diff] [blame] | 396 | * If an exact value is specified then an opened stream will use that value. |
| 397 | * If a stream cannot be opened with the specified value then the open will fail. |
Phil Burk | e057ca9 | 2017-03-28 11:31:34 -0700 | [diff] [blame] | 398 | * |
| 399 | * @param builder reference provided by AAudio_createStreamBuilder() |
Phil Burk | 8f62489 | 2017-05-11 11:44:20 -0700 | [diff] [blame] | 400 | * @param format common formats are AAUDIO_FORMAT_PCM_FLOAT and AAUDIO_FORMAT_PCM_I16. |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 401 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 402 | AAUDIO_API void AAudioStreamBuilder_setFormat(AAudioStreamBuilder* builder, |
Phil Burk | 9dca982 | 2017-05-26 14:27:43 -0700 | [diff] [blame] | 403 | aaudio_format_t format); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 404 | |
| 405 | /** |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 406 | * Request a mode for sharing the device. |
Phil Burk | e057ca9 | 2017-03-28 11:31:34 -0700 | [diff] [blame] | 407 | * |
| 408 | * The default, if you do not call this function, is AAUDIO_SHARING_MODE_SHARED. |
| 409 | * |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 410 | * The requested sharing mode may not be available. |
Phil Burk | e057ca9 | 2017-03-28 11:31:34 -0700 | [diff] [blame] | 411 | * The application can query for the actual mode after the stream is opened. |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 412 | * |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 413 | * @param builder reference provided by AAudio_createStreamBuilder() |
Phil Burk | e057ca9 | 2017-03-28 11:31:34 -0700 | [diff] [blame] | 414 | * @param sharingMode AAUDIO_SHARING_MODE_SHARED or AAUDIO_SHARING_MODE_EXCLUSIVE |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 415 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 416 | AAUDIO_API void AAudioStreamBuilder_setSharingMode(AAudioStreamBuilder* builder, |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 417 | aaudio_sharing_mode_t sharingMode); |
| 418 | |
| 419 | /** |
Phil Burk | e057ca9 | 2017-03-28 11:31:34 -0700 | [diff] [blame] | 420 | * Request the direction for a stream. |
| 421 | * |
| 422 | * The default, if you do not call this function, is AAUDIO_DIRECTION_OUTPUT. |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 423 | * |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 424 | * @param builder reference provided by AAudio_createStreamBuilder() |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 425 | * @param direction AAUDIO_DIRECTION_OUTPUT or AAUDIO_DIRECTION_INPUT |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 426 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 427 | AAUDIO_API void AAudioStreamBuilder_setDirection(AAudioStreamBuilder* builder, |
Phil Burk | 3df348f | 2017-02-08 11:41:55 -0800 | [diff] [blame] | 428 | aaudio_direction_t direction); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 429 | |
| 430 | /** |
Phil Burk | e057ca9 | 2017-03-28 11:31:34 -0700 | [diff] [blame] | 431 | * Set the requested buffer capacity in frames. |
Phil Burk | 3df348f | 2017-02-08 11:41:55 -0800 | [diff] [blame] | 432 | * The final AAudioStream capacity may differ, but will probably be at least this big. |
| 433 | * |
Phil Burk | e057ca9 | 2017-03-28 11:31:34 -0700 | [diff] [blame] | 434 | * The default, if you do not call this function, is AAUDIO_UNSPECIFIED. |
Phil Burk | 3df348f | 2017-02-08 11:41:55 -0800 | [diff] [blame] | 435 | * |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 436 | * @param builder reference provided by AAudio_createStreamBuilder() |
Phil Burk | e057ca9 | 2017-03-28 11:31:34 -0700 | [diff] [blame] | 437 | * @param numFrames the desired buffer capacity in frames or AAUDIO_UNSPECIFIED |
Phil Burk | 3df348f | 2017-02-08 11:41:55 -0800 | [diff] [blame] | 438 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 439 | AAUDIO_API void AAudioStreamBuilder_setBufferCapacityInFrames(AAudioStreamBuilder* builder, |
Phil Burk | e057ca9 | 2017-03-28 11:31:34 -0700 | [diff] [blame] | 440 | int32_t numFrames); |
Phil Burk | e2fbb59 | 2017-05-01 15:05:52 -0700 | [diff] [blame] | 441 | |
| 442 | /** |
| 443 | * Set the requested performance mode. |
| 444 | * |
| 445 | * The default, if you do not call this function, is AAUDIO_PERFORMANCE_MODE_NONE. |
| 446 | * |
| 447 | * @param builder reference provided by AAudio_createStreamBuilder() |
| 448 | * @param mode the desired performance mode, eg. AAUDIO_PERFORMANCE_MODE_LOW_LATENCY |
| 449 | */ |
| 450 | AAUDIO_API void AAudioStreamBuilder_setPerformanceMode(AAudioStreamBuilder* builder, |
| 451 | aaudio_performance_mode_t mode); |
| 452 | |
Phil Burk | e057ca9 | 2017-03-28 11:31:34 -0700 | [diff] [blame] | 453 | /** |
Phil Burk | 361b142 | 2017-12-20 14:24:16 -0800 | [diff] [blame^] | 454 | * Set the intended use case for the stream. |
| 455 | * |
| 456 | * The AAudio system will use this information to optimize the |
| 457 | * behavior of the stream. |
| 458 | * This could, for example, affect how volume and focus is handled for the stream. |
| 459 | * |
| 460 | * The default, if you do not call this function, is AAUDIO_USAGE_MEDIA. |
| 461 | * |
| 462 | * @param builder reference provided by AAudio_createStreamBuilder() |
| 463 | * @param usage the desired usage, eg. AAUDIO_USAGE_GAME |
| 464 | */ |
| 465 | AAUDIO_API void AAudioStreamBuilder_setUsage(AAudioStreamBuilder* builder, |
| 466 | aaudio_usage_t usage); |
| 467 | |
| 468 | /** |
| 469 | * Set the type of audio data that the stream will carry. |
| 470 | * |
| 471 | * The AAudio system will use this information to optimize the |
| 472 | * behavior of the stream. |
| 473 | * This could, for example, affect whether a stream is paused when a notification occurs. |
| 474 | * |
| 475 | * The default, if you do not call this function, is AAUDIO_CONTENT_TYPE_MUSIC. |
| 476 | * |
| 477 | * @param builder reference provided by AAudio_createStreamBuilder() |
| 478 | * @param contentType the type of audio data, eg. AAUDIO_CONTENT_TYPE_SPEECH |
| 479 | */ |
| 480 | AAUDIO_API void AAudioStreamBuilder_setContentType(AAudioStreamBuilder* builder, |
| 481 | aaudio_content_type_t contentType); |
| 482 | |
| 483 | /** |
| 484 | * Set the input (capture) preset for the stream. |
| 485 | * |
| 486 | * The AAudio system will use this information to optimize the |
| 487 | * behavior of the stream. |
| 488 | * This could, for example, affect which microphones are used and how the |
| 489 | * recorded data is processed. |
| 490 | * |
| 491 | * The default, if you do not call this function, is AAUDIO_INPUT_PRESET_GENERIC. |
| 492 | * |
| 493 | * @param builder reference provided by AAudio_createStreamBuilder() |
| 494 | * @param inputPreset the desired configuration for recording |
| 495 | */ |
| 496 | AAUDIO_API void AAudioStreamBuilder_setInputPreset(AAudioStreamBuilder* builder, |
| 497 | aaudio_input_preset_t inputPreset); |
| 498 | |
| 499 | /** |
Phil Burk | e057ca9 | 2017-03-28 11:31:34 -0700 | [diff] [blame] | 500 | * Return one of these values from the data callback function. |
| 501 | */ |
| 502 | enum { |
| 503 | |
| 504 | /** |
| 505 | * Continue calling the callback. |
| 506 | */ |
| 507 | AAUDIO_CALLBACK_RESULT_CONTINUE = 0, |
| 508 | |
| 509 | /** |
| 510 | * Stop calling the callback. |
| 511 | * |
| 512 | * The application will still need to call AAudioStream_requestPause() |
| 513 | * or AAudioStream_requestStop(). |
| 514 | */ |
| 515 | AAUDIO_CALLBACK_RESULT_STOP, |
| 516 | |
| 517 | }; |
| 518 | typedef int32_t aaudio_data_callback_result_t; |
| 519 | |
| 520 | /** |
| 521 | * Prototype for the data function that is passed to AAudioStreamBuilder_setDataCallback(). |
| 522 | * |
| 523 | * For an output stream, this function should render and write numFrames of data |
| 524 | * in the streams current data format to the audioData buffer. |
| 525 | * |
| 526 | * For an input stream, this function should read and process numFrames of data |
| 527 | * from the audioData buffer. |
| 528 | * |
| 529 | * Note that this callback function should be considered a "real-time" function. |
| 530 | * It must not do anything that could cause an unbounded delay because that can cause the |
| 531 | * audio to glitch or pop. |
| 532 | * |
| 533 | * These are things the function should NOT do: |
| 534 | * <ul> |
| 535 | * <li>allocate memory using, for example, malloc() or new</li> |
| 536 | * <li>any file operations such as opening, closing, reading or writing</li> |
| 537 | * <li>any network operations such as streaming</li> |
| 538 | * <li>use any mutexes or other synchronization primitives</li> |
| 539 | * <li>sleep</li> |
| 540 | * </ul> |
| 541 | * |
| 542 | * If you need to move data, eg. MIDI commands, in or out of the callback function then |
| 543 | * we recommend the use of non-blocking techniques such as an atomic FIFO. |
| 544 | * |
| 545 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
| 546 | * @param userData the same address that was passed to AAudioStreamBuilder_setCallback() |
| 547 | * @param audioData a pointer to the audio data |
| 548 | * @param numFrames the number of frames to be processed |
| 549 | * @return AAUDIO_CALLBACK_RESULT_* |
| 550 | */ |
| 551 | typedef aaudio_data_callback_result_t (*AAudioStream_dataCallback)( |
| 552 | AAudioStream *stream, |
| 553 | void *userData, |
| 554 | void *audioData, |
| 555 | int32_t numFrames); |
| 556 | |
| 557 | /** |
| 558 | * Request that AAudio call this functions when the stream is running. |
| 559 | * |
| 560 | * Note that when using this callback, the audio data will be passed in or out |
| 561 | * of the function as an argument. |
| 562 | * So you cannot call AAudioStream_write() or AAudioStream_read() on the same stream |
| 563 | * that has an active data callback. |
| 564 | * |
| 565 | * The callback function will start being called after AAudioStream_requestStart() is called. |
| 566 | * It will stop being called after AAudioStream_requestPause() or |
| 567 | * AAudioStream_requestStop() is called. |
| 568 | * |
| 569 | * This callback function will be called on a real-time thread owned by AAudio. See |
Glenn Kasten | 0d80436 | 2017-04-13 09:20:14 -0700 | [diff] [blame] | 570 | * {@link AAudioStream_dataCallback} for more information. |
Phil Burk | e057ca9 | 2017-03-28 11:31:34 -0700 | [diff] [blame] | 571 | * |
| 572 | * Note that the AAudio callbacks will never be called simultaneously from multiple threads. |
| 573 | * |
| 574 | * @param builder reference provided by AAudio_createStreamBuilder() |
| 575 | * @param callback pointer to a function that will process audio data. |
| 576 | * @param userData pointer to an application data structure that will be passed |
| 577 | * to the callback functions. |
| 578 | */ |
| 579 | AAUDIO_API void AAudioStreamBuilder_setDataCallback(AAudioStreamBuilder* builder, |
| 580 | AAudioStream_dataCallback callback, |
| 581 | void *userData); |
| 582 | |
| 583 | /** |
| 584 | * Set the requested data callback buffer size in frames. |
| 585 | * See {@link AAudioStream_dataCallback}. |
| 586 | * |
| 587 | * The default, if you do not call this function, is AAUDIO_UNSPECIFIED. |
| 588 | * |
| 589 | * For the lowest possible latency, do not call this function. AAudio will then |
| 590 | * call the dataProc callback function with whatever size is optimal. |
| 591 | * That size may vary from one callback to another. |
| 592 | * |
| 593 | * Only use this function if the application requires a specific number of frames for processing. |
| 594 | * The application might, for example, be using an FFT that requires |
| 595 | * a specific power-of-two sized buffer. |
| 596 | * |
| 597 | * AAudio may need to add additional buffering in order to adapt between the internal |
| 598 | * buffer size and the requested buffer size. |
| 599 | * |
| 600 | * If you do call this function then the requested size should be less than |
| 601 | * half the buffer capacity, to allow double buffering. |
| 602 | * |
| 603 | * @param builder reference provided by AAudio_createStreamBuilder() |
| 604 | * @param numFrames the desired buffer size in frames or AAUDIO_UNSPECIFIED |
| 605 | */ |
| 606 | AAUDIO_API void AAudioStreamBuilder_setFramesPerDataCallback(AAudioStreamBuilder* builder, |
| 607 | int32_t numFrames); |
| 608 | |
| 609 | /** |
| 610 | * Prototype for the callback function that is passed to |
| 611 | * AAudioStreamBuilder_setErrorCallback(). |
| 612 | * |
| 613 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
| 614 | * @param userData the same address that was passed to AAudioStreamBuilder_setErrorCallback() |
| 615 | * @param error an AAUDIO_ERROR_* value. |
| 616 | */ |
| 617 | typedef void (*AAudioStream_errorCallback)( |
| 618 | AAudioStream *stream, |
| 619 | void *userData, |
| 620 | aaudio_result_t error); |
| 621 | |
| 622 | /** |
| 623 | * Request that AAudio call this functions if any error occurs on a callback thread. |
| 624 | * |
| 625 | * It will be called, for example, if a headset or a USB device is unplugged causing the stream's |
| 626 | * device to be unavailable. |
| 627 | * In response, this function could signal or launch another thread to reopen a |
| 628 | * stream on another device. Do not reopen the stream in this callback. |
| 629 | * |
| 630 | * This will not be called because of actions by the application, such as stopping |
| 631 | * or closing a stream. |
| 632 | * |
| 633 | * Another possible cause of error would be a timeout or an unanticipated internal error. |
| 634 | * |
| 635 | * Note that the AAudio callbacks will never be called simultaneously from multiple threads. |
| 636 | * |
| 637 | * @param builder reference provided by AAudio_createStreamBuilder() |
| 638 | * @param callback pointer to a function that will be called if an error occurs. |
| 639 | * @param userData pointer to an application data structure that will be passed |
| 640 | * to the callback functions. |
| 641 | */ |
| 642 | AAUDIO_API void AAudioStreamBuilder_setErrorCallback(AAudioStreamBuilder* builder, |
| 643 | AAudioStream_errorCallback callback, |
| 644 | void *userData); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 645 | |
| 646 | /** |
| 647 | * Open a stream based on the options in the StreamBuilder. |
| 648 | * |
| 649 | * AAudioStream_close must be called when finished with the stream to recover |
| 650 | * the memory and to free the associated resources. |
| 651 | * |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 652 | * @param builder reference provided by AAudio_createStreamBuilder() |
| 653 | * @param stream pointer to a variable to receive the new stream reference |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 654 | * @return AAUDIO_OK or a negative error. |
| 655 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 656 | AAUDIO_API aaudio_result_t AAudioStreamBuilder_openStream(AAudioStreamBuilder* builder, |
| 657 | AAudioStream** stream); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 658 | |
| 659 | /** |
| 660 | * Delete the resources associated with the StreamBuilder. |
| 661 | * |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 662 | * @param builder reference provided by AAudio_createStreamBuilder() |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 663 | * @return AAUDIO_OK or a negative error. |
| 664 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 665 | AAUDIO_API aaudio_result_t AAudioStreamBuilder_delete(AAudioStreamBuilder* builder); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 666 | |
| 667 | // ============================================================ |
| 668 | // Stream Control |
| 669 | // ============================================================ |
| 670 | |
| 671 | /** |
| 672 | * Free the resources associated with a stream created by AAudioStreamBuilder_openStream() |
| 673 | * |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 674 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 675 | * @return AAUDIO_OK or a negative error. |
| 676 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 677 | AAUDIO_API aaudio_result_t AAudioStream_close(AAudioStream* stream); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 678 | |
| 679 | /** |
| 680 | * Asynchronously request to start playing the stream. For output streams, one should |
| 681 | * write to the stream to fill the buffer before starting. |
| 682 | * Otherwise it will underflow. |
| 683 | * After this call the state will be in AAUDIO_STREAM_STATE_STARTING or AAUDIO_STREAM_STATE_STARTED. |
| 684 | * |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 685 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 686 | * @return AAUDIO_OK or a negative error. |
| 687 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 688 | AAUDIO_API aaudio_result_t AAudioStream_requestStart(AAudioStream* stream); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 689 | |
| 690 | /** |
| 691 | * Asynchronous request for the stream to pause. |
| 692 | * Pausing a stream will freeze the data flow but not flush any buffers. |
| 693 | * Use AAudioStream_Start() to resume playback after a pause. |
| 694 | * After this call the state will be in AAUDIO_STREAM_STATE_PAUSING or AAUDIO_STREAM_STATE_PAUSED. |
| 695 | * |
Phil Burk | 068c10f | 2017-05-08 16:36:41 -0700 | [diff] [blame] | 696 | * This will return AAUDIO_ERROR_UNIMPLEMENTED for input streams. |
| 697 | * For input streams use AAudioStream_requestStop(). |
| 698 | * |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 699 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 700 | * @return AAUDIO_OK or a negative error. |
| 701 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 702 | AAUDIO_API aaudio_result_t AAudioStream_requestPause(AAudioStream* stream); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 703 | |
| 704 | /** |
| 705 | * Asynchronous request for the stream to flush. |
| 706 | * Flushing will discard any pending data. |
| 707 | * This call only works if the stream is pausing or paused. TODO review |
| 708 | * Frame counters are not reset by a flush. They may be advanced. |
| 709 | * After this call the state will be in AAUDIO_STREAM_STATE_FLUSHING or AAUDIO_STREAM_STATE_FLUSHED. |
| 710 | * |
Phil Burk | 068c10f | 2017-05-08 16:36:41 -0700 | [diff] [blame] | 711 | * This will return AAUDIO_ERROR_UNIMPLEMENTED for input streams. |
| 712 | * |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 713 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 714 | * @return AAUDIO_OK or a negative error. |
| 715 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 716 | AAUDIO_API aaudio_result_t AAudioStream_requestFlush(AAudioStream* stream); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 717 | |
| 718 | /** |
| 719 | * Asynchronous request for the stream to stop. |
| 720 | * The stream will stop after all of the data currently buffered has been played. |
| 721 | * After this call the state will be in AAUDIO_STREAM_STATE_STOPPING or AAUDIO_STREAM_STATE_STOPPED. |
| 722 | * |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 723 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 724 | * @return AAUDIO_OK or a negative error. |
| 725 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 726 | AAUDIO_API aaudio_result_t AAudioStream_requestStop(AAudioStream* stream); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 727 | |
| 728 | /** |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 729 | * Query the current state of the client, eg. AAUDIO_STREAM_STATE_PAUSING |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 730 | * |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 731 | * This function will immediately return the state without updating the state. |
| 732 | * If you want to update the client state based on the server state then |
| 733 | * call AAudioStream_waitForStateChange() with currentState |
| 734 | * set to AAUDIO_STREAM_STATE_UNKNOWN and a zero timeout. |
| 735 | * |
| 736 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 737 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 738 | AAUDIO_API aaudio_stream_state_t AAudioStream_getState(AAudioStream* stream); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 739 | |
| 740 | /** |
| 741 | * Wait until the current state no longer matches the input state. |
| 742 | * |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 743 | * This will update the current client state. |
| 744 | * |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 745 | * <pre><code> |
| 746 | * aaudio_stream_state_t currentState; |
| 747 | * aaudio_result_t result = AAudioStream_getState(stream, ¤tState); |
| 748 | * while (result == AAUDIO_OK && currentState != AAUDIO_STREAM_STATE_PAUSING) { |
| 749 | * result = AAudioStream_waitForStateChange( |
| 750 | * stream, currentState, ¤tState, MY_TIMEOUT_NANOS); |
| 751 | * } |
| 752 | * </code></pre> |
| 753 | * |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 754 | * @param stream A reference provided by AAudioStreamBuilder_openStream() |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 755 | * @param inputState The state we want to avoid. |
| 756 | * @param nextState Pointer to a variable that will be set to the new state. |
| 757 | * @param timeoutNanoseconds Maximum number of nanoseconds to wait for completion. |
| 758 | * @return AAUDIO_OK or a negative error. |
| 759 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 760 | AAUDIO_API aaudio_result_t AAudioStream_waitForStateChange(AAudioStream* stream, |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 761 | aaudio_stream_state_t inputState, |
| 762 | aaudio_stream_state_t *nextState, |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 763 | int64_t timeoutNanoseconds); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 764 | |
| 765 | // ============================================================ |
| 766 | // Stream I/O |
| 767 | // ============================================================ |
| 768 | |
| 769 | /** |
| 770 | * Read data from the stream. |
| 771 | * |
| 772 | * The call will wait until the read is complete or until it runs out of time. |
| 773 | * If timeoutNanos is zero then this call will not wait. |
| 774 | * |
| 775 | * Note that timeoutNanoseconds is a relative duration in wall clock time. |
| 776 | * Time will not stop if the thread is asleep. |
| 777 | * So it will be implemented using CLOCK_BOOTTIME. |
| 778 | * |
| 779 | * This call is "strong non-blocking" unless it has to wait for data. |
| 780 | * |
| 781 | * @param stream A stream created using AAudioStreamBuilder_openStream(). |
| 782 | * @param buffer The address of the first sample. |
| 783 | * @param numFrames Number of frames to read. Only complete frames will be written. |
| 784 | * @param timeoutNanoseconds Maximum number of nanoseconds to wait for completion. |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 785 | * @return The number of frames actually read or a negative error. |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 786 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 787 | AAUDIO_API aaudio_result_t AAudioStream_read(AAudioStream* stream, |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 788 | void *buffer, |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 789 | int32_t numFrames, |
| 790 | int64_t timeoutNanoseconds); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 791 | |
| 792 | /** |
| 793 | * Write data to the stream. |
| 794 | * |
| 795 | * The call will wait until the write is complete or until it runs out of time. |
| 796 | * If timeoutNanos is zero then this call will not wait. |
| 797 | * |
| 798 | * Note that timeoutNanoseconds is a relative duration in wall clock time. |
| 799 | * Time will not stop if the thread is asleep. |
| 800 | * So it will be implemented using CLOCK_BOOTTIME. |
| 801 | * |
| 802 | * This call is "strong non-blocking" unless it has to wait for room in the buffer. |
| 803 | * |
| 804 | * @param stream A stream created using AAudioStreamBuilder_openStream(). |
| 805 | * @param buffer The address of the first sample. |
| 806 | * @param numFrames Number of frames to write. Only complete frames will be written. |
| 807 | * @param timeoutNanoseconds Maximum number of nanoseconds to wait for completion. |
| 808 | * @return The number of frames actually written or a negative error. |
| 809 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 810 | AAUDIO_API aaudio_result_t AAudioStream_write(AAudioStream* stream, |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 811 | const void *buffer, |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 812 | int32_t numFrames, |
| 813 | int64_t timeoutNanoseconds); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 814 | |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 815 | // ============================================================ |
| 816 | // Stream - queries |
| 817 | // ============================================================ |
| 818 | |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 819 | /** |
| 820 | * This can be used to adjust the latency of the buffer by changing |
| 821 | * the threshold where blocking will occur. |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 822 | * By combining this with AAudioStream_getXRunCount(), the latency can be tuned |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 823 | * at run-time for each device. |
| 824 | * |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 825 | * This cannot be set higher than AAudioStream_getBufferCapacityInFrames(). |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 826 | * |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 827 | * Note that you will probably not get the exact size you request. |
| 828 | * Call AAudioStream_getBufferSizeInFrames() to see what the actual final size is. |
| 829 | * |
| 830 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
Phil Burk | e057ca9 | 2017-03-28 11:31:34 -0700 | [diff] [blame] | 831 | * @param numFrames requested number of frames that can be filled without blocking |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 832 | * @return actual buffer size in frames or a negative error |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 833 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 834 | AAUDIO_API aaudio_result_t AAudioStream_setBufferSizeInFrames(AAudioStream* stream, |
Phil Burk | e057ca9 | 2017-03-28 11:31:34 -0700 | [diff] [blame] | 835 | int32_t numFrames); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 836 | |
| 837 | /** |
| 838 | * Query the maximum number of frames that can be filled without blocking. |
| 839 | * |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 840 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
| 841 | * @return buffer size in frames. |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 842 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 843 | AAUDIO_API int32_t AAudioStream_getBufferSizeInFrames(AAudioStream* stream); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 844 | |
| 845 | /** |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 846 | * Query the number of frames that the application should read or write at |
| 847 | * one time for optimal performance. It is OK if an application writes |
| 848 | * a different number of frames. But the buffer size may need to be larger |
| 849 | * in order to avoid underruns or overruns. |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 850 | * |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 851 | * Note that this may or may not match the actual device burst size. |
| 852 | * For some endpoints, the burst size can vary dynamically. |
| 853 | * But these tend to be devices with high latency. |
| 854 | * |
| 855 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
| 856 | * @return burst size |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 857 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 858 | AAUDIO_API int32_t AAudioStream_getFramesPerBurst(AAudioStream* stream); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 859 | |
| 860 | /** |
| 861 | * Query maximum buffer capacity in frames. |
| 862 | * |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 863 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
Phil Burk | e057ca9 | 2017-03-28 11:31:34 -0700 | [diff] [blame] | 864 | * @return buffer capacity in frames |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 865 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 866 | AAUDIO_API int32_t AAudioStream_getBufferCapacityInFrames(AAudioStream* stream); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 867 | |
| 868 | /** |
Phil Burk | e057ca9 | 2017-03-28 11:31:34 -0700 | [diff] [blame] | 869 | * Query the size of the buffer that will be passed to the dataProc callback |
| 870 | * in the numFrames parameter. |
| 871 | * |
| 872 | * This call can be used if the application needs to know the value of numFrames before |
| 873 | * the stream is started. This is not normally necessary. |
| 874 | * |
| 875 | * If a specific size was requested by calling AAudioStreamBuilder_setCallbackSizeInFrames() |
| 876 | * then this will be the same size. |
| 877 | * |
| 878 | * If AAudioStreamBuilder_setCallbackSizeInFrames() was not called then this will |
| 879 | * return the size chosen by AAudio, or AAUDIO_UNSPECIFIED. |
| 880 | * |
| 881 | * AAUDIO_UNSPECIFIED indicates that the callback buffer size for this stream |
| 882 | * may vary from one dataProc callback to the next. |
| 883 | * |
| 884 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
| 885 | * @return callback buffer size in frames or AAUDIO_UNSPECIFIED |
| 886 | */ |
| 887 | AAUDIO_API int32_t AAudioStream_getFramesPerDataCallback(AAudioStream* stream); |
| 888 | |
| 889 | /** |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 890 | * An XRun is an Underrun or an Overrun. |
| 891 | * During playing, an underrun will occur if the stream is not written in time |
| 892 | * and the system runs out of valid data. |
| 893 | * During recording, an overrun will occur if the stream is not read in time |
| 894 | * and there is no place to put the incoming data so it is discarded. |
| 895 | * |
| 896 | * An underrun or overrun can cause an audible "pop" or "glitch". |
| 897 | * |
Phil Burk | 068c10f | 2017-05-08 16:36:41 -0700 | [diff] [blame] | 898 | * Note that some INPUT devices may not support this function. |
| 899 | * In that case a 0 will always be returned. |
| 900 | * |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 901 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
| 902 | * @return the underrun or overrun count |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 903 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 904 | AAUDIO_API int32_t AAudioStream_getXRunCount(AAudioStream* stream); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 905 | |
| 906 | /** |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 907 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
| 908 | * @return actual sample rate |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 909 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 910 | AAUDIO_API int32_t AAudioStream_getSampleRate(AAudioStream* stream); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 911 | |
| 912 | /** |
Phil Burk | 20523ed | 2017-04-24 17:04:01 -0700 | [diff] [blame] | 913 | * A stream has one or more channels of data. |
| 914 | * A frame will contain one sample for each channel. |
| 915 | * |
| 916 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
| 917 | * @return actual number of channels |
| 918 | */ |
| 919 | AAUDIO_API int32_t AAudioStream_getChannelCount(AAudioStream* stream); |
| 920 | |
| 921 | /** |
Phil Burk | e74240d | 2017-08-03 15:25:43 -0700 | [diff] [blame] | 922 | * Identical to AAudioStream_getChannelCount(). |
| 923 | * |
| 924 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
| 925 | * @return actual number of samples frame |
| 926 | */ |
| 927 | AAUDIO_API int32_t AAudioStream_getSamplesPerFrame(AAudioStream* stream); |
| 928 | |
| 929 | /** |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 930 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 931 | * @return actual device ID |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 932 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 933 | AAUDIO_API int32_t AAudioStream_getDeviceId(AAudioStream* stream); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 934 | |
| 935 | /** |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 936 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
| 937 | * @return actual data format |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 938 | */ |
Phil Burk | 9dca982 | 2017-05-26 14:27:43 -0700 | [diff] [blame] | 939 | AAUDIO_API aaudio_format_t AAudioStream_getFormat(AAudioStream* stream); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 940 | |
| 941 | /** |
| 942 | * Provide actual sharing mode. |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 943 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
| 944 | * @return actual sharing mode |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 945 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 946 | AAUDIO_API aaudio_sharing_mode_t AAudioStream_getSharingMode(AAudioStream* stream); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 947 | |
| 948 | /** |
Phil Burk | e2fbb59 | 2017-05-01 15:05:52 -0700 | [diff] [blame] | 949 | * Get the performance mode used by the stream. |
| 950 | * |
| 951 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
| 952 | */ |
| 953 | AAUDIO_API aaudio_performance_mode_t AAudioStream_getPerformanceMode(AAudioStream* stream); |
| 954 | |
| 955 | /** |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 956 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
| 957 | * @return direction |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 958 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 959 | AAUDIO_API aaudio_direction_t AAudioStream_getDirection(AAudioStream* stream); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 960 | |
| 961 | /** |
| 962 | * Passes back the number of frames that have been written since the stream was created. |
| 963 | * For an output stream, this will be advanced by the application calling write(). |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 964 | * For an input stream, this will be advanced by the endpoint. |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 965 | * |
| 966 | * The frame position is monotonically increasing. |
| 967 | * |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 968 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
| 969 | * @return frames written |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 970 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 971 | AAUDIO_API int64_t AAudioStream_getFramesWritten(AAudioStream* stream); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 972 | |
| 973 | /** |
| 974 | * Passes back the number of frames that have been read since the stream was created. |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 975 | * For an output stream, this will be advanced by the endpoint. |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 976 | * For an input stream, this will be advanced by the application calling read(). |
| 977 | * |
| 978 | * The frame position is monotonically increasing. |
| 979 | * |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 980 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
| 981 | * @return frames read |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 982 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 983 | AAUDIO_API int64_t AAudioStream_getFramesRead(AAudioStream* stream); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 984 | |
| 985 | /** |
| 986 | * Passes back the time at which a particular frame was presented. |
| 987 | * This can be used to synchronize audio with video or MIDI. |
| 988 | * It can also be used to align a recorded stream with a playback stream. |
| 989 | * |
| 990 | * Timestamps are only valid when the stream is in AAUDIO_STREAM_STATE_STARTED. |
| 991 | * AAUDIO_ERROR_INVALID_STATE will be returned if the stream is not started. |
| 992 | * Note that because requestStart() is asynchronous, timestamps will not be valid until |
| 993 | * a short time after calling requestStart(). |
| 994 | * So AAUDIO_ERROR_INVALID_STATE should not be considered a fatal error. |
| 995 | * Just try calling again later. |
| 996 | * |
| 997 | * If an error occurs, then the position and time will not be modified. |
| 998 | * |
| 999 | * The position and time passed back are monotonically increasing. |
| 1000 | * |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 1001 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
Phil Burk | ec15950 | 2017-07-25 17:33:47 -0700 | [diff] [blame] | 1002 | * @param clockid CLOCK_MONOTONIC or CLOCK_BOOTTIME |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 1003 | * @param framePosition pointer to a variable to receive the position |
| 1004 | * @param timeNanoseconds pointer to a variable to receive the time |
| 1005 | * @return AAUDIO_OK or a negative error |
| 1006 | */ |
Phil Burk | e2155ef | 2017-02-24 13:50:29 -0800 | [diff] [blame] | 1007 | AAUDIO_API aaudio_result_t AAudioStream_getTimestamp(AAudioStream* stream, |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 1008 | clockid_t clockid, |
| 1009 | int64_t *framePosition, |
| 1010 | int64_t *timeNanoseconds); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 1011 | |
Phil Burk | 361b142 | 2017-12-20 14:24:16 -0800 | [diff] [blame^] | 1012 | /** |
| 1013 | * Return the use case for the stream. |
| 1014 | * |
| 1015 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
| 1016 | * @return frames read |
| 1017 | */ |
| 1018 | AAUDIO_API aaudio_usage_t AAudioStream_getUsage(AAudioStream* stream); |
| 1019 | |
| 1020 | /** |
| 1021 | * Return the content type for the stream. |
| 1022 | * |
| 1023 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
| 1024 | * @return content type, for example AAUDIO_CONTENT_TYPE_MUSIC |
| 1025 | */ |
| 1026 | AAUDIO_API aaudio_content_type_t AAudioStream_getContentType(AAudioStream* stream); |
| 1027 | |
| 1028 | /** |
| 1029 | * Return the input preset for the stream. |
| 1030 | * |
| 1031 | * @param stream reference provided by AAudioStreamBuilder_openStream() |
| 1032 | * @return input preset, for example AAUDIO_INPUT_PRESET_CAMCORDER |
| 1033 | */ |
| 1034 | AAUDIO_API aaudio_input_preset_t AAudioStream_getInputPreset(AAudioStream* stream); |
| 1035 | |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 1036 | #ifdef __cplusplus |
| 1037 | } |
| 1038 | #endif |
| 1039 | |
| 1040 | #endif //AAUDIO_AAUDIO_H |
Phil Burk | a45be8b | 2017-04-05 14:45:48 -0700 | [diff] [blame] | 1041 | |
| 1042 | /** @} */ |