changeset 234:fd331fac5f38

...
author Chris Cannam
date Fri, 16 Feb 2007 15:04:23 +0000 (2007-02-16)
parents 0d943a3fcc77
children 84ff7ba52993
files base/AudioLevel.cpp
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/base/AudioLevel.cpp	Fri Feb 16 13:00:17 2007 +0000
+++ b/base/AudioLevel.cpp	Fri Feb 16 15:04:23 2007 +0000
@@ -52,7 +52,8 @@
 float
 AudioLevel::multiplier_to_dB(float multiplier)
 {
-    if (multiplier == 0.0) return DB_FLOOR;
+    if (multiplier == 0.f) return DB_FLOOR;
+    else if (multiplier < 0.f) return multiplier_to_dB(-multiplier);
     float dB = 10 * log10f(multiplier);
     return dB;
 }
@@ -231,6 +232,10 @@
 AudioLevel::multiplier_to_preview(float m, int levels)
 {
     assert(levels > 0);
+    return multiplier_to_fader(m, levels, PreviewLevel);
+
+    /* The original multiplier_to_preview which follows is not thread-safe.
+
     if (m < 0.0) return -multiplier_to_preview(-m, levels);
 
     const LevelList &ll = getPreviewLevelCache(levels);
@@ -259,15 +264,20 @@
     }
 		   
     return result;
+
+    */
 }
 
 float
 AudioLevel::preview_to_multiplier(int level, int levels)
 {
     assert(levels > 0);
+    return fader_to_multiplier(level, levels, PreviewLevel);
+/*
     if (level < 0) return -preview_to_multiplier(-level, levels);
     const LevelList &ll = getPreviewLevelCache(levels);
     return ll[level];
+*/
 }