Only set initial volume to 0 for the effect that does volume control.
When the effect for doing volume control is changed, set volume for the
old one as full level and the new one as 0 for safe ramping.
Bug: 280641126
Test: repo steps in the bug
Change-Id: I0f843c8deae907f8584dc18d025ab499319784b5
Merged-In: I0f843c8deae907f8584dc18d025ab499319784b5
diff --git a/services/audioflinger/Effects.h b/services/audioflinger/Effects.h
index e1a76fc..24e20f3 100644
--- a/services/audioflinger/Effects.h
+++ b/services/audioflinger/Effects.h
@@ -673,6 +673,8 @@
ssize_t getInsertIndex(const effect_descriptor_t& desc);
+ std::optional<size_t> findVolumeControl_l(size_t from, size_t to) const;
+
mutable Mutex mLock; // mutex protecting effect list
Vector< sp<EffectModule> > mEffects; // list of effect modules
audio_session_t mSessionId; // audio session ID
@@ -685,7 +687,6 @@
int32_t mTailBufferCount; // current effect tail buffer count
int32_t mMaxTailBuffers; // maximum effect tail buffers
- int mVolumeCtrlIdx; // index of insert effect having control over volume
uint32_t mLeftVolume; // previous volume on left channel
uint32_t mRightVolume; // previous volume on right channel
uint32_t mNewLeftVolume; // new volume on left channel
@@ -698,6 +699,8 @@
KeyedVector< int, sp<SuspendedEffectDesc> > mSuspendedEffects;
const sp<EffectCallback> mEffectCallback;
+
+ wp<EffectModule> mVolumeControlEffect;
};
class DeviceEffectProxy : public EffectBase {