OpenSLES_Android.h revision fef6033d852daec8d88060b252e72f322724dca1
1/*
2 * Copyright (C) 2010 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 OPENSL_ES_ANDROID_H_
18#define OPENSL_ES_ANDROID_H_
19
20#ifdef __cplusplus
21extern "C" {
22
23/*---------------------------------------------------------------------------*/
24/* Android common types                                                      */
25/*---------------------------------------------------------------------------*/
26
27typedef sl_int64_t             SLAint64;           /* 64 bit signed integer */
28
29
30/*---------------------------------------------------------------------------*/
31/* Android Stream Type interface                                             */
32/*---------------------------------------------------------------------------*/
33
34/** Stream types */
35// FIXME verify those are all the ones we need
36// FIXME verify we want to use the same values as in android::AudioSystem
37/*      same as android.media.AudioManager.STREAM_VOICE_CALL */
38#define SL_ANDROID_STREAM_VOICE        ((SLuint32) 0x00000000)
39/*      same as android.media.AudioManager.STREAM_SYSTEM */
40#define SL_ANDROID_STREAM_SYSTEM       ((SLuint32) 0x00000001)
41/*      same as android.media.AudioManager.STREAM_RING */
42#define SL_ANDROID_STREAM_RING         ((SLuint32) 0x00000002)
43/*      same as android.media.AudioManager.STREAM_MUSIC */
44#define SL_ANDROID_STREAM_MEDIA        ((SLuint32) 0x00000003)
45/*      same as android.media.AudioManager.STREAM_ALARM */
46#define SL_ANDROID_STREAM_ALARM        ((SLuint32) 0x00000004)
47/*      same as android.media.AudioManager.STREAM_NOTIFICATION */
48#define SL_ANDROID_STREAM_NOTIFICATION ((SLuint32) 0x00000005)
49
50
51extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDSTREAMTYPE;
52
53/** Android Stream Type interface methods */
54
55struct SLAndroidStreamTypeItf_;
56typedef const struct SLAndroidStreamTypeItf_ * const * SLAndroidStreamTypeItf;
57
58struct SLAndroidStreamTypeItf_ {
59    SLresult (*SetStreamType) (
60        SLAndroidStreamTypeItf self,
61        SLuint32 type
62    );
63    SLresult (*GetStreamType) (
64        SLAndroidStreamTypeItf self,
65        SLuint32 *pType
66    );
67};
68
69
70/*---------------------------------------------------------------------------*/
71/* Android Effect interface                                                  */
72/*---------------------------------------------------------------------------*/
73
74extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDEFFECT;
75
76/** Android Effect interface methods */
77
78struct SLAndroidEffectItf_;
79typedef const struct SLAndroidEffectItf_ * const * SLAndroidEffectItf;
80
81struct SLAndroidEffectItf_ {
82
83    SLresult (*CreateEffect) (SLAndroidEffectItf self,
84            SLInterfaceID effectImplementationId);
85
86    SLresult (*ReleaseEffect) (SLAndroidEffectItf self,
87            SLInterfaceID effectImplementationId);
88
89    SLresult (*SetEnabled) (SLAndroidEffectItf self,
90            SLInterfaceID effectImplementationId,
91            SLboolean enabled);
92
93    SLresult (*IsEnabled) (SLAndroidEffectItf self,
94            SLInterfaceID effectImplementationId,
95            SLboolean *pEnabled);
96
97    SLresult (*SendCommand) (SLAndroidEffectItf self,
98            SLInterfaceID effectImplementationId,
99            SLuint32 command,
100            SLuint32 commandSize,
101            void *pCommandData,
102            SLuint32 *replySize,
103            void *pReplyData);
104};
105
106
107/*---------------------------------------------------------------------------*/
108/* Android Effect Send interface                                             */
109/*---------------------------------------------------------------------------*/
110
111extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDEFFECTSEND;
112
113/** Android Effect Send interface methods */
114
115struct SLAndroidEffectSendItf_;
116typedef const struct SLAndroidEffectSendItf_ * const * SLAndroidEffectSendItf;
117
118struct SLAndroidEffectSendItf_ {
119    SLresult (*EnableEffectSend) (
120        SLAndroidEffectSendItf self,
121        SLInterfaceID effectImplementationId,
122        SLboolean enable,
123        SLmillibel initialLevel
124    );
125    SLresult (*IsEnabled) (
126        SLAndroidEffectSendItf self,
127        SLInterfaceID effectImplementationId,
128        SLboolean *pEnable
129    );
130    SLresult (*SetDirectLevel) (
131        SLAndroidEffectSendItf self,
132        SLmillibel directLevel
133    );
134    SLresult (*GetDirectLevel) (
135        SLAndroidEffectSendItf self,
136        SLmillibel *pDirectLevel
137    );
138    SLresult (*SetSendLevel) (
139        SLAndroidEffectSendItf self,
140        SLInterfaceID effectImplementationId,
141        SLmillibel sendLevel
142    );
143    SLresult (*GetSendLevel)(
144        SLAndroidEffectSendItf self,
145        SLInterfaceID effectImplementationId,
146        SLmillibel *pSendLevel
147    );
148};
149
150
151/*---------------------------------------------------------------------------*/
152/* Android Effect Capabilities interface                                     */
153/*---------------------------------------------------------------------------*/
154
155extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDEFFECTCAPABILITIES;
156
157/** Android Effect Capabilities interface methods */
158
159struct SLAndroidEffectCapabilitiesItf_;
160typedef const struct SLAndroidEffectCapabilitiesItf_ * const * SLAndroidEffectCapabilitiesItf;
161
162struct SLAndroidEffectCapabilitiesItf_ {
163
164    SLresult (*QueryNumEffects) (SLAndroidEffectCapabilitiesItf self,
165            SLuint32 *pNumSupportedEffects);
166
167
168    SLresult (*QueryEffect) (SLAndroidEffectCapabilitiesItf self,
169            SLuint32 index,
170            SLInterfaceID *pEffectType,
171            SLInterfaceID *pEffectImplementation,
172            const SLchar *pName,
173            SLuint16 *pNameSize);
174};
175
176
177/*---------------------------------------------------------------------------*/
178/* Android File Descriptor Data Locator                                      */
179/*---------------------------------------------------------------------------*/
180/** Addendum to Data locator macros  */
181#define SL_DATALOCATOR_ANDROIDFD        ((SLuint32) 0x00000009)
182
183#define SL_DATALOCATOR_ANDROIDFD_USE_FILE_SIZE ((SLAint64) 0xFFFFFFFFFFFFFFFFll)
184
185/** File Descriptor-based data locator definition where locatorType must be SL_DATALOCATOR_ANDROIDFD */
186typedef struct SLDataLocator_AndroidFD_ {
187    SLuint32        locatorType;
188    SLint32         fd;
189    SLAint64        offset;
190    SLAint64        length;
191} SLDataLocator_AndroidFD;
192
193
194}
195#endif /* __cplusplus */
196
197#endif /* OPENSL_ES_ANDROID_H_ */
198