volume: fix fadeout curve shape

Fadeout curve had inaccurate shape due to incorrect computation of ramp
function.

Suggested by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
This commit is contained in:
Tobiasz Dryjanski 2024-04-22 14:20:02 +02:00 committed by Kai Vehmanen
parent 278ecc5b74
commit 40a6fc7dab
1 changed files with 7 additions and 0 deletions

View File

@ -241,6 +241,13 @@ static inline int32_t volume_windows_fade_ramp(struct vol_data *cd, int32_t ramp
return cd->tvolume[channel]; return cd->tvolume[channel];
time_ratio = (((int64_t)ramp_time) << 30) / (cd->initial_ramp << 3); time_ratio = (((int64_t)ramp_time) << 30) / (cd->initial_ramp << 3);
if (volume_delta < 0) {
time_ratio = (1 << 30) - time_ratio;
pow_value = volume_pow_175(time_ratio);
return cd->tvolume[channel] - Q_MULTSR_32X32((int64_t)volume_delta,
pow_value, 16, 30, 16);
}
pow_value = volume_pow_175(time_ratio); pow_value = volume_pow_175(time_ratio);
return cd->rvolume[channel] + Q_MULTSR_32X32((int64_t)volume_delta, pow_value, 16, 30, 16); return cd->rvolume[channel] + Q_MULTSR_32X32((int64_t)volume_delta, pow_value, 16, 30, 16);
} }