blob: 57e3dbd4d9131a96cc6c3042dbb4b5dd0ec44e5c [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
Phil Burka45be8b2017-04-05 14:45:48 -070017/**
18 * @addtogroup Audio
19 * @{
20 */
21
22/**
23 * @file AAudioDefinitions.h
24 */
25
Phil Burk5ed503c2017-02-01 09:38:15 -080026#ifndef AAUDIO_AAUDIODEFINITIONS_H
27#define AAUDIO_AAUDIODEFINITIONS_H
28
29#include <stdint.h>
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
Phil Burk5ed503c2017-02-01 09:38:15 -080035/**
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 Burkc0c70e32017-02-09 13:18:38 -080042#define AAUDIO_DEVICE_UNSPECIFIED 0
Phil Burk5ed503c2017-02-01 09:38:15 -080043
Phil Burk9d8f98c2017-03-10 08:54:01 -080044enum {
Phil Burk5ed503c2017-02-01 09:38:15 -080045 AAUDIO_DIRECTION_OUTPUT,
Phil Burk3316d5e2017-02-15 11:23:01 -080046 AAUDIO_DIRECTION_INPUT
Phil Burk5ed503c2017-02-01 09:38:15 -080047};
Phil Burk9d8f98c2017-03-10 08:54:01 -080048typedef int32_t aaudio_direction_t;
Phil Burk5ed503c2017-02-01 09:38:15 -080049
Phil Burk9d8f98c2017-03-10 08:54:01 -080050enum {
Phil Burk5ed503c2017-02-01 09:38:15 -080051 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 Burk02290282017-03-28 12:48:53 -070058typedef 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 Burk9d8f98c2017-03-10 08:54:01 -080064typedef int32_t aaudio_audio_format_t;
Phil Burk5ed503c2017-02-01 09:38:15 -080065
Phil Burk5ed503c2017-02-01 09:38:15 -080066enum {
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 Burkc0c70e32017-02-09 13:18:38 -080085 AAUDIO_ERROR_INVALID_FORMAT,
Phil Burk5ed503c2017-02-01 09:38:15 -080086 AAUDIO_ERROR_OUT_OF_RANGE,
Phil Burkc0c70e32017-02-09 13:18:38 -080087 AAUDIO_ERROR_NO_SERVICE,
88 AAUDIO_ERROR_INVALID_RATE
Phil Burk5ed503c2017-02-01 09:38:15 -080089};
Phil Burk9d8f98c2017-03-10 08:54:01 -080090typedef int32_t aaudio_result_t;
Phil Burk5ed503c2017-02-01 09:38:15 -080091
Phil Burk9d8f98c2017-03-10 08:54:01 -080092enum
Phil Burk5ed503c2017-02-01 09:38:15 -080093{
94 AAUDIO_STREAM_STATE_UNINITIALIZED = 0,
Phil Burk3316d5e2017-02-15 11:23:01 -080095 AAUDIO_STREAM_STATE_UNKNOWN,
Phil Burk5ed503c2017-02-01 09:38:15 -080096 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 Burkc0c70e32017-02-09 13:18:38 -0800107 AAUDIO_STREAM_STATE_DISCONNECTED
Phil Burk9d8f98c2017-03-10 08:54:01 -0800108};
109typedef int32_t aaudio_stream_state_t;
Phil Burk5ed503c2017-02-01 09:38:15 -0800110
Phil Burkc0c70e32017-02-09 13:18:38 -0800111
Phil Burk9d8f98c2017-03-10 08:54:01 -0800112enum {
Phil Burk5ed503c2017-02-01 09:38:15 -0800113 /**
Phil Burk5ed503c2017-02-01 09:38:15 -0800114 * 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 Burk3316d5e2017-02-15 11:23:01 -0800123 AAUDIO_SHARING_MODE_SHARED
Phil Burk9d8f98c2017-03-10 08:54:01 -0800124};
125typedef int32_t aaudio_sharing_mode_t;
Phil Burk5ed503c2017-02-01 09:38:15 -0800126
127#ifdef __cplusplus
128}
129#endif
130
131#endif // AAUDIO_AAUDIODEFINITIONS_H
Phil Burka45be8b2017-04-05 14:45:48 -0700132
133/** @} */