Initialize volume as 0 for volume control effect.
If a effect is going to be the effect that controls volume, initialize
the volume as 0 for safe ramping. The actual volume is always set when
preparing the tracks. However, the effect can still be enabled after
that and before the next tracks preparation. In that case, initialize
the volume as 0 can help avoid sound blast out when the effect is
enabled.
Bug: 328598362
Test: atest AudioEffectTest
Test: repo steps in the bug
Change-Id: I24eb3c7f21dee8dd4bf9337010b05c09f8f00873
diff --git a/services/audioflinger/IAfEffect.h b/services/audioflinger/IAfEffect.h
index 0c8e9e3..d5adeb4 100644
--- a/services/audioflinger/IAfEffect.h
+++ b/services/audioflinger/IAfEffect.h
@@ -163,7 +163,8 @@
virtual int16_t *inBuffer() const = 0;
virtual status_t setDevices(const AudioDeviceTypeAddrVector &devices) = 0;
virtual status_t setInputDevice(const AudioDeviceTypeAddr &device) = 0;
- virtual status_t setVolume(uint32_t *left, uint32_t *right, bool controller) = 0;
+ virtual status_t setVolume(uint32_t *left, uint32_t *right, bool controller,
+ bool force = false) = 0;
virtual status_t setOffloaded_l(bool offloaded, audio_io_handle_t io) = 0;
virtual bool isOffloaded_l() const = 0;