From 58a5a39c7efaf146889b04df0fcf107e432772a7 Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Fri, 18 Sep 2009 20:11:47 +0200 Subject: faster version of volume dB conversion routine --- volume.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/volume.c b/volume.c index 7b82623e..24e876ff 100644 --- a/volume.c +++ b/volume.c @@ -64,7 +64,10 @@ volume_get_amp (void) { float db_to_amp (float dB) { - return pow (10, dB/20.f); +// return pow (10, dB/20.f); + // thanks to he for this hack + const float ln10=2.3025850929940002f; + return exp(ln10*dB/20.f); } float -- cgit v1.2.3