OpenSLES_Android.h revision 67bdf8a2fbd1024ab50c4513e1504325475368e0
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_ANDROIDAUDIOEFFECT;
76
77/** Android Effect interface methods */
78
79struct SLAndroidAudioEffectItf_;
80typedef const struct SLAndroidAudioEffectItf_ * const * SLAndroidAudioEffectItf;
81
82
83struct SLAndroidAudioEffectItf_ {
84
85    // candidate to be moved to a separate engine interface
86    SLresult (*QueryNumEffects) (SLAndroidAudioEffectItf self,
87        SLuint32 *pNumSupportedAudioEffects);
88
89    // candidate to be moved to a separate engine interface
90    SLresult (*QueryEffect) (SLAndroidAudioEffectItf self,
91        SLuint32 index,
92        SLInterfaceID *pAudioEffectId);
93
94    SLresult (*CreateEffect) (SLAndroidAudioEffectItf self,
95            SLInterfaceID AudioEffectId,
96            void **ppAudioEffect);
97
98    SLresult (*ReleaseEffect) (SLAndroidAudioEffectItf self,
99        void *pAudioEffect);
100
101    SLresult (*SetEnabled) (SLAndroidAudioEffectItf self,
102        void *pAudioEffect,
103        SLboolean enabled);
104
105    SLresult (*IsEnabled) (SLAndroidAudioEffectItf self,
106        void *pAudioEffect,
107        SLboolean *pEnabled);
108
109    SLresult (*SendCommand) (SLAndroidAudioEffectItf self,
110        void *pAudioEffect,
111        SLuint32 command,
112        SLuint32 commandSize,
113        void *pCommand,
114        SLuint32 *replySize,
115        void *pReply);
116};
117
118
119/*---------------------------------------------------------------------------*/
120/* Android File Descriptor Data Locator                                      */
121/*---------------------------------------------------------------------------*/
122/** Addendum to Data locator macros  */
123#define SL_DATALOCATOR_ANDROIDFD        ((SLuint32) 0x00000009)
124
125#define SL_DATALOCATOR_ANDROIDFD_USE_FILE_SIZE ((SLAint64) 0xFFFFFFFFFFFFFFFFll)
126
127/** File Descriptor-based data locator definition where locatorType must be SL_DATALOCATOR_ANDROIDFD */
128typedef struct SLDataLocator_AndroidFD_ {
129    SLuint32        locatorType;
130    SLint32         fd;
131    SLAint64        offset;
132    SLAint64        length;
133} SLDataLocator_AndroidFD;
134
135
136}
137#endif /* __cplusplus */
138
139#endif /* OPENSL_ES_ANDROID_H_ */
140