The old code was assuming that the interface was expecting power
values, while it actually uses amplitude values. In addition the
difference between the min/max values where used, resulting in
quite high gain values.
Task-number: QTBUG-34777
Change-Id: Ibd3f7774b67c44e37dfd79cbe6e2c35746f00a0a
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
#define BUFFER_COUNT 2
#define DEFAULT_PERIOD_TIME_MS 50
#define MINIMUM_PERIOD_TIME_MS 5
+#define EBASE 2.302585093
+#define LOG10(x) qLn(x)/qreal(EBASE)
QT_BEGIN_NAMESPACE
if (qFuzzyCompare(vol, qreal(1.0)))
return 0;
- return SL_MILLIBEL_MIN + ((1 - (qLn(10 - (vol * 10)) / qLn(10))) * SL_MILLIBEL_MAX);
+ return 20 * LOG10(vol) * 100; // I.e., 20 * LOG10(SL_MILLIBEL_MAX * vol / SL_MILLIBEL_MAX)
}
QT_END_NAMESPACE