aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2005-12-08 05:24:58 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2005-12-08 05:24:58 +0000
commited5f9b5db036f8bf420b38d674c9b3b1822b3b7b (patch)
treeb287269dec9a86175f1059cfb562754855e7f6af
parent9b2014ed31750d9573d70d998cb3a3c3c4803b42 (diff)
converted things to fit in with the namespace
svn path=/trunk/externals/markex/; revision=4167
-rw-r--r--README23
-rw-r--r--abs~.c52
-rw-r--r--average-help.pd (renamed from gem_average-help.pd)0
-rw-r--r--average.c85
-rw-r--r--change-help.pd (renamed from gem_change-help.pd)0
-rw-r--r--change.c48
-rw-r--r--counter-help.pd (renamed from gem_counter-help.pd)0
-rw-r--r--counter.c (renamed from gem_counter.c)62
-rw-r--r--gem_average.c85
-rw-r--r--gem_change.c48
-rw-r--r--reson~.c156
11 files changed, 372 insertions, 187 deletions
diff --git a/README b/README
index f72e23b..a8ee8fb 100644
--- a/README
+++ b/README
@@ -8,26 +8,3 @@ What is here is the entire contents of Gem/src/MarkEx except [hsv2rsb] and
the vector lib. Hopefully they will be removed from Gem once they become a
proper part of this repository.
-
-------------------------------
- CONFLICTS
-------------------------------
-
-These objects have name conflicts with other objects/libs therefore:
-
-Name Conflicts with
------------------------------------
-[average] (maxlib)
-[counter] (cxc,cyclone)
-[change] (pd)
-
-Since these names have all been taken, these objects have been renamed by
-adding "gem_" before the original name.
-
-
-------------------------------
- OMISSIONS
-------------------------------
-
-[reson~] has been left out since it is now part of cxc.
-[abs~] has been left out since its now part of creb.
diff --git a/abs~.c b/abs~.c
new file mode 100644
index 0000000..3078139
--- /dev/null
+++ b/abs~.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 1997-1999 Mark Danks.
+ * For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+ */
+
+#include "m_pd.h"
+#include <math.h>
+
+/* ------------------------- abs~ -------------------------- */
+static t_class *abs_class;
+
+typedef struct _abs
+{
+ t_object x_obj;
+} t_abs;
+
+static t_int *abs_perform(t_int *w)
+{
+ //t_abs *x = (t_abs *)(w[1]);
+ t_float *in = (t_float *)(w[2]);
+ t_float *out = (t_float *)(w[3]);
+ int n = (int)(w[4]);
+ while (n--)
+ {
+ float f = *in++;
+ if (f < 0) f = -f;
+ *out++ = f;
+ }
+ return (w+5);
+}
+
+static void abs_dsp(t_abs *x, t_signal **sp)
+{
+ dsp_add(abs_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
+}
+
+static void *abs_new()
+{
+ t_abs *x = (t_abs *)pd_new(abs_class);
+ outlet_new(&x->x_obj, &s_signal);
+ return (x);
+}
+
+void abs_tilde_setup(void)
+{
+ abs_class = class_new(gensym("abs~"), (t_newmethod)abs_new, 0,
+ sizeof(t_abs), 0, A_NULL);
+ class_addmethod(abs_class, (t_method)nullfn, &s_signal, A_NULL);
+ class_addmethod(abs_class, (t_method)abs_dsp, gensym("dsp"), A_NULL);
+}
+
diff --git a/gem_average-help.pd b/average-help.pd
index fb923f3..fb923f3 100644
--- a/gem_average-help.pd
+++ b/average-help.pd
diff --git a/average.c b/average.c
new file mode 100644
index 0000000..39ac562
--- /dev/null
+++ b/average.c
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 1997-1999 Mark Danks.
+ * For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+ */
+
+#include "m_pd.h"
+
+/* -------------------------- alternate ------------------------------ */
+
+/* instance structure */
+static t_class *average_class;
+
+typedef struct _average
+{
+ t_object x_obj; /* obligatory object header */
+ int a_total; /* number of numbers to average */
+ int a_whichNum; /* which number are pointing at */
+ float a_numbers[100]; /* numbers to average, 100 maximum */
+ t_outlet *t_out1; /* the outlet */
+} t_average;
+
+void average_bang(t_average *x)
+{
+ float average = 0.0f;
+ int n;
+
+ for (n = 0; n < x->a_total; n++) average = average + x->a_numbers[n];
+ average = average / (float)x->a_total;
+
+ outlet_float(x->t_out1, average);
+}
+
+void average_float(t_average *x, t_floatarg n)
+{
+ if (x->a_whichNum >= x->a_total) x->a_whichNum = 0;
+ x->a_numbers[x->a_whichNum] = n;
+ x->a_whichNum++;
+ average_bang(x);
+}
+
+void average_total(t_average *x, t_floatarg n)
+{
+ x->a_total = (int)n;
+}
+
+void average_reset(t_average *x, t_floatarg newVal)
+{
+ int n;
+ for (n=0; n < 100; n ++) x->a_numbers[n] = newVal;
+}
+
+void average_clear(t_average *x)
+{
+ int n;
+ for ( n = 0; n < 100; n ++) x->a_numbers[n] = 0.0f;
+}
+
+void *average_new(t_floatarg f) /* init vals in struc */
+{
+ t_average *x = (t_average *)pd_new(average_class);
+ x->t_out1 = outlet_new(&x->x_obj, 0);
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl1"));
+ average_clear(x);
+ if (f) x->a_total = (int)f;
+ else x->a_total = 10;
+ x->a_whichNum = 0;
+ return (x);
+}
+
+void average_setup(void)
+{
+ average_class = class_new(gensym("average"), (t_newmethod)average_new, 0,
+ sizeof(t_average), 0, A_DEFFLOAT, 0);
+ class_addbang(average_class, (t_method)average_bang);
+ class_addfloat(average_class, (t_method)average_float);
+ class_addmethod(average_class, (t_method)average_total, gensym("fl1"), A_FLOAT, 0);
+ class_addmethod(average_class, (t_method)average_clear, gensym("clear"), A_NULL);
+ class_addmethod(average_class, (t_method)average_reset, gensym("reset"), A_FLOAT, 0);
+
+ #if PD_MINOR_VERSION < 37
+
+#endif
+}
+
diff --git a/gem_change-help.pd b/change-help.pd
index c02ddd1..c02ddd1 100644
--- a/gem_change-help.pd
+++ b/change-help.pd
diff --git a/change.c b/change.c
new file mode 100644
index 0000000..f42cf37
--- /dev/null
+++ b/change.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1997-1999 Mark Danks.
+ * For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+ */
+
+#include "m_pd.h"
+
+/* -------------------------- change ------------------------------ */
+
+/* instance structure */
+
+static t_class *change_class;
+
+typedef struct _change
+{
+ t_object x_obj; /* obligatory object header */
+ float x_cur;
+ t_outlet *t_out1; /* the outlet */
+} t_change;
+
+static void change_float(t_change *x, t_floatarg n)
+{
+ if (n != x->x_cur)
+ {
+ outlet_float(x->t_out1, n);
+ x->x_cur = n;
+ }
+}
+
+static void *change_new(void) /* init vals in struc */
+{
+ t_change *x = (t_change *)pd_new(change_class);
+ x->x_cur = -1.f;
+ x->t_out1 = outlet_new(&x->x_obj, 0);
+ return(x);
+}
+
+void change_setup(void)
+{
+ change_class = class_new(gensym("change"), (t_newmethod)change_new, 0,
+ sizeof(t_change), 0, A_NULL);
+ class_addfloat(change_class, change_float);
+
+ #if PD_MINOR_VERSION < 37
+
+#endif
+}
diff --git a/gem_counter-help.pd b/counter-help.pd
index 84f276e..84f276e 100644
--- a/gem_counter-help.pd
+++ b/counter-help.pd
diff --git a/gem_counter.c b/counter.c
index c3c8236..6bbc81a 100644
--- a/gem_counter.c
+++ b/counter.c
@@ -6,24 +6,24 @@
#include "m_pd.h"
-/* -------------------------- gem_counter ------------------------------ */
+/* -------------------------- counter ------------------------------ */
/* instance structure */
-static t_class *gem_counter_class;
+static t_class *counter_class;
-typedef struct _gem_counter
+typedef struct _counter
{
t_object x_obj; /* obligatory object header */
int c_current; /* current number */
int c_high; /* highest number */
int c_low; /* lowest number */
int c_updown; /* 0 = going up, 1 = going down */
- int c_dir; /* gem_counter dir. 1=up, 2=down, 3=up/down */
+ int c_dir; /* counter dir. 1=up, 2=down, 3=up/down */
t_outlet *t_out1; /* the outlet */
t_outlet *t_out2; /* the outlet */
-} t_gem_counter;
+} t_counter;
-void gem_counter_bang(t_gem_counter *x)
+void counter_bang(t_counter *x)
{
int sendBang = 0;
switch(x->c_dir)
@@ -93,23 +93,23 @@ void gem_counter_bang(t_gem_counter *x)
outlet_bang(x->t_out2);
}
-void gem_counter_dir(t_gem_counter *x, t_floatarg n)
+void counter_dir(t_counter *x, t_floatarg n)
{
if (n == 1 || n == 2 || n == 3) x->c_dir = (int)n;
else error("bad dir");
}
-void gem_counter_high(t_gem_counter *x, t_floatarg n)
+void counter_high(t_counter *x, t_floatarg n)
{
x->c_high = (int)n;
}
-void gem_counter_low(t_gem_counter *x, t_floatarg n)
+void counter_low(t_counter *x, t_floatarg n)
{
x->c_low = (int)n;
}
-void gem_counter_reset(t_gem_counter *x, t_symbol *s, int argc, t_atom *argv)
+void counter_reset(t_counter *x, t_symbol *s, int argc, t_atom *argv)
{
if (!argc)
{
@@ -137,14 +137,14 @@ void gem_counter_reset(t_gem_counter *x, t_symbol *s, int argc, t_atom *argv)
x->c_current = (int)argv[0].a_w.w_float;
break;
default :
- error ("gem_counter: reset not float");
+ error ("counter: reset not float");
break;
}
}
outlet_float(x->t_out1, (float)x->c_current);
}
-void gem_counter_clear(t_gem_counter *x, t_symbol *s, int argc, t_atom *argv)
+void counter_clear(t_counter *x, t_symbol *s, int argc, t_atom *argv)
{
if (!argc)
{
@@ -172,15 +172,15 @@ void gem_counter_clear(t_gem_counter *x, t_symbol *s, int argc, t_atom *argv)
x->c_current = (int)argv[0].a_w.w_float - 1;
break;
default :
- error ("gem_counter: reset not float");
+ error ("counter: reset not float");
break;
}
}
}
-void *gem_counter_new(t_floatarg f, t_floatarg g, t_floatarg h) /* init vals in struc */
+void *counter_new(t_floatarg f, t_floatarg g, t_floatarg h) /* init vals in struc */
{
- t_gem_counter *x = (t_gem_counter *)pd_new(gem_counter_class);
+ t_counter *x = (t_counter *)pd_new(counter_class);
x->t_out1 = outlet_new(&x->x_obj, 0);
x->t_out2 = outlet_new(&x->x_obj, 0);
inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl1"));
@@ -190,20 +190,20 @@ void *gem_counter_new(t_floatarg f, t_floatarg g, t_floatarg h) /* init vals in
x->c_updown = 0;
if (h)
{
- gem_counter_low(x, f);
- gem_counter_high(x, g);
- gem_counter_dir(x, h);
+ counter_low(x, f);
+ counter_high(x, g);
+ counter_dir(x, h);
}
else if (g)
{
x->c_dir = 1;
- gem_counter_low(x, f);
- gem_counter_high(x, g);
+ counter_low(x, f);
+ counter_high(x, g);
}
else if (f)
{
x->c_dir = x->c_low = 1;
- gem_counter_high(x, f);
+ counter_high(x, f);
}
else
{
@@ -213,18 +213,18 @@ void *gem_counter_new(t_floatarg f, t_floatarg g, t_floatarg h) /* init vals in
return (x);
}
-void gem_counter_setup(void)
+void counter_setup(void)
{
- gem_counter_class = class_new(gensym("gem_counter"), (t_newmethod)gem_counter_new, 0,
- sizeof(t_gem_counter), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addbang(gem_counter_class, (t_method)gem_counter_bang);
- class_addmethod(gem_counter_class, (t_method)gem_counter_dir, gensym("fl1"), A_FLOAT, 0);
- class_addmethod(gem_counter_class, (t_method)gem_counter_low, gensym("fl2"), A_FLOAT, 0);
- class_addmethod(gem_counter_class, (t_method)gem_counter_high, gensym("fl3"), A_FLOAT, 0);
- class_addmethod(gem_counter_class, (t_method)gem_counter_reset, gensym("reset"), A_GIMME, 0);
- class_addmethod(gem_counter_class, (t_method)gem_counter_clear, gensym("clear"), A_GIMME, 0);
+ counter_class = class_new(gensym("counter"), (t_newmethod)counter_new, 0,
+ sizeof(t_counter), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addbang(counter_class, (t_method)counter_bang);
+ class_addmethod(counter_class, (t_method)counter_dir, gensym("fl1"), A_FLOAT, 0);
+ class_addmethod(counter_class, (t_method)counter_low, gensym("fl2"), A_FLOAT, 0);
+ class_addmethod(counter_class, (t_method)counter_high, gensym("fl3"), A_FLOAT, 0);
+ class_addmethod(counter_class, (t_method)counter_reset, gensym("reset"), A_GIMME, 0);
+ class_addmethod(counter_class, (t_method)counter_clear, gensym("clear"), A_GIMME, 0);
#if PD_MINOR_VERSION < 37
- class_sethelpsymbol(gem_counter_class, gensym("gem_counter-help.pd"));
+
#endif
}
diff --git a/gem_average.c b/gem_average.c
deleted file mode 100644
index 1a82dcc..0000000
--- a/gem_average.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 1997-1999 Mark Danks.
- * For information on usage and redistribution, and for a DISCLAIMER OF ALL
- * WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
- */
-
-#include "m_pd.h"
-
-/* -------------------------- alternate ------------------------------ */
-
-/* instance structure */
-static t_class *gem_average_class;
-
-typedef struct _gem_average
-{
- t_object x_obj; /* obligatory object header */
- int a_total; /* number of numbers to gem_average */
- int a_whichNum; /* which number are pointing at */
- float a_numbers[100]; /* numbers to gem_average, 100 maximum */
- t_outlet *t_out1; /* the outlet */
-} t_gem_average;
-
-void gem_average_bang(t_gem_average *x)
-{
- float gem_average = 0.0f;
- int n;
-
- for (n = 0; n < x->a_total; n++) gem_average = gem_average + x->a_numbers[n];
- gem_average = gem_average / (float)x->a_total;
-
- outlet_float(x->t_out1, gem_average);
-}
-
-void gem_average_float(t_gem_average *x, t_floatarg n)
-{
- if (x->a_whichNum >= x->a_total) x->a_whichNum = 0;
- x->a_numbers[x->a_whichNum] = n;
- x->a_whichNum++;
- gem_average_bang(x);
-}
-
-void gem_average_total(t_gem_average *x, t_floatarg n)
-{
- x->a_total = (int)n;
-}
-
-void gem_average_reset(t_gem_average *x, t_floatarg newVal)
-{
- int n;
- for (n=0; n < 100; n ++) x->a_numbers[n] = newVal;
-}
-
-void gem_average_clear(t_gem_average *x)
-{
- int n;
- for ( n = 0; n < 100; n ++) x->a_numbers[n] = 0.0f;
-}
-
-void *gem_average_new(t_floatarg f) /* init vals in struc */
-{
- t_gem_average *x = (t_gem_average *)pd_new(gem_average_class);
- x->t_out1 = outlet_new(&x->x_obj, 0);
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl1"));
- gem_average_clear(x);
- if (f) x->a_total = (int)f;
- else x->a_total = 10;
- x->a_whichNum = 0;
- return (x);
-}
-
-void gem_average_setup(void)
-{
- gem_average_class = class_new(gensym("gem_average"), (t_newmethod)gem_average_new, 0,
- sizeof(t_gem_average), 0, A_DEFFLOAT, 0);
- class_addbang(gem_average_class, (t_method)gem_average_bang);
- class_addfloat(gem_average_class, (t_method)gem_average_float);
- class_addmethod(gem_average_class, (t_method)gem_average_total, gensym("fl1"), A_FLOAT, 0);
- class_addmethod(gem_average_class, (t_method)gem_average_clear, gensym("clear"), A_NULL);
- class_addmethod(gem_average_class, (t_method)gem_average_reset, gensym("reset"), A_FLOAT, 0);
-
- #if PD_MINOR_VERSION < 37
- class_sethelpsymbol(gem_average_class, gensym("gem_average-help.pd"));
-#endif
-}
-
diff --git a/gem_change.c b/gem_change.c
deleted file mode 100644
index dc714ec..0000000
--- a/gem_change.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1997-1999 Mark Danks.
- * For information on usage and redistribution, and for a DISCLAIMER OF ALL
- * WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
- */
-
-#include "m_pd.h"
-
-/* -------------------------- gem_change ------------------------------ */
-
-/* instance structure */
-
-static t_class *gem_change_class;
-
-typedef struct _gem_change
-{
- t_object x_obj; /* obligatory object header */
- float x_cur;
- t_outlet *t_out1; /* the outlet */
-} t_gem_change;
-
-static void gem_change_float(t_gem_change *x, t_floatarg n)
-{
- if (n != x->x_cur)
- {
- outlet_float(x->t_out1, n);
- x->x_cur = n;
- }
-}
-
-static void *gem_change_new(void) /* init vals in struc */
-{
- t_gem_change *x = (t_gem_change *)pd_new(gem_change_class);
- x->x_cur = -1.f;
- x->t_out1 = outlet_new(&x->x_obj, 0);
- return(x);
-}
-
-void gem_change_setup(void)
-{
- gem_change_class = class_new(gensym("gem_change"), (t_newmethod)gem_change_new, 0,
- sizeof(t_gem_change), 0, A_NULL);
- class_addfloat(gem_change_class, gem_change_float);
-
- #if PD_MINOR_VERSION < 37
- class_sethelpsymbol(gem_change_class, gensym("gem_change-help.pd"));
-#endif
-}
diff --git a/reson~.c b/reson~.c
new file mode 100644
index 0000000..26aa245
--- /dev/null
+++ b/reson~.c
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 1997-1999 Mark Danks.
+ * For information on usage and redistribution, and for a DISCLAIMER OF ALL
+ * WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
+ */
+
+/* Original code by Miller Puckette */
+/* a non-interpolating reson filter, not very carefully coded... */
+/* 11/29/94 modified to do interpolation - M. Danks */
+
+#include "m_pd.h"
+
+#include <stdlib.h>
+
+#define BUFSIZE 4096
+
+typedef struct resonctl
+{
+ float c_freq;
+ float c_samprate;
+ float c_feedback;
+ int c_delayinsamps;
+ float c_fraction;
+ int c_phase;
+ float *c_buf;
+} t_resonctl;
+
+typedef struct sigreson
+{
+ t_object x_obj; /* header */
+ t_resonctl *x_ctl; /* pointer to state */
+ t_resonctl x_cspace; /* garage for state when not in a chain */
+} t_sigreson;
+
+/* the DSP routine -- called for every n samples of input */
+static t_int *cu_reson(t_int *w)
+{
+ t_float *in1 = (t_float *)(w[1]);
+ t_float *in2 = (t_float *)(w[2]);
+ t_float *out = (t_float *)(w[3]);
+ t_resonctl *x = (t_resonctl *)(w[4]);
+ int n = (int)(w[5]);
+ long i;
+ int writephase = x->c_phase;
+ for (i = 0; i < n; i++)
+ {
+ /* note two tricks: 1. input is read before output
+ * is written, because the routine might be called
+ * in-place;
+ * 2 - a seed of 1E-20 is thrown in to avoid floating
+ * underflow which slows the calculation down.
+ */
+ int readphase, phase, delayinsamps;
+ float fraction, f, g, freq, freqtemp;
+
+ float ftemp;
+
+ freq = *in2++;
+ freqtemp = (freq < 1 ? 1 : freq);
+
+ ftemp = x->c_samprate/freqtemp;
+ if (ftemp >= BUFSIZE-1)
+ ftemp = BUFSIZE - 1.f;
+ else if (ftemp < 1.0)
+ ftemp = 1.f;
+ delayinsamps = (int)ftemp;
+ fraction = ftemp - delayinsamps;
+
+ readphase = writephase - delayinsamps;
+ phase = readphase & (BUFSIZE-1);
+ f = x->c_buf[phase] + fraction *
+ (x->c_buf[(phase-1)& (BUFSIZE-1)] - x->c_buf[phase]);
+ g = *in1++;
+ *out++ = x->c_buf[(writephase++) & (BUFSIZE-1)] =
+ g + x->c_feedback * f + 1E-20f;
+ }
+ x->c_phase = writephase & (BUFSIZE-1);
+ return (w+6);
+}
+
+/* sets the reson frequency */
+
+void sigreson_float(t_sigreson *x, t_floatarg f)
+{
+ float ftemp;
+
+ x->x_ctl->c_freq = (f < 1 ? 1 : f);
+
+ ftemp = x->x_ctl->c_samprate/x->x_ctl->c_freq;
+ if (ftemp >= BUFSIZE - 1)
+ ftemp = BUFSIZE - 1.f;
+ else if (ftemp < 1.0)
+ ftemp = 1.f;
+ x->x_ctl->c_delayinsamps = (int)ftemp;
+ x->x_ctl->c_fraction = ftemp - x->x_ctl->c_delayinsamps;
+}
+
+/* routine which FTS calls to put you on the DSP chain or take you off. */
+
+static void sigreson_dsp(t_sigreson *x, t_signal **sp)
+{
+ x->x_ctl->c_samprate = sp[0]->s_sr;
+ sigreson_float(x, x->x_ctl->c_freq);
+ dsp_add(cu_reson, 5, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec,
+ x->x_ctl, sp[0]->s_n);
+}
+
+static void sigreson_ft1(t_sigreson *x, t_floatarg f) /* sets feedback */
+{
+ if (f > .99999) f = .99999f;
+ else if (f < -.99999) f = -.99999f;
+ x->x_ctl->c_feedback = (float)f;
+}
+
+static void sigreson_ff(t_sigreson *x) /* cleanup on free */
+{
+ free(x->x_ctl->c_buf);
+}
+
+static t_class *sigreson_class;
+
+void *sigreson_new(t_floatarg f, t_floatarg g)
+{
+ t_sigreson *x = (t_sigreson *)pd_new(sigreson_class);
+ outlet_new(&x->x_obj, &s_signal);
+
+ /* things in "cspace" are things you'll actually use at DSP time */
+ x->x_cspace.c_phase = 0;
+ if (!(x->x_cspace.c_buf = (float *)malloc(BUFSIZE * sizeof(float))))
+ {
+ error("buffer alloc failed");
+ return (0);
+ }
+ x->x_cspace.c_samprate = 44100.f; /* just a plausible default */
+
+ /* control block is in the garage at startup */
+ x->x_ctl = &x->x_cspace;
+ sigreson_float(x, (t_float)f); /* setup params */
+ sigreson_ft1(x, g);
+ /* make a "float" inlet */
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("ft1"));
+ return (x);
+}
+
+void reson_tilde_setup()
+{
+ sigreson_class = class_new(gensym("reson~"), (t_newmethod)sigreson_new,
+ (t_method)sigreson_ff, sizeof(t_sigreson), 0,
+ A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addfloat(sigreson_class, (t_method)sigreson_float);
+ class_addmethod(sigreson_class, (t_method)sigreson_ft1, gensym("ft1"), A_FLOAT, 0);
+ class_addmethod(sigreson_class, (t_method)nullfn, &s_signal, A_NULL);
+ class_addmethod(sigreson_class, (t_method)sigreson_dsp, gensym("dsp"), A_NULL);
+}
+