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 #ifdef ANDROID
18 #include "media/AudioEffect.h"
19 #include "hardware/audio_effect.h"
20 #endif
21 
22 /* Interface structures */
23 
24 typedef struct Object_interface {
25     const struct SLObjectItf_ *mItf;    // const
26     // field mThis would be redundant within an IObject, so we substitute mEngine
27     CEngine *mEngine;               // const
28     const ClassTable *mClass;       // const
29     SLuint32 mInstanceID;           // const for debugger and for RPC, 0 means unpublished
30     slObjectCallback mCallback;
31     void *mContext;
32     unsigned mGottenMask;           ///< bit-mask of interfaces exposed or added, then gotten
33     unsigned mLossOfControlMask;    // interfaces with loss of control enabled
34     unsigned mAttributesMask;       // attributes which have changed since last sync
35 #if USE_PROFILES & USE_PROFILES_BASE
36     SLint32 mPriority;
37 #endif
38     pthread_mutex_t mMutex;
39 #ifdef USE_DEBUG
40     // Only keep the pthread_t, not the kernel tid, because pthread_self() is very fast
41     // (typically just arithmetic on the stack pointer). But a gettid() is a kernel call
42     // and so too slow to do every time a mutex is acquired. However, we can determine
43     // the kernel tid from the pthread_t.
44     pthread_t mOwner;
45     const char *mFile;
46     int mLine;
47     volatile int32_t mGeneration;   // read without a lock, incremented with a lock
48 #endif
49     pthread_cond_t mCond;
50     SLuint8 mState;                 // really SLuint32, but SLuint8 to save space
51 #if USE_PROFILES & USE_PROFILES_BASE
52     SLuint8 mPreemptable;           // really SLboolean, but SLuint8 to save space
53 #else
54     SLuint8 mPadding;
55 #endif
56     SLuint8 mStrongRefCount;        // number of strong references to this object
57     // (object cannot be destroyed as long as > 0, and referrers _prefer_ it stay in Realized state)
58     // for best alignment, do not add any fields here
59 #define INTERFACES_Default 1
60     SLuint8 mInterfaceStates[INTERFACES_Default];    // state of each of interface
61     // do not add any fields here
62 } IObject;
63 
64 #include "locks.h"
65 
66 typedef struct {
67     const struct SL3DCommitItf_ *mItf;
68     IObject *mThis;
69     SLboolean mDeferred;
70     SLuint32 mGeneration;   // incremented each master clock cycle
71     SLuint32 mWaiting;      // number of threads waiting in Commit
72 } I3DCommit;
73 
74 enum CartesianSphericalActive {
75     CARTESIAN_COMPUTED_SPHERICAL_SET,
76     CARTESIAN_REQUESTED_SPHERICAL_SET,
77     CARTESIAN_UNKNOWN_SPHERICAL_SET,
78     CARTESIAN_SET_SPHERICAL_COMPUTED,   // not in 1.0.1
79     CARTESIAN_SET_SPHERICAL_REQUESTED,  // not in 1.0.1
80     CARTESIAN_SET_SPHERICAL_UNKNOWN
81 };
82 
83 typedef struct {
84     const struct SL3DDopplerItf_ *mItf;
85     IObject *mThis;
86     // The API allows client to specify either Cartesian and spherical velocities.
87     // But an implementation will likely prefer one or the other. So for
88     // maximum portablity, we maintain both units and an indication of which
89     // unit was set most recently. In addition, we keep a flag saying whether
90     // the other unit has been derived yet. It can take significant time
91     // to compute the other unit, so this may be deferred to another thread.
92     // For this reason we also keep an indication of whether the secondary
93     // has been computed yet, and its accuracy.
94     // Though only one unit is primary at a time, a union is inappropriate:
95     // the application might read in both units (not in 1.0.1),
96     // and due to multi-threading concerns.
97     SLVec3D mVelocityCartesian;
98     struct {
99         SLmillidegree mAzimuth;
100         SLmillidegree mElevation;
101         SLmillidegree mSpeed;
102     } mVelocitySpherical;
103     enum CartesianSphericalActive mVelocityActive;
104     SLpermille mDopplerFactor;
105 } I3DDoppler;
106 
107 typedef struct {
108     const struct SL3DGroupingItf_ *mItf;
109     IObject *mThis;
110     C3DGroup *mGroup;   // strong reference to associated group or NULL
111 } I3DGrouping;
112 
113 enum AnglesVectorsActive {
114     ANGLES_COMPUTED_VECTORS_SET,    // not in 1.0.1
115     ANGLES_REQUESTED_VECTORS_SET,   // not in 1.0.1
116     ANGLES_UNKNOWN_VECTORS_SET,
117     ANGLES_SET_VECTORS_COMPUTED,
118     ANGLES_SET_VECTORS_REQUESTED,
119     ANGLES_SET_VECTORS_UNKNOWN
120 };
121 
122 typedef struct {
123     const struct SL3DLocationItf_ *mItf;
124     IObject *mThis;
125     SLVec3D mLocationCartesian;
126     struct {
127         SLmillidegree mAzimuth;
128         SLmillidegree mElevation;
129         SLmillimeter mDistance;
130     } mLocationSpherical;
131     enum CartesianSphericalActive mLocationActive;
132     struct {
133         SLmillidegree mHeading;
134         SLmillidegree mPitch;
135         SLmillidegree mRoll;
136     } mOrientationAngles;
137     struct {
138         SLVec3D mFront;
139         SLVec3D mAbove;
140         SLVec3D mUp;
141     } mOrientationVectors;
142     enum AnglesVectorsActive mOrientationActive;
143     // Rotations can be slow, so are deferred.
144     SLmillidegree mTheta;
145     SLVec3D mAxis;
146     SLboolean mRotatePending;
147 } I3DLocation;
148 
149 typedef struct {
150     const struct SL3DMacroscopicItf_ *mItf;
151     IObject *mThis;
152     struct {
153         SLmillimeter mWidth;
154         SLmillimeter mHeight;
155         SLmillimeter mDepth;
156     } mSize;
157     struct {
158         SLmillimeter mHeading;
159         SLmillimeter mPitch;
160         SLmillimeter mRoll;
161     } mOrientationAngles;
162     struct {
163         SLVec3D mFront;
164         SLVec3D mAbove;
165         SLVec3D mUp;
166     } mOrientationVectors;
167     enum AnglesVectorsActive mOrientationActive;
168     // Rotations can be slow, so are deferred.
169     SLmillidegree mTheta;
170     SLVec3D mAxis;
171     SLboolean mRotatePending;
172 } I3DMacroscopic;
173 
174 typedef struct {
175     const struct SL3DSourceItf_ *mItf;
176     IObject *mThis;
177     SLboolean mHeadRelative;
178     SLboolean mRolloffMaxDistanceMute;
179     SLmillimeter mMaxDistance;
180     SLmillimeter mMinDistance;
181     SLmillidegree mConeInnerAngle;
182     SLmillidegree mConeOuterAngle;
183     SLmillibel mConeOuterLevel;
184     SLpermille mRolloffFactor;
185     SLpermille mRoomRolloffFactor;
186     SLuint8 mDistanceModel;
187 } I3DSource;
188 
189 typedef struct {
190     const struct SLAudioDecoderCapabilitiesItf_ *mItf;
191     IObject *mThis;
192 } IAudioDecoderCapabilities;
193 
194 typedef struct {
195     const struct SLAudioEncoderItf_ *mItf;
196     IObject *mThis;
197     SLAudioEncoderSettings mSettings;
198 } IAudioEncoder;
199 
200 typedef struct {
201     const struct SLAudioEncoderCapabilitiesItf_ *mItf;
202     IObject *mThis;
203 } IAudioEncoderCapabilities;
204 
205 typedef struct {
206     const struct SLAudioIODeviceCapabilitiesItf_ *mItf;
207     IObject *mThis;
208     slAvailableAudioInputsChangedCallback mAvailableAudioInputsChangedCallback;
209     void *mAvailableAudioInputsChangedContext;
210     slAvailableAudioOutputsChangedCallback mAvailableAudioOutputsChangedCallback;
211     void *mAvailableAudioOutputsChangedContext;
212     slDefaultDeviceIDMapChangedCallback mDefaultDeviceIDMapChangedCallback;
213     void *mDefaultDeviceIDMapChangedContext;
214 } IAudioIODeviceCapabilities;
215 
216 typedef struct {
217     const struct SLBassBoostItf_ *mItf;
218     IObject *mThis;
219     SLboolean mEnabled;
220     SLpermille mStrength;
221 #if defined(ANDROID)
222     effect_descriptor_t mBassBoostDescriptor;
223     android::sp<android::AudioEffect> mBassBoostEffect;
224 #endif
225 } IBassBoost;
226 
227 typedef struct BufferQueue_interface {
228     const struct SLBufferQueueItf_ *mItf;
229     IObject *mThis;
230     SLBufferQueueState mState;
231     slBufferQueueCallback mCallback;
232     void *mContext;
233     // originally SLuint32, but range-checked down to SLuint16
234     SLuint16 mNumBuffers;
235     /*SLboolean*/ SLuint16 mClearRequested;
236     BufferHeader *mArray;
237     BufferHeader *mFront, *mRear;
238 #ifdef ANDROID
239     SLuint32 mSizeConsumed;
240     bool mCallbackPending;
241 #endif
242     // saves a malloc in the typical case
243 #define BUFFER_HEADER_TYPICAL 4
244     BufferHeader mTypical[BUFFER_HEADER_TYPICAL+1];
245 } IBufferQueue;
246 
247 #define MAX_DEVICE 2    // hard-coded array size for default in/out
248 
249 typedef struct {
250     const struct SLDeviceVolumeItf_ *mItf;
251     IObject *mThis;
252     SLint32 mVolume[MAX_DEVICE];
253 } IDeviceVolume;
254 
255 typedef struct {
256     const struct SLDynamicInterfaceManagementItf_ *mItf;
257     IObject *mThis;
258     slDynamicInterfaceManagementCallback mCallback;
259     void *mContext;
260 } IDynamicInterfaceManagement;
261 
262 typedef struct {
263     const struct SLDynamicSourceItf_ *mItf;
264     IObject *mThis;
265     SLDataSource *mDataSource;
266 } IDynamicSource;
267 
268 // private
269 
270 struct EnableLevel {
271     SLboolean mEnable;
272     SLmillibel mSendLevel;
273 };
274 
275 // indexes into IEffectSend.mEnableLevels
276 
277 #define AUX_ENVIRONMENTALREVERB 0
278 #define AUX_PRESETREVERB        1
279 #define AUX_MAX                 2
280 
281 typedef struct {
282     const struct SLEffectSendItf_ *mItf;
283     IObject *mThis;
284     struct EnableLevel mEnableLevels[AUX_MAX];  // wet enable and volume per effect type
285 } IEffectSend;
286 
287 typedef struct Engine_interface {
288     const struct SLEngineItf_ *mItf;
289     IObject *mThis;
290     SLboolean mLossOfControlGlobal;
291 #ifdef USE_SDL
292     COutputMix *mOutputMix; // SDL pulls PCM from an arbitrary IOutputMixExt
293 #endif
294     // Each engine is its own universe.
295     SLuint32 mInstanceCount;
296     unsigned mInstanceMask; // 1 bit per active object
297     unsigned mChangedMask;  // objects which have changed since last sync
298 #define MAX_INSTANCE 32     // maximum active objects per engine, see mInstanceMask
299     IObject *mInstances[MAX_INSTANCE];
300     SLboolean mShutdown;
301     SLboolean mShutdownAck;
302     // SLuint32 mVersion;      // 0xXXYYZZ where XX=major, YY=minor, ZZ=step
303     SLuint32 mNativeEndianness; // one of SL_BYTEORDER_LITTLEENDIAN or SL_BYTEORDER_BIGENDIAN
304 } IEngine;
305 
306 typedef struct {
307     const struct SLEngineCapabilitiesItf_ *mItf;
308     IObject *mThis;
309     SLboolean mThreadSafe;
310     // const
311     SLuint32 mMaxIndexLED;
312     SLuint32 mMaxIndexVibra;
313 } IEngineCapabilities;
314 
315 typedef struct {
316     const struct SLEnvironmentalReverbItf_ *mItf;
317     IObject *mThis;
318     SLEnvironmentalReverbSettings mProperties;
319 #if defined(ANDROID)
320     effect_descriptor_t mEnvironmentalReverbDescriptor;
321     android::sp<android::AudioEffect> mEnvironmentalReverbEffect;
322 #endif
323 } IEnvironmentalReverb;
324 
325 struct EqualizerBand {
326     SLmilliHertz mMin;
327     SLmilliHertz mCenter;
328     SLmilliHertz mMax;
329 };
330 
331 #if defined(ANDROID)
332 #define MAX_EQ_BANDS 0
333 #else
334 #define MAX_EQ_BANDS 4  // compile-time limit, runtime limit may be smaller
335 #endif
336 
337 typedef struct {
338     const struct SLEqualizerItf_ *mItf;
339     IObject *mThis;
340     SLboolean mEnabled;
341     SLuint16 mPreset;
342 #if 0 < MAX_EQ_BANDS
343     SLmillibel mLevels[MAX_EQ_BANDS];
344 #endif
345     // const to end of struct
346     SLuint16 mNumPresets;
347     SLuint16 mNumBands;
348 #if !defined(ANDROID)
349     const struct EqualizerBand *mBands;
350     const struct EqualizerPreset *mPresets;
351 #endif
352     SLmillibel mBandLevelRangeMin;
353     SLmillibel mBandLevelRangeMax;
354 #if defined(ANDROID)
355     effect_descriptor_t mEqDescriptor;
356     android::sp<android::AudioEffect> mEqEffect;
357 #endif
358 } IEqualizer;
359 
360 #define MAX_LED_COUNT 32
361 
362 typedef struct {
363     const struct SLLEDArrayItf_ *mItf;
364     IObject *mThis;
365     SLuint32 mLightMask;
366     SLHSL mColors[MAX_LED_COUNT];
367     // const
368     SLuint8 mCount;
369 } ILEDArray;
370 
371 typedef struct {
372     const struct SLMetadataExtractionItf_ *mItf;
373     IObject *mThis;
374     SLuint32 mKeySize;
375     const void *mKey;
376     SLuint32 mKeyEncoding;
377     const SLchar *mValueLangCountry;
378     SLuint32 mValueEncoding;
379     SLuint8 mFilterMask;
380     int mKeyFilter;
381 } IMetadataExtraction;
382 
383 typedef struct {
384     const struct SLMetadataTraversalItf_ *mItf;
385     IObject *mThis;
386     SLuint32 mIndex;
387     SLuint32 mMode;
388     SLuint32 mCount;
389     SLuint32 mSize;
390 } IMetadataTraversal;
391 
392 typedef struct {
393     const struct SLMIDIMessageItf_ *mItf;
394     IObject *mThis;
395     slMetaEventCallback mMetaEventCallback;
396     void *mMetaEventContext;
397     slMIDIMessageCallback mMessageCallback;
398     void *mMessageContext;
399     SLuint8 mMessageTypes;
400 } IMIDIMessage;
401 
402 typedef struct {
403     const struct SLMIDIMuteSoloItf_ *mItf;
404     IObject *mThis;
405     SLuint16 mChannelMuteMask;
406     SLuint16 mChannelSoloMask;
407     SLuint32 mTrackMuteMask;
408     SLuint32 mTrackSoloMask;
409     // const
410     SLuint16 mTrackCount;
411 } IMIDIMuteSolo;
412 
413 typedef struct {
414     const struct SLMIDITempoItf_ *mItf;
415     IObject *mThis;
416     SLuint32 mTicksPerQuarterNote;
417     SLuint32 mMicrosecondsPerQuarterNote;
418 } IMIDITempo;
419 
420 typedef struct {
421     const struct SLMIDITimeItf_ *mItf;
422     IObject *mThis;
423     SLuint32 mDuration;
424     SLuint32 mPosition;
425     SLuint32 mStartTick;
426     SLuint32 mNumTicks;
427 } IMIDITime;
428 
429 typedef struct {
430     const struct SLMuteSoloItf_ *mItf;
431     IObject *mThis;
432     // fields that were formerly here are now at CAudioPlayer
433 } IMuteSolo;
434 
435 #define MAX_TRACK 32        // see mActiveMask
436 
437 typedef struct {
438     const struct SLOutputMixItf_ *mItf;
439     IObject *mThis;
440     slMixDeviceChangeCallback mCallback;
441     void *mContext;
442 } IOutputMix;
443 
444 #ifdef USE_OUTPUTMIXEXT
445 typedef struct {
446     const struct SLOutputMixExtItf_ *mItf;
447     IObject *mThis;
448     unsigned mActiveMask;   // 1 bit per active track
449     Track mTracks[MAX_TRACK];
450     SLboolean mDestroyRequested;    ///< Mixer to acknowledge application's call to Object::Destroy
451 } IOutputMixExt;
452 #endif
453 
454 typedef struct {
455     const struct SLPitchItf_ *mItf;
456     IObject *mThis;
457     SLpermille mPitch;
458     // const
459     SLpermille mMinPitch;
460     SLpermille mMaxPitch;
461 } IPitch;
462 
463 typedef struct Play_interface {
464     const struct SLPlayItf_ *mItf;
465     IObject *mThis;
466     SLuint32 mState;
467     // next 2 fields are read-only to application
468     SLmillisecond mDuration;
469     SLmillisecond mPosition;
470     slPlayCallback mCallback;
471     void *mContext;
472     SLuint32 mEventFlags;
473     // the ISeek trick of using a distinct value doesn't work here because it's readable by app
474     SLmillisecond mMarkerPosition;
475     SLmillisecond mPositionUpdatePeriod; // Zero means do not do position updates (FIXME ~0)
476 #ifdef USE_OUTPUTMIXEXT
477     SLuint32 mFrameUpdatePeriod;         // mPositionUpdatePeriod in frame units
478     SLmillisecond mLastSeekPosition;     // Last known accurate position, set at Seek
479     SLuint32 mFramesSinceLastSeek;       // Frames mixed since last known accurate position
480     SLuint32 mFramesSincePositionUpdate; // Frames mixed since last position update callback
481 #endif
482 } IPlay;
483 
484 typedef struct {
485     const struct SLPlaybackRateItf_ *mItf;
486     IObject *mThis;
487     SLpermille mRate;
488     SLuint32 mProperties;
489     // const after initialization
490     SLpermille mMinRate;
491     SLpermille mMaxRate;
492     SLpermille mStepSize;
493     SLuint32 mCapabilities;
494 } IPlaybackRate;
495 
496 typedef struct {
497     const struct SLPrefetchStatusItf_ *mItf;
498     IObject *mThis;
499     SLuint32 mStatus;
500     SLpermille mLevel;
501     slPrefetchCallback mCallback;
502     void *mContext;
503     SLuint32 mCallbackEventsMask;
504     SLpermille mFillUpdatePeriod;
505 #ifdef ANDROID
506     /** FIXME used to call PrefetchStatus callback with object unlocked prior to return from API */
507     slPrefetchCallback mDeferredPrefetchCallback;
508     void *mDeferredPrefetchContext;
509     SLuint32 mDeferredPrefetchEvents;
510 #endif
511 } IPrefetchStatus;
512 
513 typedef struct {
514     const struct SLPresetReverbItf_ *mItf;
515     IObject *mThis;
516     SLuint16 mPreset;
517 #if defined(ANDROID)
518     effect_descriptor_t mPresetReverbDescriptor;
519     android::sp<android::AudioEffect> mPresetReverbEffect;
520 #endif
521 } IPresetReverb;
522 
523 typedef struct {
524     const struct SLRatePitchItf_ *mItf;
525     IObject *mThis;
526     SLpermille mRate;
527     // const
528     SLpermille mMinRate;
529     SLpermille mMaxRate;
530 } IRatePitch;
531 
532 typedef struct {
533     const struct SLRecordItf_ *mItf;
534     IObject *mThis;
535     SLuint32 mState;
536     SLmillisecond mDurationLimit;
537     SLmillisecond mPosition;
538     slRecordCallback mCallback;
539     void *mContext;
540     SLuint32 mCallbackEventsMask;
541     SLmillisecond mMarkerPosition;
542     SLmillisecond mPositionUpdatePeriod;
543 } IRecord;
544 
545 typedef struct {
546     const struct SLSeekItf_ *mItf;
547     IObject *mThis;
548     SLmillisecond mPos;     // mPos != SL_TIME_UNKNOWN means pending seek request
549     SLboolean mLoopEnabled;
550     SLmillisecond mStartPos;
551     SLmillisecond mEndPos;
552 } ISeek;
553 
554 typedef struct {
555     const struct SLThreadSyncItf_ *mItf;
556     IObject *mThis;
557     SLboolean mInCriticalSection;
558     SLuint32 mWaiting;  // number of threads waiting
559     pthread_t mOwner;
560 } IThreadSync;
561 
562 typedef struct {
563     const struct SLVibraItf_ *mItf;
564     IObject *mThis;
565     SLboolean mVibrate;
566     SLmilliHertz mFrequency;
567     SLpermille mIntensity;
568 } IVibra;
569 
570 typedef struct {
571     const struct SLVirtualizerItf_ *mItf;
572     IObject *mThis;
573     SLboolean mEnabled;
574     SLpermille mStrength;
575 #if defined(ANDROID)
576     effect_descriptor_t mVirtualizerDescriptor;
577     android::sp<android::AudioEffect> mVirtualizerEffect;
578 #endif
579 } IVirtualizer;
580 
581 typedef struct {
582     const struct SLVisualizationItf_ *mItf;
583     IObject *mThis;
584     slVisualizationCallback mCallback;
585     void *mContext;
586     SLmilliHertz mRate;
587 } IVisualization;
588 
589 typedef struct /*Volume_interface*/ {
590     const struct SLVolumeItf_ *mItf;
591     IObject *mThis;
592     // Values as specified by the application
593     SLmillibel mLevel;
594     SLpermille mStereoPosition;
595     SLuint8 /*SLboolean*/ mMute;
596     SLuint8 /*SLboolean*/ mEnableStereoPosition;
597 } IVolume;
598 
599 typedef struct {
600     const struct XAEngineItf_ *mItf;
601     IObject *mThis;
602 } IXAEngine;
603 
604 #define NB_SUPPORTED_STREAMS 1 // only one (video) stream supported in this implementation
605 typedef struct {
606     const struct XAStreamInformationItf_ *mItf;
607     IObject *mThis;
608     xaStreamEventChangeCallback mCallback;
609     void *mContext;
610     XAboolean mActiveStreams[NB_SUPPORTED_STREAMS];
611 #ifdef ANDROID
612     android::Vector<StreamInfo> mStreamInfoTable;
613 #endif
614 } IStreamInformation;
615 
616 typedef struct {
617     const struct XAVideoDecoderCapabilitiesItf_ *mItf;
618     IObject *mThis;
619 } IVideoDecoderCapabilities;
620 
621 /* Class structures */
622 
623 /*typedef*/ struct C3DGroup_struct {
624     IObject mObject;
625 #define INTERFACES_3DGroup 6 // see MPH_to_3DGroup in MPH_to.c for list of interfaces
626     SLuint8 mInterfaceStates2[INTERFACES_3DGroup - INTERFACES_Default];
627     IDynamicInterfaceManagement mDynamicInterfaceManagement;
628     I3DLocation m3DLocation;
629     I3DDoppler m3DDoppler;
630     I3DSource m3DSource;
631     I3DMacroscopic m3DMacroscopic;
632     // remaining are per-instance private fields not associated with an interface
633     unsigned mMemberMask;   // set of member objects
634 } /*C3DGroup*/;
635 
636 #ifdef ANDROID
637 
638 // FIXME Move these into the I... section above
639 
640 typedef struct {
641     const struct SLAndroidEffectItf_ *mItf;
642     IObject *mThis;
643     android::KeyedVector<SLuint32, android::sp<android::AudioEffect> > *mEffects;
644 } IAndroidEffect;
645 
646 typedef struct {
647     const struct SLAndroidEffectCapabilitiesItf_ *mItf;
648     IObject *mThis;
649     SLuint32 mNumFx;
650     effect_descriptor_t* mFxDescriptors;
651 } IAndroidEffectCapabilities;
652 
653 typedef struct {
654     const struct SLAndroidEffectSendItf_ *mItf;
655     IObject *mThis;
656     // only one send per interface for now (1 bus)
657     SLboolean mEnabled;
658     SLmillibel mSendLevel; //android::KeyedVector<SLuint32, SLmillibel> mSendLevels;
659 } IAndroidEffectSend;
660 
661 typedef struct {
662     const struct SLAndroidConfigurationItf_ *mItf;
663     IObject *mThis;
664 } IAndroidConfiguration;
665 
666 typedef struct {
667     const struct SLAndroidBufferQueueItf_ *mItf;
668     IObject *mThis;
669     SLAndroidBufferQueueState mState;
670     slAndroidBufferQueueCallback mCallback;
671     SLuint32 mCallbackEventsMask;
672     void *mContext;
673     SLuint16 mNumBuffers;
674     AndroidBufferType_type mBufferType;
675     AdvancedBufferHeader *mBufferArray;
676     AdvancedBufferHeader *mFront, *mRear;
677     bool mEOS;  // whether EOS has been enqueued; never reset
678 } IAndroidBufferQueue;
679 
680 typedef struct {
681     const struct SLAndroidAcousticEchoCancellationItf_ *mItf;
682     IObject *mThis;
683     SLboolean mEnabled;
684     effect_descriptor_t mAECDescriptor;
685     android::sp<android::AudioEffect> mAECEffect;
686 } IAndroidAcousticEchoCancellation;
687 
688 typedef struct {
689     const struct SLAndroidAutomaticGainControlItf_ *mItf;
690     IObject *mThis;
691     SLboolean mEnabled;
692      effect_descriptor_t mAGCDescriptor;
693      android::sp<android::AudioEffect> mAGCEffect;
694 } IAndroidAutomaticGainControl;
695 
696 typedef struct {
697     const struct SLAndroidNoiseSuppressionItf_ *mItf;
698     IObject *mThis;
699     SLboolean mEnabled;
700     effect_descriptor_t mNSDescriptor;
701     android::sp<android::AudioEffect> mNSEffect;
702 } IAndroidNoiseSuppression;
703 
704 #endif
705