summaryrefslogtreecommitdiff
path: root/volume.c
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-09-18 20:11:47 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-09-18 20:11:47 +0200
commit58a5a39c7efaf146889b04df0fcf107e432772a7 (patch)
tree46e7989ecfd39f7e63bacf628b41e5f3c2b50324 /volume.c
parentd8b1b65d322a47febfe20578fd7270d56c212eb8 (diff)
faster version of volume dB conversion routine
Diffstat (limited to 'volume.c')
-rw-r--r--volume.c5
1 files changed, 4 insertions, 1 deletions
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