shithub: soundpipe

Download patch

ref: 4717f3fcc1523ee0e7e7b85273d6c5dd5bf192a3
parent: 42bc0e304eef602cd288728a1dbe0b98694f5681
author: Paul Batchelor <thisispaulbatchelor@gmail.com>
date: Sat Oct 3 12:21:42 EDT 2020

removed auxmem from delay

--- a/h/delay.h
+++ b/h/delay.h
@@ -2,7 +2,7 @@
     SPFLOAT time;
     SPFLOAT feedback;
     SPFLOAT last;
-    sp_auxdata buf;
+    SPFLOAT *buf;
     uint32_t bufsize;
     uint32_t bufpos;
 } sp_delay;
--- a/lib/spa/spa.c
+++ b/lib/spa/spa.c
@@ -1,3 +1,4 @@
+/* This file is placed in the public domain */
 #include <stdio.h>
 #include <stdint.h>
 #include <stdlib.h>
--- a/lib/spa/spa.h
+++ b/lib/spa/spa.h
@@ -1,4 +1,8 @@
+/* This file is placed in the public domain */
+#ifndef SPA_H
+#define SPA_H
 int spa_open(sp_data *sp, sp_audio *spa, const char *name, int mode);
 size_t spa_write_buf(sp_data *sp, sp_audio *spa, SPFLOAT *buf, uint32_t size);
 size_t spa_read_buf(sp_data *sp, sp_audio *spa, SPFLOAT *buf, uint32_t size);
 int spa_close(sp_audio *spa);
+#endif
--- a/modules/delay.c
+++ b/modules/delay.c
@@ -12,8 +12,7 @@
 
 int sp_delay_destroy(sp_delay **p)
 {
-    sp_delay *pp = *p;
-    sp_auxdata_free(&pp->buf);
+    free((*p)->buf);
     free(*p);
     return SP_OK;
 }
@@ -22,7 +21,7 @@
 {
     p->time = time;
     p->bufsize = round(time * sp->sr);
-    sp_auxdata_alloc(&p->buf, p->bufsize * sizeof(SPFLOAT));
+    p->buf = calloc(1, p->bufsize * sizeof(SPFLOAT));
     p->bufpos = 0;
     p->feedback = 0;
     p->last = 0;
@@ -32,7 +31,7 @@
 int sp_delay_compute(sp_data *sp, sp_delay *p, SPFLOAT *in, SPFLOAT *out)
 {
     SPFLOAT delay = 0, sig = 0;
-    SPFLOAT *buf = (SPFLOAT *)p->buf.ptr;
+    SPFLOAT *buf = p->buf;
     delay = buf[p->bufpos];
     sig = (delay * p->feedback) + *in;
     buf[p->bufpos] = sig;