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