Unified · Split
| @@ -26,23 +26,12 @@ · 25 unmodified lines | |||
| 26 | 26 | ||
| 27 | void tBuffer_init (tBuffer* const sb, uint32_t length) | 27 | void tBuffer_init (tBuffer* const sb, uint32_t length) |
| 28 | { | 28 | { |
| 29 | _tBuffer* s = *sb = (_tBuffer*) leaf_alloc(sizeof(_tBuffer)); | 29 | tBuffer_initToPool(sb, length, &leaf_mempool); |
| 30 | |||
| 31 | s->buff = (float*) leaf_alloc( sizeof(float) * length); | ||
| 32 | |||
| 33 | s->bufferLength = length; | ||
| 34 | s->recordedLength = 0; | ||
| 35 | s->active = 0; | ||
| 36 | s->idx = 0; | ||
| 37 | s->mode = RecordOneShot; | ||
| 38 | } | 30 | } |
| 39 | 31 | ||
| 40 | void tBuffer_free (tBuffer* const sb) | 32 | void tBuffer_free (tBuffer* const sb) |
| 41 | { | 33 | { |
| 42 | _tBuffer* s = *sb; | 34 | tBuffer_freeFromPool(sb, &leaf_mempool); |
| 43 | |||
| 44 | leaf_free(s->buff); | ||
| 45 | leaf_free(s); | ||
| 46 | } | 35 | } |
| 47 | 36 | ||
| 48 | void tBuffer_initToPool (tBuffer* const sb, uint32_t length, tMempool* const mp) | 37 | void tBuffer_initToPool (tBuffer* const sb, uint32_t length, tMempool* const mp) |
| @@ -54,6 +43,7 @@ void tBuffer_initToPool (tBuffer* const sb, uint32_t length, tMempool* const mp · 5 unmodified lines | |||
| 54 | 43 | ||
| 55 | s->bufferLength = length; | 44 | s->bufferLength = length; |
| 56 | s->recordedLength = 0; | 45 | s->recordedLength = 0; |
| 46 | s->active = 0; | ||
| 57 | s->idx = 0; | 47 | s->idx = 0; |
| 58 | s->mode = RecordOneShot; | 48 | s->mode = RecordOneShot; |
| 59 | } | 49 | } |