ref: 2724ecf6af39be991d51bb734b05bb3080fa0b0b
parent: 44000f7c080d0ab0702ffb79a3858df84b583370
author: Matthew Wang <mjw7@princeton.edu>
date: Thu Feb 27 11:09:37 EST 2020
minor
--- a/LEAF/Src/leaf-sampling.c
+++ b/LEAF/Src/leaf-sampling.c
@@ -26,23 +26,12 @@
void tBuffer_init (tBuffer* const sb, uint32_t length)
{
- _tBuffer* s = *sb = (_tBuffer*) leaf_alloc(sizeof(_tBuffer));
-
- s->buff = (float*) leaf_alloc( sizeof(float) * length);
-
- s->bufferLength = length;
- s->recordedLength = 0;
- s->active = 0;
- s->idx = 0;
- s->mode = RecordOneShot;
+ tBuffer_initToPool(sb, length, &leaf_mempool);
}
void tBuffer_free (tBuffer* const sb)
{
- _tBuffer* s = *sb;
-
- leaf_free(s->buff);
- leaf_free(s);
+ tBuffer_freeFromPool(sb, &leaf_mempool);
}
void tBuffer_initToPool (tBuffer* const sb, uint32_t length, tMempool* const mp)
@@ -54,6 +43,7 @@
s->bufferLength = length;
s->recordedLength = 0;
+ s->active = 0;
s->idx = 0;
s->mode = RecordOneShot;
}