shithub: leaf

Download patch

ref: ef64cc0ce4d535dbb14178d069d459f91fbc4301
parent: f2d7e1ab7e4306a34c2fc3804b1f8ef2901314ec
author: Matthew Wang <mjw7@princeton.edu>
date: Thu Sep 17 14:16:58 EDT 2020

removing unneeded tBuffer init args

--- a/leaf/Inc/leaf-sampling.h
+++ b/leaf/Inc/leaf-sampling.h
@@ -132,7 +132,7 @@
     typedef _tBuffer* tBuffer;
     
     void  tBuffer_init                  (tBuffer* const, uint32_t length, LEAF* const leaf);
-    void  tBuffer_initToPool 			(tBuffer* const sb, uint32_t length, tMempool* const mp, LEAF* const leaf);
+    void  tBuffer_initToPool 			(tBuffer* const sb, uint32_t length, tMempool* const mp);
     void  tBuffer_free                  (tBuffer* const);
     
     void  tBuffer_tick                  (tBuffer* const, float sample);
--- a/leaf/Src/leaf-sampling.c
+++ b/leaf/Src/leaf-sampling.c
@@ -26,10 +26,10 @@
 
 void  tBuffer_init (tBuffer* const sb, uint32_t length, LEAF* const leaf)
 {
-    tBuffer_initToPool(sb, length, &leaf->mempool, leaf);
+    tBuffer_initToPool(sb, length, &leaf->mempool);
 }
 
-void  tBuffer_initToPool (tBuffer* const sb, uint32_t length, tMempool* const mp, LEAF* const leaf)
+void  tBuffer_initToPool (tBuffer* const sb, uint32_t length, tMempool* const mp)
 {
     _tMempool* m = *mp;
     _tBuffer* s = *sb = (_tBuffer*) mpool_alloc(sizeof(_tBuffer), m);
@@ -36,7 +36,7 @@
     s->mempool = m;
     
     s->buff = (float*) mpool_alloc( sizeof(float) * length, m);
-    s->sampleRate = leaf->sampleRate;
+    s->sampleRate = s->mempool->leaf->sampleRate;
     s->channels = 1;
     s->bufferLength = length;
     s->recordedLength = 0;
@@ -273,7 +273,6 @@
 float tSampler_tick        (tSampler* const sp)
 {
     _tSampler* p = *sp;
-    LEAF* leaf = p->mempool->leaf;
     
     attemptStartEndChange(sp);
     
@@ -538,7 +537,6 @@
 float tSampler_tickStereo        (tSampler* const sp, float* outputArray)
 {
     _tSampler* p = *sp;
-    LEAF* leaf = p->mempool->leaf;
 
     attemptStartEndChange(sp);