ref: 1ece4f856df5be0b2c6d392596641869c014b05e
parent: 941c9f9e9f62df16a7ad305ad3db33f362fbab5f
author: Paul Brossier <piem@piem.org>
date: Tue Dec 17 06:20:23 EST 2013
src/fmat.h: clean up fmat api
--- a/src/fmat.c
+++ b/src/fmat.c
@@ -48,19 +48,22 @@
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) {
--- a/src/fmat.h
+++ b/src/fmat.h
@@ -50,6 +50,7 @@
*/
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()
@@ -56,24 +57,18 @@
*/
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.
-
\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);
+smpl_t fmat_get_sample(fmat_t *s, uint_t channel, uint_t position);
+
/** write sample value in 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][position]. Its purpose
- is to access these values from wrappers, as created by swig.
-
\param s vector to write to
\param data value to write in s->data[channel][position]
\param channel channel to write to
@@ -80,13 +75,10 @@
\param position sample position to write to
*/
-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);
+
/** read channel vector from a buffer
- 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.
-
\param s vector to read from
\param channel channel to read from
\param output ::fvec_t to output to
@@ -93,23 +85,16 @@
*/
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