Effects.h revision eb3c337a3d6c74ec857dfc8be7eeafe634614bcd
18a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com/*
28a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com**
38a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com** Copyright 2012, The Android Open Source Project
48a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com**
58a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com** Licensed under the Apache License, Version 2.0 (the "License");
68a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com** you may not use this file except in compliance with the License.
78a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com** You may obtain a copy of the License at
88a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com**
98a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com**     http://www.apache.org/licenses/LICENSE-2.0
108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com**
118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com** Unless required by applicable law or agreed to in writing, software
128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com** distributed under the License is distributed on an "AS IS" BASIS,
138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com** See the License for the specific language governing permissions and
158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com** limitations under the License.
168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com*/
178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef INCLUDING_FROM_AUDIOFLINGER_H
198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    #error This header file should only be included from AudioFlinger.h
208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif
218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com//--- Audio Effect Management
238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// EffectModule and EffectChain classes both have their own mutex to protect
258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// state changes or resource modifications. Always respect the following order
268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// if multiple mutexes must be acquired to avoid cross deadlock:
278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// AudioFlinger -> ThreadBase -> EffectChain -> EffectModule
288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// In addition, methods that lock the AudioPolicyService mutex (getOutputForEffect(),
298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// startOutput()...) should never be called with AudioFlinger or Threadbase mutex locked
308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// to avoid cross deadlock with other clients calling AudioPolicyService methods that in turn
318a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// call AudioFlinger thus locking the same mutexes in the reverse order.
328a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// The EffectModule class is a wrapper object controlling the effect engine implementation
348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// in the effect library. It prevents concurrent calls to process() and command() functions
358a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// from different client threads. It keeps a list of EffectHandle objects corresponding
368a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// to all client applications using this effect and notifies applications of effect state,
378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// control or parameter changes. It manages the activation state machine to send appropriate
388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// reset, enable, disable commands to effect engine and provide volume
398a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// ramping when effects are activated/deactivated.
408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// When controlling an auxiliary effect, the EffectModule also provides an input buffer used by
418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com// the attached track(s) to accumulate their auxiliary channel.
428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass EffectModule : public RefBase {
438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.compublic:
448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    EffectModule(ThreadBase *thread,
458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                    const wp<AudioFlinger::EffectChain>& chain,
468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                    effect_descriptor_t *desc,
478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                    int id,
488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                    int sessionId);
498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    virtual ~EffectModule();
508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    enum effect_state {
528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        IDLE,
538a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        RESTART,
548a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        STARTING,
558a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        ACTIVE,
568a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        STOPPING,
578a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        STOPPED,
588a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        DESTROYED
598a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    };
608a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
618a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    int         id() const { return mId; }
628a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void process();
638a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void updateState();
648a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    status_t command(uint32_t cmdCode,
658a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                     uint32_t cmdSize,
668a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                     void *pCmdData,
678a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                     uint32_t *replySize,
688a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                     void *pReplyData);
698a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
708a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void reset_l();
718a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    status_t configure();
728a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    status_t init();
738a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    effect_state state() const {
748a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        return mState;
758a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
768a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    uint32_t status() {
778a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        return mStatus;
788a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
798a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    int sessionId() const {
808a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com        return mSessionId;
818a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    }
828a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    status_t    setEnabled(bool enabled);
838a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    status_t    setEnabled_l(bool enabled);
848a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    bool isEnabled() const;
858a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    bool isProcessEnabled() const;
868a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
878a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void        setInBuffer(int16_t *buffer) { mConfig.inputCfg.buffer.s16 = buffer; }
888a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    int16_t     *inBuffer() { return mConfig.inputCfg.buffer.s16; }
898a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void        setOutBuffer(int16_t *buffer) { mConfig.outputCfg.buffer.s16 = buffer; }
908a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    int16_t     *outBuffer() { return mConfig.outputCfg.buffer.s16; }
918a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void        setChain(const wp<EffectChain>& chain) { mChain = chain; }
928a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void        setThread(const wp<ThreadBase>& thread) { mThread = thread; }
938a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    const wp<ThreadBase>& thread() { return mThread; }
948a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
958a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    status_t addHandle(EffectHandle *handle);
968a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    size_t disconnect(EffectHandle *handle, bool unpinIfLast);
978a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    size_t removeHandle(EffectHandle *handle);
988a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
998a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    const effect_descriptor_t& desc() const { return mDescriptor; }
1008a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    wp<EffectChain>&     chain() { return mChain; }
1018a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1028a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    status_t         setDevice(audio_devices_t device);
1038a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    status_t         setVolume(uint32_t *left, uint32_t *right, bool controller);
1048a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    status_t         setMode(audio_mode_t mode);
1058a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    status_t         setAudioSource(audio_source_t source);
1068a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    status_t         start();
1078a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    status_t         stop();
1088a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void             setSuspended(bool suspended);
1098a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    bool             suspended() const;
1108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    EffectHandle*    controlHandle_l();
1128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    bool             isPinned() const { return mPinned; }
1148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void             unPin() { mPinned = false; }
1158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    bool             purgeHandles();
1168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void             lock() { mLock.lock(); }
1178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void             unlock() { mLock.unlock(); }
1188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    bool             isOffloadable() const
1198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com                        { return (mDescriptor.flags & EFFECT_FLAG_OFFLOAD_SUPPORTED) != 0; }
1208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    status_t         setOffloaded(bool offloaded, audio_io_handle_t io);
1218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    bool             isOffloaded() const;
1228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1238a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    void             dump(int fd, const Vector<String16>& args);
1248a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comprotected:
1268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    friend class AudioFlinger;      // for mHandles
1278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    bool                mPinned;
1288a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com
1298a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    // Maximum time allocated to effect engines to complete the turn off sequence
1308a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com    static const uint32_t MAX_DISABLE_TIME_MS = 10000;
131
132    EffectModule(const EffectModule&);
133    EffectModule& operator = (const EffectModule&);
134
135    status_t start_l();
136    status_t stop_l();
137    status_t remove_effect_from_hal_l();
138
139mutable Mutex               mLock;      // mutex for process, commands and handles list protection
140    wp<ThreadBase>      mThread;    // parent thread
141    wp<EffectChain>     mChain;     // parent effect chain
142    const int           mId;        // this instance unique ID
143    const int           mSessionId; // audio session ID
144    const effect_descriptor_t mDescriptor;// effect descriptor received from effect engine
145    effect_config_t     mConfig;    // input and output audio configuration
146    effect_handle_t  mEffectInterface; // Effect module C API
147    status_t            mStatus;    // initialization status
148    effect_state        mState;     // current activation state
149    Vector<EffectHandle *> mHandles;    // list of client handles
150                // First handle in mHandles has highest priority and controls the effect module
151    uint32_t mMaxDisableWaitCnt;    // maximum grace period before forcing an effect off after
152                                    // sending disable command.
153    uint32_t mDisableWaitCnt;       // current process() calls count during disable period.
154    bool     mSuspended;            // effect is suspended: temporarily disabled by framework
155    bool     mOffloaded;            // effect is currently offloaded to the audio DSP
156};
157
158// The EffectHandle class implements the IEffect interface. It provides resources
159// to receive parameter updates, keeps track of effect control
160// ownership and state and has a pointer to the EffectModule object it is controlling.
161// There is one EffectHandle object for each application controlling (or using)
162// an effect module.
163// The EffectHandle is obtained by calling AudioFlinger::createEffect().
164class EffectHandle: public android::BnEffect {
165public:
166
167    EffectHandle(const sp<EffectModule>& effect,
168            const sp<AudioFlinger::Client>& client,
169            const sp<IEffectClient>& effectClient,
170            int32_t priority);
171    virtual ~EffectHandle();
172
173    // IEffect
174    virtual status_t enable();
175    virtual status_t disable();
176    virtual status_t command(uint32_t cmdCode,
177                             uint32_t cmdSize,
178                             void *pCmdData,
179                             uint32_t *replySize,
180                             void *pReplyData);
181    virtual void disconnect();
182private:
183            void disconnect(bool unpinIfLast);
184public:
185    virtual sp<IMemory> getCblk() const { return mCblkMemory; }
186    virtual status_t onTransact(uint32_t code, const Parcel& data,
187            Parcel* reply, uint32_t flags);
188
189
190    // Give or take control of effect module
191    // - hasControl: true if control is given, false if removed
192    // - signal: true client app should be signaled of change, false otherwise
193    // - enabled: state of the effect when control is passed
194    void setControl(bool hasControl, bool signal, bool enabled);
195    void commandExecuted(uint32_t cmdCode,
196                         uint32_t cmdSize,
197                         void *pCmdData,
198                         uint32_t replySize,
199                         void *pReplyData);
200    void setEnabled(bool enabled);
201    bool enabled() const { return mEnabled; }
202
203    // Getters
204    int id() const { return mEffect->id(); }
205    int priority() const { return mPriority; }
206    bool hasControl() const { return mHasControl; }
207    sp<EffectModule> effect() const { return mEffect; }
208    // destroyed_l() must be called with the associated EffectModule mLock held
209    bool destroyed_l() const { return mDestroyed; }
210
211    void dump(char* buffer, size_t size);
212
213protected:
214    friend class AudioFlinger;          // for mEffect, mHasControl, mEnabled
215    EffectHandle(const EffectHandle&);
216    EffectHandle& operator =(const EffectHandle&);
217
218    sp<EffectModule> mEffect;           // pointer to controlled EffectModule
219    sp<IEffectClient> mEffectClient;    // callback interface for client notifications
220    /*const*/ sp<Client> mClient;       // client for shared memory allocation, see disconnect()
221    sp<IMemory>         mCblkMemory;    // shared memory for control block
222    effect_param_cblk_t* mCblk;         // control block for deferred parameter setting via
223                                        // shared memory
224    uint8_t*            mBuffer;        // pointer to parameter area in shared memory
225    int mPriority;                      // client application priority to control the effect
226    bool mHasControl;                   // true if this handle is controlling the effect
227    bool mEnabled;                      // cached enable state: needed when the effect is
228                                        // restored after being suspended
229    bool mDestroyed;                    // Set to true by destructor. Access with EffectModule
230                                        // mLock held
231};
232
233// the EffectChain class represents a group of effects associated to one audio session.
234// There can be any number of EffectChain objects per output mixer thread (PlaybackThread).
235// The EffecChain with session ID 0 contains global effects applied to the output mix.
236// Effects in this chain can be insert or auxiliary. Effects in other chains (attached to
237// tracks) are insert only. The EffectChain maintains an ordered list of effect module, the
238// order corresponding in the effect process order. When attached to a track (session ID != 0),
239// it also provide it's own input buffer used by the track as accumulation buffer.
240class EffectChain : public RefBase {
241public:
242    EffectChain(const wp<ThreadBase>& wThread, int sessionId);
243    EffectChain(ThreadBase *thread, int sessionId);
244    virtual ~EffectChain();
245
246    // special key used for an entry in mSuspendedEffects keyed vector
247    // corresponding to a suspend all request.
248    static const int        kKeyForSuspendAll = 0;
249
250    // minimum duration during which we force calling effect process when last track on
251    // a session is stopped or removed to allow effect tail to be rendered
252    static const int        kProcessTailDurationMs = 1000;
253
254    void process_l();
255
256    void lock() {
257        mLock.lock();
258    }
259    void unlock() {
260        mLock.unlock();
261    }
262
263    status_t addEffect_l(const sp<EffectModule>& handle);
264    size_t removeEffect_l(const sp<EffectModule>& handle);
265
266    int sessionId() const { return mSessionId; }
267    void setSessionId(int sessionId) { mSessionId = sessionId; }
268
269    sp<EffectModule> getEffectFromDesc_l(effect_descriptor_t *descriptor);
270    sp<EffectModule> getEffectFromId_l(int id);
271    sp<EffectModule> getEffectFromType_l(const effect_uuid_t *type);
272    bool setVolume_l(uint32_t *left, uint32_t *right);
273    void setDevice_l(audio_devices_t device);
274    void setMode_l(audio_mode_t mode);
275    void setAudioSource_l(audio_source_t source);
276
277    void setInBuffer(int16_t *buffer, bool ownsBuffer = false) {
278        mInBuffer = buffer;
279        mOwnInBuffer = ownsBuffer;
280    }
281    int16_t *inBuffer() const {
282        return mInBuffer;
283    }
284    void setOutBuffer(int16_t *buffer) {
285        mOutBuffer = buffer;
286    }
287    int16_t *outBuffer() const {
288        return mOutBuffer;
289    }
290
291    void incTrackCnt() { android_atomic_inc(&mTrackCnt); }
292    void decTrackCnt() { android_atomic_dec(&mTrackCnt); }
293    int32_t trackCnt() const { return android_atomic_acquire_load(&mTrackCnt); }
294
295    void incActiveTrackCnt() { android_atomic_inc(&mActiveTrackCnt);
296                               mTailBufferCount = mMaxTailBuffers; }
297    void decActiveTrackCnt() { android_atomic_dec(&mActiveTrackCnt); }
298    int32_t activeTrackCnt() const { return android_atomic_acquire_load(&mActiveTrackCnt); }
299
300    uint32_t strategy() const { return mStrategy; }
301    void setStrategy(uint32_t strategy)
302            { mStrategy = strategy; }
303
304    // suspend effect of the given type
305    void setEffectSuspended_l(const effect_uuid_t *type,
306                              bool suspend);
307    // suspend all eligible effects
308    void setEffectSuspendedAll_l(bool suspend);
309    // check if effects should be suspend or restored when a given effect is enable or disabled
310    void checkSuspendOnEffectEnabled(const sp<EffectModule>& effect,
311                                          bool enabled);
312
313    void clearInputBuffer();
314
315    // At least one non offloadable effect in the chain is enabled
316    bool isNonOffloadableEnabled();
317
318
319    void dump(int fd, const Vector<String16>& args);
320
321protected:
322    friend class AudioFlinger;  // for mThread, mEffects
323    EffectChain(const EffectChain&);
324    EffectChain& operator =(const EffectChain&);
325
326    class SuspendedEffectDesc : public RefBase {
327    public:
328        SuspendedEffectDesc() : mRefCount(0) {}
329
330        int mRefCount;
331        effect_uuid_t mType;
332        wp<EffectModule> mEffect;
333    };
334
335    // get a list of effect modules to suspend when an effect of the type
336    // passed is enabled.
337    void                       getSuspendEligibleEffects(Vector< sp<EffectModule> > &effects);
338
339    // get an effect module if it is currently enable
340    sp<EffectModule> getEffectIfEnabled(const effect_uuid_t *type);
341    // true if the effect whose descriptor is passed can be suspended
342    // OEMs can modify the rules implemented in this method to exclude specific effect
343    // types or implementations from the suspend/restore mechanism.
344    bool isEffectEligibleForSuspend(const effect_descriptor_t& desc);
345
346    void clearInputBuffer_l(sp<ThreadBase> thread);
347
348    wp<ThreadBase> mThread;     // parent mixer thread
349    Mutex mLock;                // mutex protecting effect list
350    Vector< sp<EffectModule> > mEffects; // list of effect modules
351    int mSessionId;             // audio session ID
352    int16_t *mInBuffer;         // chain input buffer
353    int16_t *mOutBuffer;        // chain output buffer
354
355    // 'volatile' here means these are accessed with atomic operations instead of mutex
356    volatile int32_t mActiveTrackCnt;    // number of active tracks connected
357    volatile int32_t mTrackCnt;          // number of tracks connected
358
359    int32_t mTailBufferCount;   // current effect tail buffer count
360    int32_t mMaxTailBuffers;    // maximum effect tail buffers
361    bool mOwnInBuffer;          // true if the chain owns its input buffer
362    int mVolumeCtrlIdx;         // index of insert effect having control over volume
363    uint32_t mLeftVolume;       // previous volume on left channel
364    uint32_t mRightVolume;      // previous volume on right channel
365    uint32_t mNewLeftVolume;       // new volume on left channel
366    uint32_t mNewRightVolume;      // new volume on right channel
367    uint32_t mStrategy; // strategy for this effect chain
368    // mSuspendedEffects lists all effects currently suspended in the chain.
369    // Use effect type UUID timelow field as key. There is no real risk of identical
370    // timeLow fields among effect type UUIDs.
371    // Updated by updateSuspendedSessions_l() only.
372    KeyedVector< int, sp<SuspendedEffectDesc> > mSuspendedEffects;
373};
374