ref: 70285956de156f146984f42c8ffa42401d42edd7
parent: 4717f3fcc1523ee0e7e7b85273d6c5dd5bf192a3
author: Paul Batchelor <thisispaulbatchelor@gmail.com>
date: Sat Oct 3 12:27:50 EDT 2020
removed auxmem from reverse
--- a/h/reverse.h
+++ b/h/reverse.h
@@ -2,7 +2,7 @@
SPFLOAT delay;
uint32_t bufpos;
uint32_t bufsize;
- sp_auxdata buf;
+ SPFLOAT *buf;
} sp_reverse;
int sp_reverse_create(sp_reverse **p);
--- a/modules/reverse.c
+++ b/modules/reverse.c
@@ -12,8 +12,7 @@
int sp_reverse_destroy(sp_reverse **p)
{
- sp_reverse *pp = *p;
- sp_auxdata_free(&pp->buf);
+ free((*p)->buf);
free(*p);
return SP_OK;
}
@@ -22,14 +21,14 @@
{
size_t size = delay * sp->sr * sizeof(SPFLOAT) * 2;
p->bufpos = 0;
- sp_auxdata_alloc(&p->buf, size);
- p->bufsize = (uint32_t)p->buf.size / sizeof(SPFLOAT);
+ p->buf = calloc(1, size);
+ p->bufsize = (uint32_t)size / sizeof(SPFLOAT);
return SP_OK;
}
int sp_reverse_compute(sp_data *sp, sp_reverse *p, SPFLOAT *in, SPFLOAT *out)
{
- SPFLOAT *buf = (SPFLOAT *)p->buf.ptr;
+ SPFLOAT *buf = p->buf;
*out = buf[p->bufpos];
buf[(p->bufsize - 1) - p->bufpos] = *in;
p->bufpos = (p->bufpos + 1) % p->bufsize;