OpenSLES_Android.h revision 453dd564a81fe98b7a947ae4a9844a53fa957c2b
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 Effect interface                                                  */
32/*---------------------------------------------------------------------------*/
33
34extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDEFFECT;
35
36/** Android Effect interface methods */
37
38struct SLAndroidEffectItf_;
39typedef const struct SLAndroidEffectItf_ * const * SLAndroidEffectItf;
40
41struct SLAndroidEffectItf_ {
42
43    SLresult (*CreateEffect) (SLAndroidEffectItf self,
44            SLInterfaceID effectImplementationId);
45
46    SLresult (*ReleaseEffect) (SLAndroidEffectItf self,
47            SLInterfaceID effectImplementationId);
48
49    SLresult (*SetEnabled) (SLAndroidEffectItf self,
50            SLInterfaceID effectImplementationId,
51            SLboolean enabled);
52
53    SLresult (*IsEnabled) (SLAndroidEffectItf self,
54            SLInterfaceID effectImplementationId,
55            SLboolean *pEnabled);
56
57    SLresult (*SendCommand) (SLAndroidEffectItf self,
58            SLInterfaceID effectImplementationId,
59            SLuint32 command,
60            SLuint32 commandSize,
61            void *pCommandData,
62            SLuint32 *replySize,
63            void *pReplyData);
64};
65
66
67/*---------------------------------------------------------------------------*/
68/* Android Effect Send interface                                             */
69/*---------------------------------------------------------------------------*/
70
71extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDEFFECTSEND;
72
73/** Android Effect Send interface methods */
74
75struct SLAndroidEffectSendItf_;
76typedef const struct SLAndroidEffectSendItf_ * const * SLAndroidEffectSendItf;
77
78struct SLAndroidEffectSendItf_ {
79    SLresult (*EnableEffectSend) (
80        SLAndroidEffectSendItf self,
81        SLInterfaceID effectImplementationId,
82        SLboolean enable,
83        SLmillibel initialLevel
84    );
85    SLresult (*IsEnabled) (
86        SLAndroidEffectSendItf self,
87        SLInterfaceID effectImplementationId,
88        SLboolean *pEnable
89    );
90    SLresult (*SetDirectLevel) (
91        SLAndroidEffectSendItf self,
92        SLmillibel directLevel
93    );
94    SLresult (*GetDirectLevel) (
95        SLAndroidEffectSendItf self,
96        SLmillibel *pDirectLevel
97    );
98    SLresult (*SetSendLevel) (
99        SLAndroidEffectSendItf self,
100        SLInterfaceID effectImplementationId,
101        SLmillibel sendLevel
102    );
103    SLresult (*GetSendLevel)(
104        SLAndroidEffectSendItf self,
105        SLInterfaceID effectImplementationId,
106        SLmillibel *pSendLevel
107    );
108};
109
110
111/*---------------------------------------------------------------------------*/
112/* Android Effect Capabilities interface                                     */
113/*---------------------------------------------------------------------------*/
114
115extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDEFFECTCAPABILITIES;
116
117/** Android Effect Capabilities interface methods */
118
119struct SLAndroidEffectCapabilitiesItf_;
120typedef const struct SLAndroidEffectCapabilitiesItf_ * const * SLAndroidEffectCapabilitiesItf;
121
122struct SLAndroidEffectCapabilitiesItf_ {
123
124    SLresult (*QueryNumEffects) (SLAndroidEffectCapabilitiesItf self,
125            SLuint32 *pNumSupportedEffects);
126
127
128    SLresult (*QueryEffect) (SLAndroidEffectCapabilitiesItf self,
129            SLuint32 index,
130            SLInterfaceID *pEffectType,
131            SLInterfaceID *pEffectImplementation,
132            const SLchar *pName,
133            SLuint16 *pNameSize);
134};
135
136
137/*---------------------------------------------------------------------------*/
138/* Android Configuration interface                                           */
139/*---------------------------------------------------------------------------*/
140extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDCONFIGURATION;
141
142/** Android Configuration interface methods */
143
144struct SLAndroidConfigurationItf_;
145typedef const struct SLAndroidConfigurationItf_ * const * SLAndroidConfigurationItf;
146
147struct SLAndroidConfigurationItf_ {
148
149    SLresult (*SetConfiguration) (SLAndroidConfigurationItf self,
150            const SLchar *configKey,
151            const void *pConfigValue,
152            SLuint32 valueSize);
153
154    SLresult (*GetConfiguration) (SLAndroidConfigurationItf self,
155           const SLchar *configKey,
156           SLuint32 *pValueSize,
157           void *pConfigValue
158       );
159};
160
161/*---------------------------------------------------------------------------*/
162/* Android File Descriptor Data Locator                                      */
163/*---------------------------------------------------------------------------*/
164/** Addendum to Data locator macros  */
165#define SL_DATALOCATOR_ANDROIDFD        ((SLuint32) 0x00000009)
166
167#define SL_DATALOCATOR_ANDROIDFD_USE_FILE_SIZE ((SLAint64) 0xFFFFFFFFFFFFFFFFll)
168
169/** File Descriptor-based data locator definition where locatorType must be SL_DATALOCATOR_ANDROIDFD */
170typedef struct SLDataLocator_AndroidFD_ {
171    SLuint32        locatorType;
172    SLint32         fd;
173    SLAint64        offset;
174    SLAint64        length;
175} SLDataLocator_AndroidFD;
176
177
178}
179#endif /* __cplusplus */
180
181#endif /* OPENSL_ES_ANDROID_H_ */
182