aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/blockmirror~.c14
-rw-r--r--src/blockshuffle~.c9
-rw-r--r--src/blockswap~.c10
3 files changed, 23 insertions, 10 deletions
diff --git a/src/blockmirror~.c b/src/blockmirror~.c
index 1dd3659..37e8cf3 100644
--- a/src/blockmirror~.c
+++ b/src/blockmirror~.c
@@ -72,14 +72,19 @@ static void blockmirror_dsp(t_blockmirror *x, t_signal **sp)
dsp_add(blockmirror_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
}
-static void blockmirror_helper(void)
+static void blockmirror_helper(t_blockmirror*x)
{
post("\n%c blockmirror~-object for reverting a signal", HEARTSYMBOL);
post("'help' : view this\n"
"signal~");
post("outlet : signal~");
}
-
+static void blockmirror_free(t_blockmirror*x)
+{
+ if(x->blockbuffer)
+ freebytes(x->blockbuffer, sizeof(t_float)*x->blocksize);
+ x->blockbuffer=0;
+}
static void *blockmirror_new(void)
{
t_blockmirror *x = (t_blockmirror *)pd_new(blockmirror_class);
@@ -91,8 +96,9 @@ static void *blockmirror_new(void)
void blockmirror_tilde_setup(void)
{
- blockmirror_class = class_new(gensym("blockmirror~"), (t_newmethod)blockmirror_new, 0,
- sizeof(t_blockmirror), 0, A_NULL);
+ blockmirror_class = class_new(gensym("blockmirror~"), (t_newmethod)blockmirror_new,
+ (t_method)blockmirror_free,
+ sizeof(t_blockmirror), 0, A_NULL);
class_addmethod(blockmirror_class, nullfn, gensym("signal"), 0);
class_addmethod(blockmirror_class, (t_method)blockmirror_dsp, gensym("dsp"), 0);
diff --git a/src/blockshuffle~.c b/src/blockshuffle~.c
index 772c792..853ec64 100644
--- a/src/blockshuffle~.c
+++ b/src/blockshuffle~.c
@@ -29,8 +29,7 @@
static t_class *blockshuffle_class;
typedef struct _blockshuffle
-{
- t_object x_obj;
+{ t_object x_obj;
t_sample*blockbuf;
t_int* indices;
@@ -115,9 +114,9 @@ static void blockshuffle_helper(void)
post("outlet : signal~");
}
static void blockshuffle_free(t_blockshuffle *x){
- if(x->indices)freebytes(x->indices, x->size);
- if(x->blockbuf)freebytes(x->blockbuf, x->size);
- if(x->shuffle)freebytes(x->shuffle, x->shufflesize);
+ if(x->indices) freebytes(x->indices, sizeof(t_int) *x->size);
+ if(x->blockbuf)freebytes(x->blockbuf, sizeof(t_sample)*x->size);
+ if(x->shuffle) freebytes(x->shuffle, sizeof(t_float) *x->shufflesize);
}
static void *blockshuffle_new(void)
diff --git a/src/blockswap~.c b/src/blockswap~.c
index 7dbe99d..625cdf6 100644
--- a/src/blockswap~.c
+++ b/src/blockswap~.c
@@ -67,7 +67,7 @@ static void blockswap_dsp(t_blockswap *x, t_signal **sp)
dsp_add(blockswap_perform, 4, x, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n);
}
-static void blockswap_helper(void)
+static void blockswap_helper(t_blockswap *x)
{
post("\n%c blockswap~-object for blockwise-swapping of a signal ", HEARTSYMBOL);
post("'help' : view this\n"
@@ -75,6 +75,14 @@ static void blockswap_helper(void)
post("outlet : signal~");
}
+static void blockswap_free(t_blockswap *x)
+{
+ if(x->blockbuffer){
+ freebytes(x->blockbuffer, sizeof(t_float)*x->blocksize);
+ }
+ x->blockbuffer=0;
+}
+
static void *blockswap_new(void)
{
t_blockswap *x = (t_blockswap *)pd_new(blockswap_class);