ref: b4b03247aca9aba8aa82d0ac95a60a77a2c7c838
parent: 876c5e70caf17ed6a07018f52851ead7acbf2da0
author: Paul Brossier <piem@altern.org>
date: Tue Aug 9 04:58:47 EDT 2005
protect window types with aubio_win_
--- a/examples/tests/test-fft.c
+++ b/examples/tests/test-fft.c
@@ -19,7 +19,7 @@
for (i=0; i < channels; i++)
spec[i] = AUBIO_ARRAY(fft_data_t,win_s);
/* initialize the window (see mathutils.c) */
- window(w,win_s,hanningz);
+ window(w,win_s,aubio_win_hanningz);
/* fill input with some data */
--- a/src/mathutils.c
+++ b/src/mathutils.c
@@ -23,32 +23,32 @@
#include "sample.h"
#include "mathutils.h"
-void window(smpl_t *w, uint_t size, window_type_t wintype) {
+void window(smpl_t *w, uint_t size, aubio_window_type_t wintype) {
uint_t i;
switch(wintype) {
- case rectangle:
+ case aubio_win_rectangle:
for (i=0;i<size;i++)
w[i] = 0.5;
break;
- case hamming:
+ case aubio_win_hamming:
for (i=0;i<size;i++)
w[i] = 0.54 - 0.46 * COS(TWO_PI * i / (size));
break;
- case hanning:
+ case aubio_win_hanning:
for (i=0;i<size;i++)
w[i] = 0.5 - (0.5 * COS(TWO_PI * i / (size)));
break;
- case hanningz:
+ case aubio_win_hanningz:
for (i=0;i<size;i++)
w[i] = 0.5 * (1.0 - COS(TWO_PI * i / (size)));
break;
- case blackman:
+ case aubio_win_blackman:
for (i=0;i<size;i++)
w[i] = 0.42
- 0.50 * COS( TWO_PI*i/(size-1.0))
+ 0.08 * COS(2.0*TWO_PI*i/(size-1.0));
break;
- case blackman_harris:
+ case aubio_win_blackman_harris:
for (i=0;i<size;i++)
w[i] = 0.35875
- 0.48829 * COS( TWO_PI*i/(size-1.0))
@@ -55,15 +55,15 @@
+ 0.14128 * COS(2.0*TWO_PI*i/(size-1.0))
- 0.01168 * COS(3.0*TWO_PI*i/(size-1.0));
break;
- case gaussian:
+ case aubio_win_gaussian:
for (i=0;i<size;i++)
w[i] = EXP(- 1.0 / SQR(size) * SQR(2.0*i-size));
break;
- case welch:
+ case aubio_win_welch:
for (i=0;i<size;i++)
w[i] = 1.0 - SQR((2*i-size)/(size+1.0));
break;
- case parzen:
+ case aubio_win_parzen:
for (i=0;i<size;i++)
w[i] = 1.0 - fabsf((2*i-size)/(size+1.0));
break;
--- a/src/mathutils.h
+++ b/src/mathutils.h
@@ -94,19 +94,19 @@
#endif
typedef enum {
- rectangle,
- hamming,
- hanning,
- hanningz,
- blackman,
- blackman_harris,
- gaussian,
- welch,
- parzen
-} window_type_t;
+ aubio_win_rectangle,
+ aubio_win_hamming,
+ aubio_win_hanning,
+ aubio_win_hanningz,
+ aubio_win_blackman,
+ aubio_win_blackman_harris,
+ aubio_win_gaussian,
+ aubio_win_welch,
+ aubio_win_parzen
+} aubio_window_type_t;
/** create window */
-void window(smpl_t *w, uint_t size, window_type_t wintype);
+void window(smpl_t *w, uint_t size, aubio_window_type_t wintype);
/** principal argument
*
--- a/src/phasevoc.c
+++ b/src/phasevoc.c
@@ -113,7 +113,7 @@
pv->dataold = new_fvec (win_s-hop_s, channels);
pv->synthold = new_fvec (win_s-hop_s, channels);
pv->w = AUBIO_ARRAY(smpl_t,win_s);
- window(pv->w,win_s,hanningz);
+ window(pv->w,win_s,aubio_win_hanningz);
pv->channels = channels;
pv->hop_s = hop_s;
--- a/swig/aubio.i
+++ b/swig/aubio.i
@@ -88,18 +88,18 @@
/* mathutils */
typedef enum {
- rectangle,
- hamming,
- hanning,
- hanningz,
- blackman,
- blackman_harris,
- gaussian,
- welch,
- parzen
-} window_type_t;
+ aubio_win_rectangle,
+ aubio_win_hamming,
+ aubio_win_hanning,
+ aubio_win_hanningz,
+ aubio_win_blackman,
+ aubio_win_blackman_harris,
+ aubio_win_gaussian,
+ aubio_win_welch,
+ aubio_win_parzen
+} aubio_window_type_t;
-void window(smpl_t *w, uint_t size, window_type_t wintype);
+void window(smpl_t *w, uint_t size, aubio_window_type_t wintype);
smpl_t unwrap2pi (smpl_t phase);
smpl_t vec_mean(fvec_t *s);
smpl_t vec_max(fvec_t *s);