From 4cf60f1b4538642211369cccd20de07a9a4ac4e5 Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Fri, 15 Mar 2024 16:38:11 +0200 Subject: [PATCH] Audio: Volume: Fix condition for identical ramp The "is_same_volume=true" was returned if target volumes for all channels are the same. The check omitted the fact that start volumes for ramp can be different, e.g. one channel is attenuated while others are 0 dB. This change fixes the random ignore of volume ramp and smooth transition when a volume control is changed. Signed-off-by: Seppo Ingalsuo --- src/audio/volume/volume.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/volume/volume.c b/src/audio/volume/volume.c index bf4833173002..7c888212c0f3 100644 --- a/src/audio/volume/volume.c +++ b/src/audio/volume/volume.c @@ -252,7 +252,7 @@ void volume_set_ramp_channel_counter(struct vol_data *cd, uint32_t channels_coun bool is_same_volume = true; for (i = 1; i < channels_count; i++) { - if (cd->tvolume[0] != cd->tvolume[i]) { + if (cd->tvolume[0] != cd->tvolume[i] || cd->volume[0] != cd->volume[i]) { is_same_volume = false; break; }