Changeset 26499e4


Ignore:
Timestamp:
Jul 21, 2006, 8:35:24 PM (18 years ago)
Author:
Paul Brossier <piem@altern.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
3eb0cc3
Parents:
45c0f16
Message:

update test-fft to not use aubio_priv.h
update test-fft to not use aubio_priv.h

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/tests/test-fft.c

    r45c0f16 r26499e4  
     1#include <stdlib.h>
     2#include <math.h>
     3#include <complex.h>
     4#include <aubio.h>
    15
    2 #include "aubio_priv.h"
    3 #include <aubio.h>
     6#define NEW_ARRAY(_t,_n)                (_t*)malloc((_n)*sizeof(_t))
     7
    48
    59int main(){
     
    1418        /* allocate fft and other memory space */
    1519        aubio_fft_t * fft      = new_aubio_fft(win_s);      /* fft interface */
    16         smpl_t * w             = AUBIO_ARRAY(smpl_t,win_s); /* window */
     20        smpl_t * w             = NEW_ARRAY(smpl_t,win_s); /* window */
    1721        /* complex spectral data */
    18         fft_data_t ** spec      = AUBIO_ARRAY(fft_data_t*,channels);
     22        fft_data_t ** spec     = NEW_ARRAY(fft_data_t*,channels);
    1923        for (i=0; i < channels; i++)
    20                 spec[i] = AUBIO_ARRAY(fft_data_t,win_s);
     24                spec[i] = NEW_ARRAY(fft_data_t,win_s);
    2125        /* initialize the window (see mathutils.c) */
    2226        aubio_window(w,win_s,aubio_win_hanningz);
     
    3539        for (i=0; i < channels; i++) {
    3640                for (j=0; j<win_s/2+1; j++) {
    37                         spec[i][j]  = CEXPC(I*aubio_unwrap2pi(fftgrain->phas[i][j]));
     41                        spec[i][j]  = cexp(I*aubio_unwrap2pi(fftgrain->phas[i][j]));
    3842                        spec[i][j] *= fftgrain->norm[i][j];
    3943                }
     
    4448        del_fvec(out);
    4549        del_cvec(fftgrain);
    46         AUBIO_FREE(w);
     50        free(w);
    4751        del_aubio_fft(fft);
    4852        for (i=0; i < channels; i++)
    49                 AUBIO_FREE(spec[i]);
    50         AUBIO_FREE(spec);
     53                free(spec[i]);
     54        free(spec);
    5155        aubio_cleanup();
    5256        return 0;
Note: See TracChangeset for help on using the changeset viewer.