shithub: soundpipe

Download patch

ref: 49ff67154a0150cade077dcd040d68bc6a200b17
parent: 264e4718c21792ed8ee230d39aa2b9ac88d73b14
author: Paul Batchelor <thisispaulbatchelor@gmail.com>
date: Mon Oct 5 15:43:00 EDT 2020

removed auxdata from sparec

--- a/h/sparec.h
+++ b/h/sparec.h
@@ -3,7 +3,6 @@
     uint32_t pos;
     uint32_t bufsize;
     sp_audio spa;
-    sp_auxdata aux;
 } sp_sparec;
 
 int sp_sparec_create(sp_sparec **p);
--- a/modules/sparec.c
+++ b/modules/sparec.c
@@ -14,7 +14,7 @@
 int sp_sparec_destroy(sp_sparec **p)
 {
     sp_sparec *pp = *p;
-    sp_auxdata_free(&pp->aux);
+    free(pp->buf);
     spa_close(&pp->spa);
     free(*p);
     return SP_OK;
@@ -22,7 +22,7 @@
 
 int sp_sparec_init(sp_data *sp, sp_sparec *p, const char *filename)
 {
-    if(spa_open(sp, &p->spa, filename, SPA_WRITE) != SP_OK) {
+    if (spa_open(sp, &p->spa, filename, SPA_WRITE) != SP_OK) {
         return SP_NOT_OK;
     }
 
@@ -29,15 +29,14 @@
     p->pos = SPA_BUFSIZE;
 
     p->bufsize = SPA_BUFSIZE;
-    sp_auxdata_alloc(&p->aux, sizeof(SPFLOAT) * p->bufsize);
+    p->buf = calloc(1, sizeof(SPFLOAT) * p->bufsize);
 
-    p->buf = p->aux.ptr;
     return SP_OK;
 }
 
 int sp_sparec_compute(sp_data *sp, sp_sparec *p, SPFLOAT *in, SPFLOAT *out)
 {
-    if(p->pos == 0) {
+    if (p->pos == 0) {
         p->pos = p->bufsize;
         spa_write_buf(sp, &p->spa, p->buf, p->bufsize);
     }
@@ -52,7 +51,7 @@
 /* call this to close sparec. will write the rest of the buffer */
 int sp_sparec_close(sp_data *sp, sp_sparec *p)
 {
-    if(p->pos < p->bufsize - 1) {
+    if (p->pos < p->bufsize - 1) {
         spa_write_buf(sp, &p->spa, p->buf, p->bufsize - p->pos);
     }
     return SP_OK;