[SCM] calf/master: Display VU meter values in dB.

js at users.alioth.debian.org js at users.alioth.debian.org
Tue May 7 15:40:50 UTC 2013


The following commit has been merged in the master branch:
commit 38da525ee31ea75eba547c2209f21f4ff04d73bc
Author: Krzysztof Foltman <wdev at foltman.com>
Date:   Fri Jan 13 23:17:29 2012 +0000

    Display VU meter values in dB.

diff --git a/src/calf/primitives.h b/src/calf/primitives.h
index cbc7758..0bffd85 100644
--- a/src/calf/primitives.h
+++ b/src/calf/primitives.h
@@ -522,6 +522,12 @@ inline float hermite_interpolation(float x, float x0, float x1, float p0, float
     //return (2*t3 - 3*t2 + 1) * p0 + (t3 - 2*t2 + t) * m0 + (-2*t3 + 3*t2) * p1 + (t3-t2) * m1;
 }
 
+/// convert amplitude value to dB
+inline float amp2dB(float amp)
+{
+    return 6.0 * log(amp) / log(2);
+}
+
 };
 
 #endif
diff --git a/src/ctl_vumeter.cpp b/src/ctl_vumeter.cpp
index 4b98272..19ac19e 100644
--- a/src/ctl_vumeter.cpp
+++ b/src/ctl_vumeter.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "config.h"
+#include <calf/primitives.h>
 #include <calf/ctl_vumeter.h>
 #include <gdk/gdkkeysyms.h>
 #include <cairo/cairo.h>
@@ -322,10 +323,10 @@ calf_vumeter_expose (GtkWidget *widget, GdkEventExpose *event)
         if((vu->value > vu->disp_value and vu->mode != VU_MONOCHROME_REVERSE)
         or (vu->value < vu->disp_value and vu->mode == VU_MONOCHROME_REVERSE))
             vu->disp_value = vu->value;
-        if (vu->disp_value < 1.0 / 1024.0)
+        if (vu->disp_value < 1.0 / 32768.0)
             sprintf(str, "-inf");
         else
-            sprintf(str, "%0.2f", vu->disp_value);
+            sprintf(str, "%0.2f", dsp::amp2dB(vu->disp_value));
         // draw value as number
         cairo_text_extents(c, str, &extents);
         cairo_move_to(c, text_x + (text_w - extents.width) / 2.0, text_y);

-- 
calf audio plugins packaging



More information about the pkg-multimedia-commits mailing list