diff --git a/src/audio/volume/volume.c b/src/audio/volume/volume.c index c71eacba1..30896fd87 100644 --- a/src/audio/volume/volume.c +++ b/src/audio/volume/volume.c @@ -283,18 +283,22 @@ static inline void volume_ramp(struct processing_module *mod) * calculated from previous gain and ramp time. The slope * coefficient is calculated in volume_set_chan(). */ -#if defined CONFIG_COMP_VOLUME_WINDOWS_FADE && defined CONFIG_COMP_VOLUME_LINEAR_RAMP - if (cd->ramp_type == SOF_VOLUME_WINDOWS_FADE) + switch (cd->ramp_type) { +#if CONFIG_COMP_VOLUME_WINDOWS_FADE + case SOF_VOLUME_WINDOWS_FADE: new_vol = volume_windows_fade_ramp(cd, ramp_time, i); - else - new_vol = volume_linear_ramp(cd, ramp_time, i); -#elif defined CONFIG_COMP_VOLUME_WINDOWS_FADE - new_vol = volume_windows_fade_ramp(cd, ramp_time, i); -#elif defined CONFIG_COMP_VOLUME_LINEAR_RAMP - new_vol = volume_linear_ramp(cd, ramp_time, i); -#else - new_vol = tvolume; + break; #endif +#if CONFIG_COMP_VOLUME_LINEAR_RAMP + case SOF_VOLUME_LINEAR: + case SOF_VOLUME_LINEAR_ZC: + new_vol = volume_linear_ramp(cd, ramp_time, i); + break; +#endif + default: + new_vol = tvolume; + } + if (volume < tvolume) { /* ramp up, check if ramp completed */ if (new_vol < tvolume) diff --git a/src/audio/volume/volume_ipc4.c b/src/audio/volume/volume_ipc4.c index 8823bd2cb..b54e52c39 100644 --- a/src/audio/volume/volume_ipc4.c +++ b/src/audio/volume/volume_ipc4.c @@ -86,8 +86,13 @@ static void init_ramp(struct vol_data *cd, uint32_t curve_duration, uint32_t tar /* In IPC4 driver sends curve_duration in hundred of ns - it should be * converted into ms value required by firmware */ - cd->initial_ramp = Q_MULTSR_32X32((int64_t)curve_duration, - Q_CONVERT_FLOAT(1.0 / 10000, 31), 0, 31, 0); + if (cd->ramp_type == SOF_VOLUME_WINDOWS_NO_FADE) { + cd->initial_ramp = 0; + cd->ramp_finished = true; + } else { + cd->initial_ramp = Q_MULTSR_32X32((int64_t)curve_duration, + Q_CONVERT_FLOAT(1.0 / 10000, 31), 0, 31, 0); + } if (!cd->initial_ramp) { /* In case when initial ramp time is equal to zero, vol_min and