aboutsummaryrefslogtreecommitdiff
path: root/src/unpack~.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/unpack~.c
parent6d61e2a46722b75c1a3734e3419ee2886b11b2b3 (diff)
use t_float and t_sample when possible
svn path=/trunk/externals/zexy/; revision=8907
Diffstat (limited to 'src/unpack~.c')
-rw-r--r--src/unpack~.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/src/unpack~.c b/src/unpack~.c
index 6e54a7d..c27f5f4 100644
--- a/src/unpack~.c
+++ b/src/unpack~.c
@@ -29,8 +29,8 @@ static t_class *sigunpack_class;
typedef struct _sigunpack
{
t_object x_obj;
- t_float *buffer;
- t_float *rp, *wp;
+ t_sample *buffer;
+ t_sample *rp, *wp;
int bufsize;
} t_sigunpack;
@@ -47,26 +47,22 @@ static void sigunpack_list(t_sigunpack *x, t_symbol *s, int argc, t_atom *argv)
{
t_atom *ap = argv;
int i;
- ZEXY_USEVAR(s);
-
for (i = 0, ap = argv; i < argc; ap++, i++) {
- // if (ap->a_type == A_FLOAT) {
- if (x->wp + 1 != x->rp) {
- *(x->wp)++ = atom_getfloat(ap);
- if (x->wp == x->buffer + x->bufsize) x->wp = x->buffer;
- }
- // }
+ if (x->wp + 1 != x->rp) {
+ *(x->wp)++ = atom_getfloat(ap);
+ if (x->wp == x->buffer + x->bufsize) x->wp = x->buffer;
+ }
}
}
static t_int *sigunpack_perform(t_int *w)
{
- t_float *out = (t_float *)(w[1]);
+ t_sample *out = (t_sample *)(w[1]);
t_sigunpack *x = (t_sigunpack *)w[2];
int n = (int)(w[3]);
- t_float *buf = x->rp;
+ t_sample *buf = x->rp;
int hitchhike = 0;
if ((x->wp >= x->rp) && (x->wp < x->rp+n)) hitchhike=1;
@@ -86,8 +82,8 @@ static void sigunpack_dsp(t_sigunpack *x, t_signal **sp)
{
if (x->bufsize % sp[0]->s_n) {
int newsize = sp[0]->s_n*(1+(int)(x->bufsize/sp[0]->s_n));
- freebytes(x->buffer, x->bufsize * sizeof(t_float));
- x->buffer = (t_float *)getbytes(newsize * sizeof(t_float));
+ freebytes(x->buffer, x->bufsize * sizeof(*x->buffer));
+ x->buffer = (t_sample *)getbytes(newsize * sizeof(*x->buffer));
x->rp = x->wp = x->buffer;
x->bufsize = newsize;
@@ -105,7 +101,7 @@ static void *sigunpack_new(t_floatarg f)
if (!suggestedsize) bufsize = 64;
else bufsize = (suggestedsize % 64)?(64*(1+(int)(suggestedsize/64))):suggestedsize;
- x->buffer = (t_float *)getbytes(bufsize * sizeof(t_float));
+ x->buffer = (t_sample *)getbytes(bufsize * sizeof(*x->buffer));
x->bufsize = bufsize;
x->rp = x->wp = x->buffer;
@@ -122,7 +118,7 @@ static void sigunpack_help(void)
void unpack_tilde_setup(void)
{
sigunpack_class = class_new(gensym("unpack~"), (t_newmethod)sigunpack_new, 0,
- sizeof(t_sigunpack), 0, A_DEFFLOAT, 0);
+ sizeof(t_sigunpack), 0, A_DEFFLOAT, 0);
class_addmethod(sigunpack_class, (t_method)sigunpack_dsp, gensym("dsp"), 0);
class_addfloat(sigunpack_class, (t_method)sigunpack_float);
class_addlist (sigunpack_class, (t_method)sigunpack_list);