src/types.h: add some documentation, use HAVE_AUBIO_DOUBLE, not AUBIO_SINGLE_PRECISION
[aubio.git] / src / aubio_priv.h
index cdb8269..803df2e 100644 (file)
@@ -32,7 +32,7 @@
  *
  */
 
-#if HAVE_CONFIG_H
+#if 1 //HAVE_CONFIG_H
 #include "config.h"
 #endif
 
@@ -49,7 +49,7 @@
 #include <complex.h>
 #endif
 
-#if HAVE_FFTW3_H
+#if HAVE_FFTW3 || HAVE_FFTW3F
 #include <fftw3.h>
 #endif
 
@@ -57,7 +57,7 @@
 #include <math.h>
 #endif
 
-#if HAVE_STRINGS_H
+#if HAVE_STRING_H
 #include <string.h>
 #endif
 
@@ -105,13 +105,15 @@ typedef enum {
 } aubio_status;
 
 #ifdef HAVE_C99_VARARGS_MACROS
-#define AUBIO_ERR(...)               fprintf(stderr,__VA_ARGS__)
-#define AUBIO_MSG(...)               fprintf(stdout,__VA_ARGS__)
-#define AUBIO_DBG(...)               fprintf(stderr,__VA_ARGS__)
+#define AUBIO_ERR(...)               fprintf(stderr, "AUBIO ERROR: " __VA_ARGS__)
+#define AUBIO_MSG(...)               fprintf(stdout, __VA_ARGS__)
+#define AUBIO_DBG(...)               fprintf(stderr, __VA_ARGS__)
+#define AUBIO_WRN(...)               fprintf(stderr, "AUBIO WARNING: " __VA_ARGS__)
 #else
-#define AUBIO_ERR(format, args...)   fprintf(stderr, format , ##args)
+#define AUBIO_ERR(format, args...)   fprintf(stderr, "AUBIO ERROR: " format , ##args)
 #define AUBIO_MSG(format, args...)   fprintf(stdout, format , ##args)
 #define AUBIO_DBG(format, args...)   fprintf(stderr, format , ##args)
+#define AUBIO_WRN(...)               fprintf(stderr, "AUBIO WARNING: " format, ##args)
 #endif
 
 #define AUBIO_QUIT(_s)               exit(_s)
@@ -122,6 +124,7 @@ typedef enum {
 #define TWO_PI     (PI*2.)
 
 /* aliases to math.h functions */
+#if !HAVE_AUBIO_DOUBLE
 #define EXP        expf
 #define COS        cosf
 #define SIN        sinf
@@ -132,10 +135,22 @@ typedef enum {
 #define LOG        logf
 #define FLOOR      floorf
 #define CEIL       ceilf
+#else
+#define EXP        exp
+#define COS        cos
+#define SIN        sin
+#define ABS        fabs
+#define POW        pow
+#define SQRT       sqrt
+#define LOG10      log10
+#define LOG        log
+#define FLOOR      floor
+#define CEIL       ceil
+#endif
 #define ROUND(x)   FLOOR(x+.5)
 
 /* aliases to complex.h functions */
-#if !defined(HAVE_COMPLEX_H) || defined(WIN32)
+#if HAVE_AUBIO_DOUBLE || !defined(HAVE_COMPLEX_H) || defined(WIN32)
 /* mingw32 does not know about c*f functions */
 #define EXPC      cexp
 /** complex = CEXPC(complex) */
@@ -168,6 +183,9 @@ typedef enum {
 #define LIN2DB(v) (20.0f*LOG10(v))
 #define SQR(_a)   (_a*_a)
 
+#define MAX(a,b)  ( a > b ? a : b)
+#define MIN(a,b)  ( a < b ? a : b)
+
 #define ELEM_SWAP(a,b) { register smpl_t t=(a);(a)=(b);(b)=t; }
 
 #define ISDENORMAL(f) f < 1.e-37