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 #endif 241 // saves a malloc in the typical case 242 #define BUFFER_HEADER_TYPICAL 4 243 BufferHeader mTypical[BUFFER_HEADER_TYPICAL+1]; 244 } IBufferQueue; 245 246 #define MAX_DEVICE 2 // hard-coded array size for default in/out 247 248 typedef struct { 249 const struct SLDeviceVolumeItf_ *mItf; 250 IObject *mThis; 251 SLint32 mVolume[MAX_DEVICE]; 252 } IDeviceVolume; 253 254 typedef struct { 255 const struct SLDynamicInterfaceManagementItf_ *mItf; 256 IObject *mThis; 257 slDynamicInterfaceManagementCallback mCallback; 258 void *mContext; 259 } IDynamicInterfaceManagement; 260 261 typedef struct { 262 const struct SLDynamicSourceItf_ *mItf; 263 IObject *mThis; 264 SLDataSource *mDataSource; 265 } IDynamicSource; 266 267 // private 268 269 struct EnableLevel { 270 SLboolean mEnable; 271 SLmillibel mSendLevel; 272 }; 273 274 // indexes into IEffectSend.mEnableLevels 275 276 #define AUX_ENVIRONMENTALREVERB 0 277 #define AUX_PRESETREVERB 1 278 #define AUX_MAX 2 279 280 typedef struct { 281 const struct SLEffectSendItf_ *mItf; 282 IObject *mThis; 283 struct EnableLevel mEnableLevels[AUX_MAX]; // wet enable and volume per effect type 284 } IEffectSend; 285 286 typedef struct Engine_interface { 287 const struct SLEngineItf_ *mItf; 288 IObject *mThis; 289 SLboolean mLossOfControlGlobal; 290 #ifdef USE_SDL 291 COutputMix *mOutputMix; // SDL pulls PCM from an arbitrary IOutputMixExt 292 #endif 293 // Each engine is its own universe. 294 SLuint32 mInstanceCount; 295 unsigned mInstanceMask; // 1 bit per active object 296 unsigned mChangedMask; // objects which have changed since last sync 297 #define MAX_INSTANCE 32 // maximum active objects per engine, see mInstanceMask 298 IObject *mInstances[MAX_INSTANCE]; 299 SLboolean mShutdown; 300 SLboolean mShutdownAck; 301 // SLuint32 mVersion; // 0xXXYYZZ where XX=major, YY=minor, ZZ=step 302 } IEngine; 303 304 typedef struct { 305 const struct SLEngineCapabilitiesItf_ *mItf; 306 IObject *mThis; 307 SLboolean mThreadSafe; 308 // const 309 SLuint32 mMaxIndexLED; 310 SLuint32 mMaxIndexVibra; 311 } IEngineCapabilities; 312 313 typedef struct { 314 const struct SLEnvironmentalReverbItf_ *mItf; 315 IObject *mThis; 316 SLEnvironmentalReverbSettings mProperties; 317 #if defined(ANDROID) 318 effect_descriptor_t mEnvironmentalReverbDescriptor; 319 android::sp<android::AudioEffect> mEnvironmentalReverbEffect; 320 #endif 321 } IEnvironmentalReverb; 322 323 struct EqualizerBand { 324 SLmilliHertz mMin; 325 SLmilliHertz mCenter; 326 SLmilliHertz mMax; 327 }; 328 329 #if defined(ANDROID) 330 #define MAX_EQ_BANDS 0 331 #else 332 #define MAX_EQ_BANDS 4 // compile-time limit, runtime limit may be smaller 333 #endif 334 335 typedef struct { 336 const struct SLEqualizerItf_ *mItf; 337 IObject *mThis; 338 SLboolean mEnabled; 339 SLuint16 mPreset; 340 #if 0 < MAX_EQ_BANDS 341 SLmillibel mLevels[MAX_EQ_BANDS]; 342 #endif 343 // const to end of struct 344 SLuint16 mNumPresets; 345 SLuint16 mNumBands; 346 #if !defined(ANDROID) 347 const struct EqualizerBand *mBands; 348 const struct EqualizerPreset *mPresets; 349 #endif 350 SLmillibel mBandLevelRangeMin; 351 SLmillibel mBandLevelRangeMax; 352 #if defined(ANDROID) 353 effect_descriptor_t mEqDescriptor; 354 android::sp<android::AudioEffect> mEqEffect; 355 #endif 356 } IEqualizer; 357 358 #define MAX_LED_COUNT 32 359 360 typedef struct { 361 const struct SLLEDArrayItf_ *mItf; 362 IObject *mThis; 363 SLuint32 mLightMask; 364 SLHSL mColors[MAX_LED_COUNT]; 365 // const 366 SLuint8 mCount; 367 } ILEDArray; 368 369 typedef struct { 370 const struct SLMetadataExtractionItf_ *mItf; 371 IObject *mThis; 372 SLuint32 mKeySize; 373 const void *mKey; 374 SLuint32 mKeyEncoding; 375 const SLchar *mValueLangCountry; 376 SLuint32 mValueEncoding; 377 SLuint8 mFilterMask; 378 int mKeyFilter; 379 } IMetadataExtraction; 380 381 typedef struct { 382 const struct SLMetadataTraversalItf_ *mItf; 383 IObject *mThis; 384 SLuint32 mIndex; 385 SLuint32 mMode; 386 SLuint32 mCount; 387 SLuint32 mSize; 388 } IMetadataTraversal; 389 390 typedef struct { 391 const struct SLMIDIMessageItf_ *mItf; 392 IObject *mThis; 393 slMetaEventCallback mMetaEventCallback; 394 void *mMetaEventContext; 395 slMIDIMessageCallback mMessageCallback; 396 void *mMessageContext; 397 SLuint8 mMessageTypes; 398 } IMIDIMessage; 399 400 typedef struct { 401 const struct SLMIDIMuteSoloItf_ *mItf; 402 IObject *mThis; 403 SLuint16 mChannelMuteMask; 404 SLuint16 mChannelSoloMask; 405 SLuint32 mTrackMuteMask; 406 SLuint32 mTrackSoloMask; 407 // const 408 SLuint16 mTrackCount; 409 } IMIDIMuteSolo; 410 411 typedef struct { 412 const struct SLMIDITempoItf_ *mItf; 413 IObject *mThis; 414 SLuint32 mTicksPerQuarterNote; 415 SLuint32 mMicrosecondsPerQuarterNote; 416 } IMIDITempo; 417 418 typedef struct { 419 const struct SLMIDITimeItf_ *mItf; 420 IObject *mThis; 421 SLuint32 mDuration; 422 SLuint32 mPosition; 423 SLuint32 mStartTick; 424 SLuint32 mNumTicks; 425 } IMIDITime; 426 427 typedef struct { 428 const struct SLMuteSoloItf_ *mItf; 429 IObject *mThis; 430 // fields that were formerly here are now at CAudioPlayer 431 } IMuteSolo; 432 433 #define MAX_TRACK 32 // see mActiveMask 434 435 typedef struct { 436 const struct SLOutputMixItf_ *mItf; 437 IObject *mThis; 438 slMixDeviceChangeCallback mCallback; 439 void *mContext; 440 } IOutputMix; 441 442 #ifdef USE_OUTPUTMIXEXT 443 typedef struct { 444 const struct SLOutputMixExtItf_ *mItf; 445 IObject *mThis; 446 unsigned mActiveMask; // 1 bit per active track 447 Track mTracks[MAX_TRACK]; 448 SLboolean mDestroyRequested; ///< Mixer to acknowledge application's call to Object::Destroy 449 } IOutputMixExt; 450 #endif 451 452 typedef struct { 453 const struct SLPitchItf_ *mItf; 454 IObject *mThis; 455 SLpermille mPitch; 456 // const 457 SLpermille mMinPitch; 458 SLpermille mMaxPitch; 459 } IPitch; 460 461 typedef struct Play_interface { 462 const struct SLPlayItf_ *mItf; 463 IObject *mThis; 464 SLuint32 mState; 465 // next 2 fields are read-only to application 466 SLmillisecond mDuration; 467 SLmillisecond mPosition; 468 slPlayCallback mCallback; 469 void *mContext; 470 SLuint32 mEventFlags; 471 // the ISeek trick of using a distinct value doesn't work here because it's readable by app 472 SLmillisecond mMarkerPosition; 473 SLmillisecond mPositionUpdatePeriod; // Zero means do not do position updates (FIXME ~0) 474 #ifdef USE_OUTPUTMIXEXT 475 SLuint32 mFrameUpdatePeriod; // mPositionUpdatePeriod in frame units 476 SLmillisecond mLastSeekPosition; // Last known accurate position, set at Seek 477 SLuint32 mFramesSinceLastSeek; // Frames mixed since last known accurate position 478 SLuint32 mFramesSincePositionUpdate; // Frames mixed since last position update callback 479 #endif 480 } IPlay; 481 482 typedef struct { 483 const struct SLPlaybackRateItf_ *mItf; 484 IObject *mThis; 485 SLpermille mRate; 486 SLuint32 mProperties; 487 // const after initialization 488 SLpermille mMinRate; 489 SLpermille mMaxRate; 490 SLpermille mStepSize; 491 SLuint32 mCapabilities; 492 } IPlaybackRate; 493 494 typedef struct { 495 const struct SLPrefetchStatusItf_ *mItf; 496 IObject *mThis; 497 SLuint32 mStatus; 498 SLpermille mLevel; 499 slPrefetchCallback mCallback; 500 void *mContext; 501 SLuint32 mCallbackEventsMask; 502 SLpermille mFillUpdatePeriod; 503 #ifdef ANDROID 504 /** FIXME used to call PrefetchStatus callback with object unlocked prior to return from API */ 505 slPrefetchCallback mDeferredPrefetchCallback; 506 void *mDeferredPrefetchContext; 507 SLuint32 mDeferredPrefetchEvents; 508 #endif 509 } IPrefetchStatus; 510 511 typedef struct { 512 const struct SLPresetReverbItf_ *mItf; 513 IObject *mThis; 514 SLuint16 mPreset; 515 #if defined(ANDROID) 516 effect_descriptor_t mPresetReverbDescriptor; 517 android::sp<android::AudioEffect> mPresetReverbEffect; 518 #endif 519 } IPresetReverb; 520 521 typedef struct { 522 const struct SLRatePitchItf_ *mItf; 523 IObject *mThis; 524 SLpermille mRate; 525 // const 526 SLpermille mMinRate; 527 SLpermille mMaxRate; 528 } IRatePitch; 529 530 typedef struct { 531 const struct SLRecordItf_ *mItf; 532 IObject *mThis; 533 SLuint32 mState; 534 SLmillisecond mDurationLimit; 535 SLmillisecond mPosition; 536 slRecordCallback mCallback; 537 void *mContext; 538 SLuint32 mCallbackEventsMask; 539 SLmillisecond mMarkerPosition; 540 SLmillisecond mPositionUpdatePeriod; 541 } IRecord; 542 543 typedef struct { 544 const struct SLSeekItf_ *mItf; 545 IObject *mThis; 546 SLmillisecond mPos; // mPos != SL_TIME_UNKNOWN means pending seek request 547 SLboolean mLoopEnabled; 548 SLmillisecond mStartPos; 549 SLmillisecond mEndPos; 550 } ISeek; 551 552 typedef struct { 553 const struct SLThreadSyncItf_ *mItf; 554 IObject *mThis; 555 SLboolean mInCriticalSection; 556 SLuint32 mWaiting; // number of threads waiting 557 pthread_t mOwner; 558 } IThreadSync; 559 560 typedef struct { 561 const struct SLVibraItf_ *mItf; 562 IObject *mThis; 563 SLboolean mVibrate; 564 SLmilliHertz mFrequency; 565 SLpermille mIntensity; 566 } IVibra; 567 568 typedef struct { 569 const struct SLVirtualizerItf_ *mItf; 570 IObject *mThis; 571 SLboolean mEnabled; 572 SLpermille mStrength; 573 #if defined(ANDROID) 574 effect_descriptor_t mVirtualizerDescriptor; 575 android::sp<android::AudioEffect> mVirtualizerEffect; 576 #endif 577 } IVirtualizer; 578 579 typedef struct { 580 const struct SLVisualizationItf_ *mItf; 581 IObject *mThis; 582 slVisualizationCallback mCallback; 583 void *mContext; 584 SLmilliHertz mRate; 585 } IVisualization; 586 587 typedef struct /*Volume_interface*/ { 588 const struct SLVolumeItf_ *mItf; 589 IObject *mThis; 590 // Values as specified by the application 591 SLmillibel mLevel; 592 SLpermille mStereoPosition; 593 SLuint8 /*SLboolean*/ mMute; 594 SLuint8 /*SLboolean*/ mEnableStereoPosition; 595 } IVolume; 596 597 typedef struct { 598 const struct XAEngineItf_ *mItf; 599 IObject *mThis; 600 } IXAEngine; 601 602 #define NB_SUPPORTED_STREAMS 1 // only one (video) stream supported in this implementation 603 typedef struct { 604 const struct XAStreamInformationItf_ *mItf; 605 IObject *mThis; 606 xaStreamEventChangeCallback mCallback; 607 void *mContext; 608 XAboolean mActiveStreams[NB_SUPPORTED_STREAMS]; 609 #ifdef ANDROID 610 android::Vector<StreamInfo> mStreamInfoTable; 611 #endif 612 } IStreamInformation; 613 614 typedef struct { 615 const struct XAVideoDecoderCapabilitiesItf_ *mItf; 616 IObject *mThis; 617 } IVideoDecoderCapabilities; 618 619 /* Class structures */ 620 621 /*typedef*/ struct C3DGroup_struct { 622 IObject mObject; 623 #define INTERFACES_3DGroup 6 // see MPH_to_3DGroup in MPH_to.c for list of interfaces 624 SLuint8 mInterfaceStates2[INTERFACES_3DGroup - INTERFACES_Default]; 625 IDynamicInterfaceManagement mDynamicInterfaceManagement; 626 I3DLocation m3DLocation; 627 I3DDoppler m3DDoppler; 628 I3DSource m3DSource; 629 I3DMacroscopic m3DMacroscopic; 630 // remaining are per-instance private fields not associated with an interface 631 unsigned mMemberMask; // set of member objects 632 } /*C3DGroup*/; 633 634 #ifdef ANDROID 635 636 // FIXME Move these into the I... section above 637 638 typedef struct { 639 const struct SLAndroidEffectItf_ *mItf; 640 IObject *mThis; 641 android::KeyedVector<SLuint32, android::AudioEffect* > *mEffects; 642 } IAndroidEffect; 643 644 typedef struct { 645 const struct SLAndroidEffectCapabilitiesItf_ *mItf; 646 IObject *mThis; 647 SLuint32 mNumFx; 648 effect_descriptor_t* mFxDescriptors; 649 } IAndroidEffectCapabilities; 650 651 typedef struct { 652 const struct SLAndroidEffectSendItf_ *mItf; 653 IObject *mThis; 654 // only one send per interface for now (1 bus) 655 SLboolean mEnabled; 656 SLmillibel mSendLevel; //android::KeyedVector<SLuint32, SLmillibel> mSendLevels; 657 } IAndroidEffectSend; 658 659 typedef struct { 660 const struct SLAndroidConfigurationItf_ *mItf; 661 IObject *mThis; 662 } IAndroidConfiguration; 663 664 typedef struct { 665 const struct SLAndroidBufferQueueItf_ *mItf; 666 IObject *mThis; 667 SLAndroidBufferQueueState mState; 668 slAndroidBufferQueueCallback mCallback; 669 SLuint32 mCallbackEventsMask; 670 void *mContext; 671 SLuint16 mNumBuffers; 672 AndroidBufferType_type mBufferType; 673 AdvancedBufferHeader *mBufferArray; 674 AdvancedBufferHeader *mFront, *mRear; 675 bool mEOS; // whether EOS has been enqueued; never reset 676 } IAndroidBufferQueue; 677 678 typedef struct { 679 const struct SLAndroidAcousticEchoCancellationItf_ *mItf; 680 IObject *mThis; 681 SLboolean mEnabled; 682 effect_descriptor_t mAECDescriptor; 683 android::sp<android::AudioEffect> mAECEffect; 684 } IAndroidAcousticEchoCancellation; 685 686 typedef struct { 687 const struct SLAndroidAutomaticGainControlItf_ *mItf; 688 IObject *mThis; 689 SLboolean mEnabled; 690 effect_descriptor_t mAGCDescriptor; 691 android::sp<android::AudioEffect> mAGCEffect; 692 } IAndroidAutomaticGainControl; 693 694 typedef struct { 695 const struct SLAndroidNoiseSuppressionItf_ *mItf; 696 IObject *mThis; 697 SLboolean mEnabled; 698 effect_descriptor_t mNSDescriptor; 699 android::sp<android::AudioEffect> mNSEffect; 700 } IAndroidNoiseSuppression; 701 702 #endif 703