From 577ac6e80ff4f436fbd054291ed7dddbc31bd49a Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 18 May 2004 21:33:33 +0000 Subject: This commit was generated by cvs2svn to compensate for changes in r1738, which included commits to RCS files with non-trunk default branches. svn path=/trunk/externals/iemlib/; revision=1739 --- src/iemlib1/db2v.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/iemlib1/db2v.c (limited to 'src/iemlib1/db2v.c') diff --git a/src/iemlib1/db2v.c b/src/iemlib1/db2v.c new file mode 100644 index 0000000..bbf1c21 --- /dev/null +++ b/src/iemlib1/db2v.c @@ -0,0 +1,45 @@ +/* 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 - 2003 */ + +#ifdef NT +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif + + +#include "m_pd.h" +#include "iemlib.h" +#include +#include +#include + +/* ---------------- db2v - dB to value converter. ----------------- */ + +static t_class *db2v_class; + +float db2v(float f) +{ + return (f <= -199.9 ? 0 : exp(0.11512925465 * f)); +} + +static void db2v_float(t_object *x, t_float f) +{ + outlet_float(x->ob_outlet, db2v(f)); +} + +static void *db2v_new(void) +{ + t_object *x = (t_object *)pd_new(db2v_class); + outlet_new(x, &s_float); + return (x); +} + +void db2v_setup(void) +{ + db2v_class = class_new(gensym("db2v"), db2v_new, 0, + sizeof(t_object), 0, 0); + class_addfloat(db2v_class, (t_method)db2v_float); + class_sethelpsymbol(db2v_class, gensym("iemhelp/help-db2v")); +} -- cgit v1.2.1