shithub: aubio

Download patch

ref: 4ed0ed1f6cac63c8081b9e63c3dcaf49af606b89
parent: 1ece4f856df5be0b2c6d392596641869c014b05e
author: Paul Brossier <piem@piem.org>
date: Tue Dec 17 06:30:13 EST 2013

src/fmat.c: new_fmat() takes height as first argument

--- a/src/fmat.c
+++ b/src/fmat.c
@@ -21,7 +21,7 @@
 #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;
   }
--- a/src/fmat.h
+++ b/src/fmat.h
@@ -49,7 +49,7 @@
   \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
 
--- a/src/io/audio_unit.c
+++ b/src/io/audio_unit.c
@@ -104,8 +104,8 @@
   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 ) {
--- a/src/spectral/filterbank.c
+++ b/src/spectral/filterbank.c
@@ -43,7 +43,7 @@
   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;
 }
--- a/src/spectral/mfcc.c
+++ b/src/spectral/mfcc.c
@@ -66,7 +66,7 @@
   /* 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 ) */
--- a/src/synth/sampler.c
+++ b/src/synth/sampler.c
@@ -42,7 +42,7 @@
   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;
--- a/tests/src/io/test-source_multi.c
+++ b/tests/src/io/test-source_multi.c
@@ -38,7 +38,7 @@
 
   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);
--- a/tests/src/test-fmat.c
+++ b/tests/src/test-fmat.c
@@ -8,7 +8,7 @@
 {
   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.