From: Paul Brossier Date: Tue, 17 Dec 2013 16:20:23 +0000 (-0500) Subject: src/fmat.h: clean up fmat api X-Git-Tag: 0.4.0~9 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=1ece4f856df5be0b2c6d392596641869c014b05e;p=aubio.git src/fmat.h: clean up fmat api --- diff --git a/src/fmat.c b/src/fmat.c index 57347664..978abb73 100644 --- a/src/fmat.c +++ b/src/fmat.c @@ -48,21 +48,24 @@ void del_fmat (fmat_t *s) { AUBIO_FREE(s); } -void fmat_write_sample(fmat_t *s, smpl_t data, uint_t channel, uint_t position) { +void fmat_set_sample(fmat_t *s, smpl_t data, uint_t channel, uint_t position) { s->data[channel][position] = data; } -smpl_t fmat_read_sample(fmat_t *s, uint_t channel, uint_t position) { + +smpl_t fmat_get_sample(fmat_t *s, uint_t channel, uint_t position) { return s->data[channel][position]; } -void fmat_put_channel(fmat_t *s, smpl_t * data, uint_t channel) { - s->data[channel] = data; -} + void fmat_get_channel(fmat_t *s, uint_t channel, fvec_t *output) { output->data = s->data[channel]; output->length = s->length; return; } +smpl_t * fmat_get_channel_data(fmat_t *s, uint_t channel) { + return s->data[channel]; +} + smpl_t ** fmat_get_data(fmat_t *s) { return s->data; } diff --git a/src/fmat.h b/src/fmat.h index 277ca54e..800af5d7 100644 --- a/src/fmat.h +++ b/src/fmat.h @@ -50,29 +50,24 @@ typedef struct { */ fmat_t * new_fmat(uint_t length, uint_t height); + /** fmat_t buffer deletion function \param s buffer to delete as returned by new_fmat() */ void del_fmat(fmat_t *s); -/** read sample value in a buffer - Note that this function is not used in the aubio library, since the same - result can be obtained using vec->data[channel][position]. Its purpose is to - access these values from wrappers, as created by swig. +/** read sample value in a buffer \param s vector to read from \param channel channel to read from \param position sample position to read from */ -smpl_t fmat_read_sample(fmat_t *s, uint_t channel, uint_t position); -/** write sample value in a buffer +smpl_t fmat_get_sample(fmat_t *s, uint_t channel, uint_t position); - Note that this function is not used in the aubio library, since the same - result can be obtained by assigning vec->data[channel][position]. Its purpose - is to access these values from wrappers, as created by swig. +/** write sample value in a buffer \param s vector to write to \param data value to write in s->data[channel][position] @@ -80,12 +75,9 @@ smpl_t fmat_read_sample(fmat_t *s, uint_t channel, uint_t position); \param position sample position to write to */ -void fmat_write_sample(fmat_t *s, smpl_t data, uint_t channel, uint_t position); -/** read channel vector from a buffer +void fmat_set_sample(fmat_t *s, smpl_t data, uint_t channel, uint_t position); - Note that this function is not used in the aubio library, since the same - result can be obtained with vec->data[channel]. Its purpose is to access - these values from wrappers, as created by swig. +/** read channel vector from a buffer \param s vector to read from \param channel channel to read from @@ -93,23 +85,16 @@ void fmat_write_sample(fmat_t *s, smpl_t data, uint_t channel, uint_t position) */ void fmat_get_channel (fmat_t *s, uint_t channel, fvec_t *output); -/** write channel vector into a buffer - Note that this function is not used in the aubio library, since the same - result can be obtained by assigning vec->data[channel]. Its purpose is to - access these values from wrappers, as created by swig. +/** get vector buffer from an fmat data - \param s vector to write to - \param data vector of [length] values to write - \param channel channel to write to + \param s vector to read from + \param channel channel to read from */ -void fmat_put_channel(fmat_t *s, smpl_t * data, uint_t channel); -/** read data from a buffer +smpl_t * fmat_get_channel_data (fmat_t *s, uint_t channel); - Note that this function is not used in the aubio library, since the same - result can be obtained with vec->data. Its purpose is to access these values - from wrappers, as created by swig. +/** read data from a buffer \param s vector to read from