4 void buffer_init(struct buffer
*buf
)
10 err_t
buffer_alloc(struct buffer
*buf
, size_t n_samples
)
13 if (buf
->n_samples
!= n_samples
){
14 new_buf
= realloc(buf
->data
, n_samples
* aformat_get_sample_size(&buf
->format
));
16 return make_error(ENOMEM
, NULL
, "memory full: allocating buffer (%d samples)", n_samples
);
19 buf
->n_samples
= n_samples
;