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 21 extern "C" { 22 #endif 23 24 #include "OpenSLES.h" 25 26 /*---------------------------------------------------------------------------*/ 27 /* Android common types */ 28 /*---------------------------------------------------------------------------*/ 29 30 typedef sl_int64_t SLAint64; /* 64 bit signed integer */ 31 32 33 /*---------------------------------------------------------------------------*/ 34 /* Android Effect interface */ 35 /*---------------------------------------------------------------------------*/ 36 37 extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDEFFECT; 38 39 /** Android Effect interface methods */ 40 41 struct SLAndroidEffectItf_; 42 typedef const struct SLAndroidEffectItf_ * const * SLAndroidEffectItf; 43 44 struct SLAndroidEffectItf_ { 45 46 SLresult (*CreateEffect) (SLAndroidEffectItf self, 47 SLInterfaceID effectImplementationId); 48 49 SLresult (*ReleaseEffect) (SLAndroidEffectItf self, 50 SLInterfaceID effectImplementationId); 51 52 SLresult (*SetEnabled) (SLAndroidEffectItf self, 53 SLInterfaceID effectImplementationId, 54 SLboolean enabled); 55 56 SLresult (*IsEnabled) (SLAndroidEffectItf self, 57 SLInterfaceID effectImplementationId, 58 SLboolean *pEnabled); 59 60 SLresult (*SendCommand) (SLAndroidEffectItf self, 61 SLInterfaceID effectImplementationId, 62 SLuint32 command, 63 SLuint32 commandSize, 64 void *pCommandData, 65 SLuint32 *replySize, 66 void *pReplyData); 67 }; 68 69 70 /*---------------------------------------------------------------------------*/ 71 /* Android Effect Send interface */ 72 /*---------------------------------------------------------------------------*/ 73 74 extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDEFFECTSEND; 75 76 /** Android Effect Send interface methods */ 77 78 struct SLAndroidEffectSendItf_; 79 typedef const struct SLAndroidEffectSendItf_ * const * SLAndroidEffectSendItf; 80 81 struct SLAndroidEffectSendItf_ { 82 SLresult (*EnableEffectSend) ( 83 SLAndroidEffectSendItf self, 84 SLInterfaceID effectImplementationId, 85 SLboolean enable, 86 SLmillibel initialLevel 87 ); 88 SLresult (*IsEnabled) ( 89 SLAndroidEffectSendItf self, 90 SLInterfaceID effectImplementationId, 91 SLboolean *pEnable 92 ); 93 SLresult (*SetDirectLevel) ( 94 SLAndroidEffectSendItf self, 95 SLmillibel directLevel 96 ); 97 SLresult (*GetDirectLevel) ( 98 SLAndroidEffectSendItf self, 99 SLmillibel *pDirectLevel 100 ); 101 SLresult (*SetSendLevel) ( 102 SLAndroidEffectSendItf self, 103 SLInterfaceID effectImplementationId, 104 SLmillibel sendLevel 105 ); 106 SLresult (*GetSendLevel)( 107 SLAndroidEffectSendItf self, 108 SLInterfaceID effectImplementationId, 109 SLmillibel *pSendLevel 110 ); 111 }; 112 113 114 /*---------------------------------------------------------------------------*/ 115 /* Android Effect Capabilities interface */ 116 /*---------------------------------------------------------------------------*/ 117 118 extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDEFFECTCAPABILITIES; 119 120 /** Android Effect Capabilities interface methods */ 121 122 struct SLAndroidEffectCapabilitiesItf_; 123 typedef const struct SLAndroidEffectCapabilitiesItf_ * const * SLAndroidEffectCapabilitiesItf; 124 125 struct SLAndroidEffectCapabilitiesItf_ { 126 127 SLresult (*QueryNumEffects) (SLAndroidEffectCapabilitiesItf self, 128 SLuint32 *pNumSupportedEffects); 129 130 131 SLresult (*QueryEffect) (SLAndroidEffectCapabilitiesItf self, 132 SLuint32 index, 133 SLInterfaceID *pEffectType, 134 SLInterfaceID *pEffectImplementation, 135 SLchar *pName, 136 SLuint16 *pNameSize); 137 }; 138 139 140 /*---------------------------------------------------------------------------*/ 141 /* Android Configuration interface */ 142 /*---------------------------------------------------------------------------*/ 143 extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDCONFIGURATION; 144 145 /** Android Configuration interface methods */ 146 147 struct SLAndroidConfigurationItf_; 148 typedef const struct SLAndroidConfigurationItf_ * const * SLAndroidConfigurationItf; 149 150 struct SLAndroidConfigurationItf_ { 151 152 SLresult (*SetConfiguration) (SLAndroidConfigurationItf self, 153 const SLchar *configKey, 154 const void *pConfigValue, 155 SLuint32 valueSize); 156 157 SLresult (*GetConfiguration) (SLAndroidConfigurationItf self, 158 const SLchar *configKey, 159 SLuint32 *pValueSize, 160 void *pConfigValue 161 ); 162 }; 163 164 165 /*---------------------------------------------------------------------------*/ 166 /* Android Simple Buffer Queue Interface */ 167 /*---------------------------------------------------------------------------*/ 168 169 extern SLAPIENTRY const SLInterfaceID SL_IID_ANDROIDSIMPLEBUFFERQUEUE; 170 171 struct SLAndroidSimpleBufferQueueItf_; 172 typedef const struct SLAndroidSimpleBufferQueueItf_ * const * SLAndroidSimpleBufferQueueItf; 173 174 typedef void (/*SLAPIENTRY*/ *slAndroidSimpleBufferQueueCallback)( 175 SLAndroidSimpleBufferQueueItf caller, 176 void *pContext 177 ); 178 179 /** Android simple buffer queue state **/ 180 181 typedef struct SLAndroidSimpleBufferQueueState_ { 182 SLuint32 count; 183 SLuint32 index; 184 } SLAndroidSimpleBufferQueueState; 185 186 187 struct SLAndroidSimpleBufferQueueItf_ { 188 SLresult (*Enqueue) ( 189 SLAndroidSimpleBufferQueueItf self, 190 const void *pBuffer, 191 SLuint32 size 192 ); 193 SLresult (*Clear) ( 194 SLAndroidSimpleBufferQueueItf self 195 ); 196 SLresult (*GetState) ( 197 SLAndroidSimpleBufferQueueItf self, 198 SLAndroidSimpleBufferQueueState *pState 199 ); 200 SLresult (*RegisterCallback) ( 201 SLAndroidSimpleBufferQueueItf self, 202 slAndroidSimpleBufferQueueCallback callback, 203 void* pContext 204 ); 205 }; 206 207 208 /*---------------------------------------------------------------------------*/ 209 /* Android File Descriptor Data Locator */ 210 /*---------------------------------------------------------------------------*/ 211 212 /** Addendum to Data locator macros */ 213 #define SL_DATALOCATOR_ANDROIDFD ((SLuint32) 0x800007BC) 214 215 #define SL_DATALOCATOR_ANDROIDFD_USE_FILE_SIZE ((SLAint64) 0xFFFFFFFFFFFFFFFFll) 216 217 /** File Descriptor-based data locator definition, locatorType must be SL_DATALOCATOR_ANDROIDFD */ 218 typedef struct SLDataLocator_AndroidFD_ { 219 SLuint32 locatorType; 220 SLint32 fd; 221 SLAint64 offset; 222 SLAint64 length; 223 } SLDataLocator_AndroidFD; 224 225 226 /*---------------------------------------------------------------------------*/ 227 /* Android Android Simple Buffer Queue Data Locator */ 228 /*---------------------------------------------------------------------------*/ 229 230 /** Addendum to Data locator macros */ 231 #define SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE ((SLuint32) 0x800007BD) 232 233 /** BufferQueue-based data locator definition where locatorType must be SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE*/ 234 typedef struct SLDataLocator_AndroidSimpleBufferQueue { 235 SLuint32 locatorType; 236 SLuint32 numBuffers; 237 } SLDataLocator_AndroidSimpleBufferQueue; 238 239 240 #ifdef __cplusplus 241 } 242 #endif /* __cplusplus */ 243 244 #endif /* OPENSL_ES_ANDROID_H_ */ 245