From 7c206dfa10609de485fb83f29776fe74cab25019 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Tue, 28 Feb 2006 07:30:11 +0000 Subject: [PATCH] [src,swig] added cvec methods to sample [src,swig] added cvec methods to sample --- src/sample.c | 31 +++++++++++++++++++++++++++++++ src/sample.h | 11 +++++++++++ swig/aubio.i | 10 ++++++++++ 3 files changed, 52 insertions(+) diff --git a/src/sample.c b/src/sample.c index 670f62ec..c85694a3 100644 --- a/src/sample.c +++ b/src/sample.c @@ -89,3 +89,34 @@ void del_cvec(cvec_t *s) { AUBIO_FREE(s->phas); AUBIO_FREE(s); } + +void cvec_write_norm(cvec_t *s, smpl_t data, uint_t channel, uint_t position) { + s->norm[channel][position] = data; +} +void cvec_write_phas(cvec_t *s, smpl_t data, uint_t channel, uint_t position) { + s->phas[channel][position] = data; +} +smpl_t cvec_read_norm(cvec_t *s, uint_t channel, uint_t position) { + return s->norm[channel][position]; +} +smpl_t cvec_read_phas(cvec_t *s, uint_t channel, uint_t position) { + return s->phas[channel][position]; +} +void cvec_put_norm_channel(cvec_t *s, smpl_t * data, uint_t channel) { + s->norm[channel] = data; +} +void cvec_put_phas_channel(cvec_t *s, smpl_t * data, uint_t channel) { + s->phas[channel] = data; +} +smpl_t * cvec_get_norm_channel(cvec_t *s, uint_t channel) { + return s->norm[channel]; +} +smpl_t * cvec_get_phas_channel(cvec_t *s, uint_t channel) { + return s->phas[channel]; +} +smpl_t ** cvec_get_norm(cvec_t *s) { + return s->norm; +} +smpl_t ** cvec_get_phas(cvec_t *s) { + return s->phas; +} diff --git a/src/sample.h b/src/sample.h index 1e881404..e0970afb 100644 --- a/src/sample.h +++ b/src/sample.h @@ -71,8 +71,19 @@ void fvec_write_sample(fvec_t *s, smpl_t data, uint_t channel, uint_t position) smpl_t * fvec_get_channel(fvec_t *s, uint_t channel); smpl_t ** fvec_get_data(fvec_t *s); void fvec_put_channel(fvec_t *s, smpl_t * data, uint_t channel); + extern cvec_t * new_cvec(uint_t length, uint_t channels); extern void del_cvec(cvec_t *s); +void cvec_write_norm(cvec_t *s, smpl_t data, uint_t channel, uint_t position); +void cvec_write_phas(cvec_t *s, smpl_t data, uint_t channel, uint_t position); +smpl_t cvec_read_norm(cvec_t *s, uint_t channel, uint_t position); +smpl_t cvec_read_phas(cvec_t *s, uint_t channel, uint_t position); +void cvec_put_norm_channel(cvec_t *s, smpl_t * data, uint_t channel); +void cvec_put_phas_channel(cvec_t *s, smpl_t * data, uint_t channel); +smpl_t * cvec_get_norm_channel(cvec_t *s, uint_t channel); +smpl_t * cvec_get_phas_channel(cvec_t *s, uint_t channel); +smpl_t ** cvec_get_norm(cvec_t *s); +smpl_t ** cvec_get_phas(cvec_t *s); #ifdef __cplusplus } diff --git a/swig/aubio.i b/swig/aubio.i index 27ed4116..c4f6ff08 100644 --- a/swig/aubio.i +++ b/swig/aubio.i @@ -48,6 +48,16 @@ public: /* cvec */ extern cvec_t * new_cvec(uint_t length, uint_t channels); extern void del_cvec(cvec_t *s); +extern void cvec_write_norm(cvec_t *s, smpl_t data, uint_t channel, uint_t position); +extern void cvec_write_phas(cvec_t *s, smpl_t data, uint_t channel, uint_t position); +extern smpl_t cvec_read_norm(cvec_t *s, uint_t channel, uint_t position); +extern smpl_t cvec_read_phas(cvec_t *s, uint_t channel, uint_t position); +extern void cvec_put_norm_channel(cvec_t *s, smpl_t * data, uint_t channel); +extern void cvec_put_phas_channel(cvec_t *s, smpl_t * data, uint_t channel); +extern smpl_t * cvec_get_norm_channel(cvec_t *s, uint_t channel); +extern smpl_t * cvec_get_phas_channel(cvec_t *s, uint_t channel); +extern smpl_t ** cvec_get_norm(cvec_t *s); +extern smpl_t ** cvec_get_phas(cvec_t *s); /* sndfile */ -- 2.26.2