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