From 05a9e3254454715e09b78f7a7ab788b02b2cbe60 Mon Sep 17 00:00:00 2001 From: musil Date: Fri, 8 Dec 2006 07:47:49 +0000 Subject: makefile help repaired spec2_sqrt~ svn path=/trunk/externals/iem/iem_spec2/; revision=6724 --- src/spec2_sqrt~.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 src/spec2_sqrt~.c (limited to 'src/spec2_sqrt~.c') diff --git a/src/spec2_sqrt~.c b/src/spec2_sqrt~.c new file mode 100644 index 0000000..2701eec --- /dev/null +++ b/src/spec2_sqrt~.c @@ -0,0 +1,93 @@ +/* For information on usage and redistribution, and for a DISCLAIMER OF ALL +* WARRANTIES, see the file, "LICENSE.txt," in this distribution. + +iem_spec2 written by Thomas Musil, Copyright (c) IEM KUG Graz Austria 2000 - 2006 */ + +#include "m_pd.h" +#include "iemlib.h" +#include + +/* ------------------------ spec2_sqrt_tilde~ ------------------------- */ + +static t_class *spec2_sqrt_tilde_class; + +#define SPEC2DUMTAB1SIZE 256 +#define SPEC2DUMTAB2SIZE 1024 + +static t_float spec2_rsqrt_exptab[SPEC2DUMTAB1SIZE], spec2_rsqrt_mantissatab[SPEC2DUMTAB2SIZE]; + +static void init_spec2_rsqrt(void) +{ + int i; + + for (i=0; i> 23) & 0xff] * spec2_rsqrt_mantissatab[(l >> 13) & 0x3ff]; + + *out++ = f*g*(1.5f - 0.5f*g*g*f); + } + } + return(w+4); +} + +static void spec2_sqrt_tilde_dsp(t_spec2_sqrt_tilde *x, t_signal **sp) +{ + int n = (sp[0]->s_n)/2; + + dsp_add(spec2_sqrt_tilde_perform, 3, sp[0]->s_vec, sp[0]->s_vec, n); +} + +static void *spec2_sqrt_tilde_new(void) +{ + t_spec2_sqrt_tilde *x = (t_spec2_sqrt_tilde *)pd_new(spec2_sqrt_tilde_class); + + outlet_new(&x->x_obj, &s_signal); + x->x_msi = 0.0f; + return (x); +} + +void spec2_sqrt_tilde_setup(void) +{ + init_spec2_rsqrt(); + spec2_sqrt_tilde_class = class_new(gensym("spec2_sqrt~"), (t_newmethod)spec2_sqrt_tilde_new, + 0, sizeof(t_spec2_sqrt_tilde), 0, 0); + CLASS_MAINSIGNALIN(spec2_sqrt_tilde_class, t_spec2_sqrt_tilde, x_msi); + class_addmethod(spec2_sqrt_tilde_class, (t_method)spec2_sqrt_tilde_dsp, gensym("dsp"), 0); + class_sethelpsymbol(spec2_sqrt_tilde_class, gensym("iemhelp2/spec2_sqrt~-help")); +} -- cgit v1.2.1