aboutsummaryrefslogtreecommitdiff
path: root/src/dirac~.c
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2007-10-30 09:21:52 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2007-10-30 09:21:52 +0000
commit5e869f7a0cef88be3b03272303a6084b8bd1a7e3 (patch)
tree8d5e0dfc39eb696f5b457b3376dd6eb7de17b538 /src/dirac~.c
parent6d61e2a46722b75c1a3734e3419ee2886b11b2b3 (diff)
use t_float and t_sample when possible
svn path=/trunk/externals/zexy/; revision=8907
Diffstat (limited to 'src/dirac~.c')
-rw-r--r--src/dirac~.c124
1 files changed, 62 insertions, 62 deletions
diff --git a/src/dirac~.c b/src/dirac~.c
index b30ab5b..90d9dbb 100644
--- a/src/dirac~.c
+++ b/src/dirac~.c
@@ -38,117 +38,117 @@ static t_class *dirac_class;
typedef struct _dirac
{
- t_object x_obj;
- t_int position;
- t_int do_it;
+ t_object x_obj;
+ t_int position;
+ t_int do_it;
} t_dirac;
static void dirac_bang(t_dirac *x)
{
- x->do_it = x->position;
+ x->do_it = x->position;
}
static void dirac_float(t_dirac *x, t_float where)
{
- x->do_it = x->position = (t_int)where;
+ x->do_it = x->position = (t_int)where;
}
static t_int *dirac_perform(t_int *w)
{
- t_dirac *x = (t_dirac *)(w[1]);
- t_float *out = (t_float *)(w[2]);
- int n = (int)(w[3]);
+ t_dirac *x = (t_dirac *)(w[1]);
+ t_sample *out = (t_sample *)(w[2]);
+ int n = (int)(w[3]);
- t_int do_it = x->do_it;
+ t_int do_it = x->do_it;
- zero_perform(w+1);
+ zero_perform(w+1);
- if (do_it >= n)
- x->do_it -= n;
- else if(do_it >= 0)
- {
- out[do_it] = 1.f;
- x->do_it = -1;
- }
+ if (do_it >= n)
+ x->do_it -= n;
+ else if(do_it >= 0)
+ {
+ out[do_it] = 1.f;
+ x->do_it = -1;
+ }
- return (w+4);
+ return (w+4);
}
static t_int *dirac_perf8(t_int *w)
{
- t_dirac *x = (t_dirac *)(w[1]);
- t_float *out = (t_float *)(w[2]);
- int n = (int)(w[3]);
+ t_dirac *x = (t_dirac *)(w[1]);
+ t_sample *out = (t_sample *)(w[2]);
+ int n = (int)(w[3]);
- t_int do_it = x->do_it;
+ t_int do_it = x->do_it;
#ifndef __WIN32__
- /* LATER: investigate the occurence of zero_perf8() */
- /* it seems, like pd has the symbol zero_perf8(),
- * but it is not exported by m_pd.h:
- * so linux can use it, but w32 not
- * have to tell miller about that
- */
- zero_perf8(w+1);
+ /* LATER: investigate the occurence of zero_perf8() */
+ /* it seems, like pd has the symbol zero_perf8(),
+ * but it is not exported by m_pd.h:
+ * so linux can use it, but w32 not
+ * have to tell miller about that
+ */
+ zero_perf8(w+1);
#else
- zero_perform(w+1);
+ zero_perform(w+1);
#endif
- if (do_it >= n)
- x->do_it -= n;
- else if(do_it >= 0)
- {
- out[do_it] = 1.f;
- x->do_it = -1;
- }
+ if (do_it >= n)
+ x->do_it -= n;
+ else if(do_it >= 0)
+ {
+ out[do_it] = 1.f;
+ x->do_it = -1;
+ }
- return (w+4);
+ return (w+4);
}
static void dirac_dsp(t_dirac *x, t_signal **sp)
{
- if (sp[0]->s_n & 7)
- dsp_add(dirac_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
- else
- dsp_add(dirac_perf8, 3, x, sp[0]->s_vec, sp[0]->s_n);
+ if (sp[0]->s_n & 7)
+ dsp_add(dirac_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
+ else
+ dsp_add(dirac_perf8, 3, x, sp[0]->s_vec, sp[0]->s_n);
}
static void dirac_helper(void)
{
- post("%c dirac~-object :: generates a dirac (unity-pulse)", HEARTSYMBOL);
- post("creation : \"dirac~ [<position>]\" : create a dirac at specified position (in samples)\n"
- "inlet\t: <position>\t: create a dirac at new position\n"
- "\t 'bang'\t: create a dirac at specified position\n"
- "\t 'help'\t: view this\n"
- "outlet\t: signal~");
+ post("%c dirac~-object :: generates a dirac (unity-pulse)", HEARTSYMBOL);
+ post("creation : \"dirac~ [<position>]\" : create a dirac at specified position (in samples)\n"
+ "inlet\t: <position>\t: create a dirac at new position\n"
+ "\t 'bang'\t: create a dirac at specified position\n"
+ "\t 'help'\t: view this\n"
+ "outlet\t: signal~");
}
static void *dirac_new(t_floatarg where)
{
- t_dirac *x = (t_dirac *)pd_new(dirac_class);
+ t_dirac *x = (t_dirac *)pd_new(dirac_class);
- outlet_new(&x->x_obj, gensym("signal"));
+ outlet_new(&x->x_obj, gensym("signal"));
- x->do_it = where;
+ x->do_it = where;
- if (where > 0)
- x->position = where;
- else
- x->position = -where;
- return (x);
+ if (where > 0)
+ x->position = where;
+ else
+ x->position = -where;
+ return (x);
}
void dirac_tilde_setup(void)
{
- dirac_class = class_new(gensym("dirac~"), (t_newmethod)dirac_new, 0,
- sizeof(t_dirac), 0, A_DEFFLOAT, 0);
- class_addfloat(dirac_class, dirac_float);
- class_addbang(dirac_class, dirac_bang);
- class_addmethod(dirac_class, (t_method)dirac_dsp, gensym("dsp"), 0);
+ dirac_class = class_new(gensym("dirac~"), (t_newmethod)dirac_new, 0,
+ sizeof(t_dirac), 0, A_DEFFLOAT, 0);
+ class_addfloat(dirac_class, dirac_float);
+ class_addbang(dirac_class, dirac_bang);
+ class_addmethod(dirac_class, (t_method)dirac_dsp, gensym("dsp"), 0);
- class_addmethod(dirac_class, (t_method)dirac_helper, gensym("help"), 0);
+ class_addmethod(dirac_class, (t_method)dirac_helper, gensym("help"), 0);
zexy_register("dirac~");
}