| 1 |
/* |
| 2 |
* Copyright (C) 2008 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 |
#include <stdint.h> |
| 18 |
|
| 19 |
/* |
| 20 |
* The following definitions are copied from the android sources. Only the |
| 21 |
* relevant enum member and values needed are copied. |
| 22 |
*/ |
| 23 |
|
| 24 |
/* |
| 25 |
* From |
| 26 |
* https://android.googlesource.com/platform/frameworks/base/+/android-2.2.3_r2.1/include/utils/Errors.h |
| 27 |
*/ |
| 28 |
typedef int32_t status_t; |
| 29 |
|
| 30 |
/* |
| 31 |
* From |
| 32 |
* https://android.googlesource.com/platform/frameworks/base/+/android-2.2.3_r2.1/include/media/AudioTrack.h |
| 33 |
*/ |
| 34 |
struct Buffer { |
| 35 |
uint32_t flags; |
| 36 |
int channelCount; |
| 37 |
int format; |
| 38 |
size_t frameCount; |
| 39 |
size_t size; |
| 40 |
union { |
| 41 |
void * raw; |
| 42 |
short * i16; |
| 43 |
int8_t * i8; |
| 44 |
}; |
| 45 |
}; |
| 46 |
|
| 47 |
enum event_type { |
| 48 |
EVENT_MORE_DATA = 0, |
| 49 |
EVENT_UNDERRUN = 1, |
| 50 |
EVENT_LOOP_END = 2, |
| 51 |
EVENT_MARKER = 3, |
| 52 |
EVENT_NEW_POS = 4, |
| 53 |
EVENT_BUFFER_END = 5 |
| 54 |
}; |
| 55 |
|
| 56 |
/** |
| 57 |
* From |
| 58 |
* https://android.googlesource.com/platform/frameworks/base/+/android-2.2.3_r2.1/include/media/AudioSystem.h |
| 59 |
* and |
| 60 |
* https://android.googlesource.com/platform/system/core/+/android-4.2.2_r1/include/system/audio.h |
| 61 |
*/ |
| 62 |
|
| 63 |
#define AUDIO_STREAM_TYPE_MUSIC 3 |
| 64 |
|
| 65 |
enum { |
| 66 |
AUDIO_CHANNEL_OUT_FRONT_LEFT_ICS = 0x1, |
| 67 |
AUDIO_CHANNEL_OUT_FRONT_RIGHT_ICS = 0x2, |
| 68 |
AUDIO_CHANNEL_OUT_MONO_ICS = AUDIO_CHANNEL_OUT_FRONT_LEFT_ICS, |
| 69 |
AUDIO_CHANNEL_OUT_STEREO_ICS = |
| 70 |
(AUDIO_CHANNEL_OUT_FRONT_LEFT_ICS | AUDIO_CHANNEL_OUT_FRONT_RIGHT_ICS) |
| 71 |
} AudioTrack_ChannelMapping_ICS; |
| 72 |
|
| 73 |
enum { |
| 74 |
AUDIO_CHANNEL_OUT_FRONT_LEFT_Legacy = 0x4, |
| 75 |
AUDIO_CHANNEL_OUT_FRONT_RIGHT_Legacy = 0x8, |
| 76 |
AUDIO_CHANNEL_OUT_MONO_Legacy = AUDIO_CHANNEL_OUT_FRONT_LEFT_Legacy, |
| 77 |
AUDIO_CHANNEL_OUT_STEREO_Legacy = (AUDIO_CHANNEL_OUT_FRONT_LEFT_Legacy | |
| 78 |
AUDIO_CHANNEL_OUT_FRONT_RIGHT_Legacy) |
| 79 |
} AudioTrack_ChannelMapping_Legacy; |
| 80 |
|
| 81 |
typedef enum { |
| 82 |
AUDIO_FORMAT_PCM = 0x00000000, |
| 83 |
AUDIO_FORMAT_PCM_SUB_16_BIT = 0x1, |
| 84 |
AUDIO_FORMAT_PCM_16_BIT = (AUDIO_FORMAT_PCM | AUDIO_FORMAT_PCM_SUB_16_BIT), |
| 85 |
} AudioTrack_SampleType; |