src/fmat.c: new_fmat() takes height as first argument
authorPaul Brossier <piem@piem.org>
Tue, 17 Dec 2013 16:30:13 +0000 (11:30 -0500)
committerPaul Brossier <piem@piem.org>
Tue, 17 Dec 2013 16:30:13 +0000 (11:30 -0500)
src/fmat.c
src/fmat.h
src/io/audio_unit.c
src/spectral/filterbank.c
src/spectral/mfcc.c
src/synth/sampler.c
tests/src/io/test-source_multi.c
tests/src/test-fmat.c

index 978abb7..09b3a8c 100644 (file)
@@ -21,7 +21,7 @@
 #include "aubio_priv.h"
 #include "fmat.h"
 
 #include "aubio_priv.h"
 #include "fmat.h"
 
-fmat_t * new_fmat (uint_t length, uint_t height) {
+fmat_t * new_fmat (uint_t height, uint_t length) {
   if ((sint_t)length <= 0 || (sint_t)height <= 0 ) {
     return NULL;
   }
   if ((sint_t)length <= 0 || (sint_t)height <= 0 ) {
     return NULL;
   }
index 800af5d..363965e 100644 (file)
@@ -49,7 +49,7 @@ typedef struct {
   \param height the height of the matrix to create
 
 */
   \param height the height of the matrix to create
 
 */
-fmat_t * new_fmat(uint_t length, uint_t height);
+fmat_t * new_fmat(uint_t height, uint_t length);
 
 /** fmat_t buffer deletion function
 
 
 /** fmat_t buffer deletion function
 
index 53c1a24..00f742d 100644 (file)
@@ -104,8 +104,8 @@ aubio_audio_unit_t * new_aubio_audio_unit(uint_t samplerate,
   o->au_ios_inbuf = AUBIO_ARRAY(SInt16, AU_IOS_MAX_FRAMES * o->hw_input_channels);
 
   /* the floats coming from and to the device callback */
   o->au_ios_inbuf = AUBIO_ARRAY(SInt16, AU_IOS_MAX_FRAMES * o->hw_input_channels);
 
   /* the floats coming from and to the device callback */
-  o->output_frames = new_fmat(blocksize, sw_output_channels);
-  o->input_frames = new_fmat(blocksize, sw_input_channels);
+  o->output_frames = new_fmat(sw_output_channels, blocksize);
+  o->input_frames = new_fmat(sw_input_channels, blocksize);
 
   /* check for some sizes */
   if ( o->hw_output_channels != o->output_frames->height ) {
 
   /* check for some sizes */
   if ( o->hw_output_channels != o->output_frames->height ) {
index 39dfa5d..f8678e5 100644 (file)
@@ -43,7 +43,7 @@ new_aubio_filterbank (uint_t n_filters, uint_t win_s)
   fb->n_filters = n_filters;
 
   /* allocate filter tables, a matrix of length win_s and of height n_filters */
   fb->n_filters = n_filters;
 
   /* allocate filter tables, a matrix of length win_s and of height n_filters */
-  fb->filters = new_fmat (win_s / 2 + 1, n_filters);
+  fb->filters = new_fmat (n_filters, win_s / 2 + 1);
 
   return fb;
 }
 
   return fb;
 }
index 25dbf0e..a71a6a5 100644 (file)
@@ -66,7 +66,7 @@ new_aubio_mfcc (uint_t win_s, uint_t n_filters, uint_t n_coefs,
   /* allocating buffers */
   mfcc->in_dct = new_fvec (n_filters);
 
   /* allocating buffers */
   mfcc->in_dct = new_fvec (n_filters);
 
-  mfcc->dct_coeffs = new_fmat (n_coefs, n_filters);
+  mfcc->dct_coeffs = new_fmat (n_filters, n_coefs);
 
   /* compute DCT transform dct_coeffs[i][j] as
      cos ( j * (i+.5) * PI / n_filters ) */
 
   /* compute DCT transform dct_coeffs[i][j] as
      cos ( j * (i+.5) * PI / n_filters ) */
index e6ee809..d6e5fd3 100644 (file)
@@ -42,7 +42,7 @@ aubio_sampler_t *new_aubio_sampler(uint_t samplerate, uint_t blocksize)
   s->samplerate = samplerate;
   s->blocksize = blocksize;
   s->source_output = new_fvec(blocksize);
   s->samplerate = samplerate;
   s->blocksize = blocksize;
   s->source_output = new_fvec(blocksize);
-  s->source_output_multi = new_fmat(blocksize, 4);
+  s->source_output_multi = new_fmat(4, blocksize);
   s->source = NULL;
   s->playing = 0;
   return s;
   s->source = NULL;
   s->playing = 0;
   return s;
index 853f028..b3b4683 100644 (file)
@@ -38,7 +38,7 @@ int main (int argc, char **argv)
 
   if ( n_channels == 0 ) n_channels = aubio_source_get_channels(s);
 
 
   if ( n_channels == 0 ) n_channels = aubio_source_get_channels(s);
 
-  fmat_t *mat = new_fmat(hop_size, n_channels);
+  fmat_t *mat = new_fmat(n_channels, hop_size);
 
   do {
     aubio_source_do_multi (s, mat, &read);
 
   do {
     aubio_source_do_multi (s, mat, &read);
index 3de0461..718903d 100644 (file)
@@ -8,7 +8,7 @@ int main ()
 {
   uint_t height = 3, length = 9, i, j;
   // create fmat_t object
 {
   uint_t height = 3, length = 9, i, j;
   // create fmat_t object
-  fmat_t * mat = new_fmat (length, height);
+  fmat_t * mat = new_fmat (height, length);
   for ( i = 0; i < mat->height; i++ ) {
     for ( j = 0; j < mat->length; j++ ) {
       // all elements are already initialized to 0.
   for ( i = 0; i < mat->height; i++ ) {
     for ( j = 0; j < mat->length; j++ ) {
       // all elements are already initialized to 0.