blob: 5b7b8199622dd07518154a3031db383ee6292fc6 [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 -080026typedef int32_t aaudio_result_t;
Phil Burk5ed503c2017-02-01 09:38:15 -080027
28/**
29 * This is used to represent a value that has not been specified.
30 * For example, an application could use AAUDIO_UNSPECIFIED to indicate
31 * that is did not not care what the specific value of a parameter was
32 * and would accept whatever it was given.
33 */
34#define AAUDIO_UNSPECIFIED 0
Phil Burk3316d5e2017-02-15 11:23:01 -080035#define AAUDIO_DEVICE_UNSPECIFIED ((int32_t) -1)
Phil Burk5ed503c2017-02-01 09:38:15 -080036
37enum aaudio_direction_t {
38 AAUDIO_DIRECTION_OUTPUT,
Phil Burk3316d5e2017-02-15 11:23:01 -080039 AAUDIO_DIRECTION_INPUT
Phil Burk5ed503c2017-02-01 09:38:15 -080040};
41
42enum aaudio_audio_format_t {
43 AAUDIO_FORMAT_INVALID = -1,
44 AAUDIO_FORMAT_UNSPECIFIED = 0,
45 AAUDIO_FORMAT_PCM_I16,
46 AAUDIO_FORMAT_PCM_FLOAT,
47 AAUDIO_FORMAT_PCM_I8_24,
48 AAUDIO_FORMAT_PCM_I32
49};
50
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};
74
Phil Burk5ed503c2017-02-01 09:38:15 -080075typedef enum
76{
77 AAUDIO_STREAM_STATE_UNINITIALIZED = 0,
Phil Burk3316d5e2017-02-15 11:23:01 -080078 AAUDIO_STREAM_STATE_UNKNOWN,
Phil Burk5ed503c2017-02-01 09:38:15 -080079 AAUDIO_STREAM_STATE_OPEN,
80 AAUDIO_STREAM_STATE_STARTING,
81 AAUDIO_STREAM_STATE_STARTED,
82 AAUDIO_STREAM_STATE_PAUSING,
83 AAUDIO_STREAM_STATE_PAUSED,
84 AAUDIO_STREAM_STATE_FLUSHING,
85 AAUDIO_STREAM_STATE_FLUSHED,
86 AAUDIO_STREAM_STATE_STOPPING,
87 AAUDIO_STREAM_STATE_STOPPED,
88 AAUDIO_STREAM_STATE_CLOSING,
89 AAUDIO_STREAM_STATE_CLOSED,
90} aaudio_stream_state_t;
91
Phil Burk5ed503c2017-02-01 09:38:15 -080092typedef enum {
93 /**
Phil Burk5ed503c2017-02-01 09:38:15 -080094 * This will be the only stream using a particular source or sink.
95 * This mode will provide the lowest possible latency.
96 * You should close EXCLUSIVE streams immediately when you are not using them.
97 */
98 AAUDIO_SHARING_MODE_EXCLUSIVE,
99 /**
100 * Multiple applications will be mixed by the AAudio Server.
101 * This will have higher latency than the EXCLUSIVE mode.
102 */
Phil Burk3316d5e2017-02-15 11:23:01 -0800103 AAUDIO_SHARING_MODE_SHARED
Phil Burk5ed503c2017-02-01 09:38:15 -0800104} aaudio_sharing_mode_t;
105
106#ifdef __cplusplus
107}
108#endif
109
110#endif // AAUDIO_AAUDIODEFINITIONS_H