From 72b9006dbecde53213821bdbd14507e4e0c28e3f Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Fri, 15 Mar 2024 16:41:13 +0200 Subject: [PATCH] Audio: Volume: Workaround to prevent linear ramp when not requested This does not help other ramp types so need to find a common way to prevent a ramp to happen when another channel is adjusted. TODO: It looks like the other changes addressed this issue. Should be possible to leave this out. Signed-off-by: Seppo Ingalsuo --- src/audio/volume/volume.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/audio/volume/volume.c b/src/audio/volume/volume.c index 7c888212c0f3..5bd7c851a5ec 100644 --- a/src/audio/volume/volume.c +++ b/src/audio/volume/volume.c @@ -322,19 +322,25 @@ static inline void volume_ramp(struct processing_module *mod) if (volume < tvolume) { /* ramp up, check if ramp completed */ - if (new_vol < tvolume) + if (new_vol < tvolume) { cd->ramp_finished = false; - else + } else { new_vol = tvolume; + cd->ramp_coef[i] = 0; + } + } else { /* ramp down */ - if (new_vol > tvolume) + if (new_vol > tvolume) { cd->ramp_finished = false; - else + } else { new_vol = tvolume; + cd->ramp_coef[i] = 0; + } } cd->volume[i] = new_vol; } + /* assign other channel volume as the first calculated volume with same volume case */ for (i = cd->ramp_channel_counter; i < cd->channels; i++) cd->volume[i] = cd->volume[0];