aboutsummaryrefslogtreecommitdiff
path: root/iemlib1/src/v2db.c
diff options
context:
space:
mode:
authormusil <tmusil@users.sourceforge.net>2006-12-09 02:00:52 +0000
committermusil <tmusil@users.sourceforge.net>2006-12-09 02:00:52 +0000
commitd6b088044e161a27d49df537bbb6d998a8d0e50d (patch)
tree1a1b3a30e994767f4ef97b90194782258f2baa8a /iemlib1/src/v2db.c
parent32dc0c0deb13ce57f099f616ddc427296970d8a5 (diff)
// class_sethelpsymbol();
changed help-*.pd to *-help.pd chanded file structure to standard 1st step remove old svn path=/trunk/externals/iemlib/; revision=6756
Diffstat (limited to 'iemlib1/src/v2db.c')
-rw-r--r--iemlib1/src/v2db.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/iemlib1/src/v2db.c b/iemlib1/src/v2db.c
new file mode 100644
index 0000000..7c1adb0
--- /dev/null
+++ b/iemlib1/src/v2db.c
@@ -0,0 +1,39 @@
+/* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution.
+
+iemlib1 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */
+
+
+#include "m_pd.h"
+#include "iemlib.h"
+#include <math.h>
+
+
+/* -------- v2db - a rms-value to techn. dB converter. --------- */
+
+static t_class *v2db_class;
+
+t_float v2db(t_float f)
+{
+ return (f <= 0 ? -199.9 : 8.6858896381*log(f));
+}
+
+static void v2db_float(t_object *x, t_float f)
+{
+ outlet_float(x->ob_outlet, v2db(f));
+}
+
+static void *v2db_new(void)
+{
+ t_object *x = (t_object *)pd_new(v2db_class);
+ outlet_new(x, &s_float);
+ return (x);
+}
+
+void v2db_setup(void)
+{
+ v2db_class = class_new(gensym("v2db"), v2db_new, 0,
+ sizeof(t_object), 0, 0);
+ class_addfloat(v2db_class, (t_method)v2db_float);
+// class_sethelpsymbol(v2db_class, gensym("iemhelp/help-v2db"));
+}