OpenSLES_Android.h revision 5b09aa864215690580b18eb802927e8cc7eb4861
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
58
59struct SLAndroidStreamTypeItf_ {
60    SLresult (*SetStreamType) (
61        SLAndroidStreamTypeItf self,
62        SLuint32 type
63    );
64    SLresult (*GetStreamType) (
65        SLAndroidStreamTypeItf self,
66        SLuint32 *pType
67    );
68};
69
70
71/*---------------------------------------------------------------------------*/
72/* Android Effect interface                                                  */
73/*---------------------------------------------------------------------------*/
74
75extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDEFFECT;
76
77/** Android Effect interface methods */
78
79struct SLAndroidEffectItf_;
80typedef const struct SLAndroidEffectItf_ * const * SLAndroidEffectItf;
81
82
83struct SLAndroidEffectItf_ {
84
85    SLresult (*CreateEffect) (SLAndroidEffectItf self,
86            SLInterfaceID effectId);
87
88    SLresult (*ReleaseEffect) (SLAndroidEffectItf self,
89            SLInterfaceID effectId);
90
91    SLresult (*SetEnabled) (SLAndroidEffectItf self,
92            SLInterfaceID effectId,
93            SLboolean enabled);
94
95    SLresult (*IsEnabled) (SLAndroidEffectItf self,
96            SLInterfaceID effectId,
97            SLboolean *pEnabled);
98
99    SLresult (*SendCommand) (SLAndroidEffectItf self,
100            SLInterfaceID effectId,
101            SLuint32 command,
102            SLuint32 commandSize,
103            void *pCommandData,
104            SLuint32 *replySize,
105            void *pReplyData);
106};
107
108
109/*---------------------------------------------------------------------------*/
110/* Android Effect Capabilities interface                                     */
111/*---------------------------------------------------------------------------*/
112
113extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDEFFECTCAPABILITIES;
114
115/** Android Effect Capabilities interface methods */
116
117struct SLAndroidEffectCapabilitiesItf_;
118typedef const struct SLAndroidEffectCapabilitiesItf_ * const * SLAndroidEffectCapabilitiesItf;
119
120
121struct SLAndroidEffectCapabilitiesItf_ {
122
123    SLresult (*QueryNumEffects) (SLAndroidEffectCapabilitiesItf self,
124            SLuint32 *pNumSupportedEffects);
125
126
127    SLresult (*QueryEffect) (SLAndroidEffectCapabilitiesItf self,
128            SLuint32 index,
129            SLInterfaceID *pEffectType,
130            SLInterfaceID *pEffectImplementation,
131            const SLchar *pName,
132            SLuint16 *pNameSize);
133};
134
135
136/*---------------------------------------------------------------------------*/
137/* Android File Descriptor Data Locator                                      */
138/*---------------------------------------------------------------------------*/
139/** Addendum to Data locator macros  */
140#define SL_DATALOCATOR_ANDROIDFD        ((SLuint32) 0x00000009)
141
142#define SL_DATALOCATOR_ANDROIDFD_USE_FILE_SIZE ((SLAint64) 0xFFFFFFFFFFFFFFFFll)
143
144/** File Descriptor-based data locator definition where locatorType must be SL_DATALOCATOR_ANDROIDFD */
145typedef struct SLDataLocator_AndroidFD_ {
146    SLuint32        locatorType;
147    SLint32         fd;
148    SLAint64        offset;
149    SLAint64        length;
150} SLDataLocator_AndroidFD;
151
152
153}
154#endif /* __cplusplus */
155
156#endif /* OPENSL_ES_ANDROID_H_ */
157