1
/******************************************************
3
* zexy - implementation file
5
* copyleft (c) IOhannes m zm�lnig
7
* 1999:forum::f�r::uml�ute:2004
9
* institute of electronic music and acoustics (iem)
11
******************************************************
13
* license: GNU General Public License v.2
15
******************************************************/
20
/* ------------------------ pack~ ----------------------------- */
21
/* pack the signal-vector to a float-package */
23
static t_class *sigpack_class;
25
typedef struct _sigpack
35
static void sigpack_tick(t_sigpack*x)
37
outlet_list(x->x_obj.ob_outlet, &s_list, x->vector_length, x->buffer);
40
static t_int *sigpack_perform(t_int *w)
42
t_sample *in = (t_sample *)(w[1]);
43
t_sigpack *x = (t_sigpack *)w[2];
44
int n = (int)(w[3]), i = 0;
45
t_atom *buf = x->buffer;
52
if(x->x_outputindsp) {
55
clock_delay(x->x_clock, 0);
61
static void sigpack_dsp(t_sigpack *x, t_signal **sp)
63
if (x->vector_length != sp[0]->s_n) {
64
freebytes(x->buffer, x->vector_length * sizeof(t_atom));
65
x->vector_length = sp[0]->s_n;
66
x->buffer = (t_atom *)getbytes(x->vector_length * sizeof(t_atom));
68
dsp_add(sigpack_perform, 3, sp[0]->s_vec, x, sp[0]->s_n);
71
static void sigpack_free(t_sigpack*x)
73
clock_free(x->x_clock);
76
static void *sigpack_new(void)
78
t_sigpack *x = (t_sigpack *)pd_new(sigpack_class);
81
outlet_new(&x->x_obj, gensym("list"));
82
x->x_clock=clock_new(x, (t_method)sigpack_tick);
89
static void sigpack_help(void)
91
post("pack~\t:: outputs the signal-vectors as float-packages");
94
void pack_tilde_setup(void)
96
sigpack_class = class_new(gensym("pack~"), (t_newmethod)sigpack_new, (t_method)sigpack_free,
97
sizeof(t_sigpack), 0, A_DEFFLOAT, 0);
98
class_addmethod(sigpack_class, nullfn, gensym("signal"), 0);
99
class_addmethod(sigpack_class, (t_method)sigpack_dsp, gensym("dsp"), 0);
101
class_addmethod(sigpack_class, (t_method)sigpack_help, gensym("help"), 0);
103
zexy_register("pack~");