Volume: Fix for gain ramp step macro value

This patch fixes the calculation of macro VOL_RAMP_STEP_CONST
that is used in linear step size calculation. The previous version
calculated incorrectly the value as inverse. However with used ramp
update rate of 1000 us there were no issues seen because the value
and inverse were both 1.0. The bug would have triggered with with
a faster or slower ramp update rate.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This commit is contained in:
Seppo Ingalsuo 2019-12-05 11:54:07 +02:00 committed by Liam Girdwood
parent e0a9afe6a7
commit e525c177b5
1 changed files with 4 additions and 3 deletions

View File

@ -75,12 +75,13 @@ struct sof_ipc_ctrl_value_chan;
/** /**
* \brief Macro for volume linear gain ramp step computation * \brief Macro for volume linear gain ramp step computation
* Volume gain ramp step as Q1.16 is computed with equation * Volume gain ramp step as Q1.16 is computed with equation
* step = VOL_RAMP_STEP_CONST/ SOF_TKN_VOLUME_RAMP_STEP_MS. This * step = VOL_RAMP_STEP_CONST / SOF_TKN_VOLUME_RAMP_STEP_MS. This
* macro defines as Q1.16 value the constant term * macro defines as Q1.16 value the constant term
* (1000 / VOL_RAMP_UPDATE) for step calculation. * VOL_RAMP_UPDATE / 1000.0 for step calculation. The value 1000
* is used to to convert microseconds to milliseconds.
*/ */
#define VOL_RAMP_STEP_CONST \ #define VOL_RAMP_STEP_CONST \
Q_CONVERT_FLOAT(1000.0 / VOL_RAMP_UPDATE_US, VOL_QXY_Y) Q_CONVERT_FLOAT(VOL_RAMP_UPDATE_US / 1000.0, VOL_QXY_Y)
/** /**
* \brief Volume maximum value. * \brief Volume maximum value.