annotate libs/aubioFullOSXUni/include/aubio/aubio_priv.h @ 2:fa2af670b5c5 tip

SoundFileLoader might have moved
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Fri, 06 Jan 2012 00:23:26 +0000
parents bcb0d40158f4
children
rev   line source
andrew@0 1 /*
andrew@0 2 Copyright (C) 2003 Paul Brossier
andrew@0 3
andrew@0 4 This program is free software; you can redistribute it and/or modify
andrew@0 5 it under the terms of the GNU General Public License as published by
andrew@0 6 the Free Software Foundation; either version 2 of the License, or
andrew@0 7 (at your option) any later version.
andrew@0 8
andrew@0 9 This program is distributed in the hope that it will be useful,
andrew@0 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
andrew@0 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
andrew@0 12 GNU General Public License for more details.
andrew@0 13
andrew@0 14 You should have received a copy of the GNU General Public License
andrew@0 15 along with this program; if not, write to the Free Software
andrew@0 16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
andrew@0 17
andrew@0 18 */
andrew@0 19
andrew@0 20 /** @file
andrew@0 21 * Private include file
andrew@0 22 *
andrew@0 23 * This file is for inclusion from _within_ the library only.
andrew@0 24 */
andrew@0 25
andrew@0 26 #ifndef _AUBIO_PRIV_H
andrew@0 27 #define _AUBIO_PRIV_H
andrew@0 28
andrew@0 29 /*********************
andrew@0 30 *
andrew@0 31 * External includes
andrew@0 32 *
andrew@0 33 */
andrew@0 34
andrew@0 35 #if HAVE_CONFIG_H
andrew@0 36 #include "config.h"
andrew@0 37 #endif
andrew@0 38
andrew@0 39 #if HAVE_STDLIB_H
andrew@0 40 #include <stdlib.h>
andrew@0 41 #endif
andrew@0 42
andrew@0 43 #if HAVE_STDIO_H
andrew@0 44 #include <stdio.h>
andrew@0 45 #endif
andrew@0 46
andrew@0 47 /* must be included before fftw3.h */
andrew@0 48 #if HAVE_COMPLEX_H
andrew@0 49 #include <complex.h>
andrew@0 50 #endif
andrew@0 51
andrew@0 52 #if HAVE_FFTW3_H
andrew@0 53 #include <fftw3.h>
andrew@0 54 #endif
andrew@0 55
andrew@0 56 #if HAVE_MATH_H
andrew@0 57 #include <math.h>
andrew@0 58 #endif
andrew@0 59
andrew@0 60 #if HAVE_STRINGS_H
andrew@0 61 #include <string.h>
andrew@0 62 #endif
andrew@0 63
andrew@0 64 #include "types.h"
andrew@0 65
andrew@0 66 /****
andrew@0 67 *
andrew@0 68 * SYSTEM INTERFACE
andrew@0 69 *
andrew@0 70 */
andrew@0 71
andrew@0 72 /* Memory management */
andrew@0 73 #define AUBIO_MALLOC(_n) malloc(_n)
andrew@0 74 #define AUBIO_REALLOC(_p,_n) realloc(_p,_n)
andrew@0 75 #define AUBIO_NEW(_t) (_t*)malloc(sizeof(_t))
andrew@0 76 #define AUBIO_ARRAY(_t,_n) (_t*)malloc((_n)*sizeof(_t))
andrew@0 77 #define AUBIO_MEMCPY(_dst,_src,_n) memcpy(_dst,_src,_n)
andrew@0 78 #define AUBIO_MEMSET(_dst,_src,_t) memset(_dst,_src,_t)
andrew@0 79 #define AUBIO_FREE(_p) free(_p)
andrew@0 80
andrew@0 81
andrew@0 82 /* file interface */
andrew@0 83 #define AUBIO_FOPEN(_f,_m) fopen(_f,_m)
andrew@0 84 #define AUBIO_FCLOSE(_f) fclose(_f)
andrew@0 85 #define AUBIO_FREAD(_p,_s,_n,_f) fread(_p,_s,_n,_f)
andrew@0 86 #define AUBIO_FSEEK(_f,_n,_set) fseek(_f,_n,_set)
andrew@0 87
andrew@0 88 /* strings */
andrew@0 89 #define AUBIO_STRLEN(_s) strlen(_s)
andrew@0 90 #define AUBIO_STRCMP(_s,_t) strcmp(_s,_t)
andrew@0 91 #define AUBIO_STRNCMP(_s,_t,_n) strncmp(_s,_t,_n)
andrew@0 92 #define AUBIO_STRCPY(_dst,_src) strcpy(_dst,_src)
andrew@0 93 #define AUBIO_STRCHR(_s,_c) strchr(_s,_c)
andrew@0 94 #ifdef strdup
andrew@0 95 #define AUBIO_STRDUP(s) strdup(s)
andrew@0 96 #else
andrew@0 97 #define AUBIO_STRDUP(s) AUBIO_STRCPY(AUBIO_MALLOC(AUBIO_STRLEN(s) + 1), s)
andrew@0 98 #endif
andrew@0 99
andrew@0 100
andrew@0 101 /* Error reporting */
andrew@0 102 typedef enum {
andrew@0 103 AUBIO_OK = 0,
andrew@0 104 AUBIO_FAIL = -1
andrew@0 105 } aubio_status;
andrew@0 106
andrew@0 107 #ifdef HAVE_C99_VARARGS_MACROS
andrew@0 108 #define AUBIO_ERR(...) fprintf(stderr,__VA_ARGS__)
andrew@0 109 #define AUBIO_MSG(...) fprintf(stdout,__VA_ARGS__)
andrew@0 110 #define AUBIO_DBG(...) fprintf(stderr,__VA_ARGS__)
andrew@0 111 #else
andrew@0 112 #define AUBIO_ERR(format, args...) fprintf(stderr, format , ##args)
andrew@0 113 #define AUBIO_MSG(format, args...) fprintf(stdout, format , ##args)
andrew@0 114 #define AUBIO_DBG(format, args...) fprintf(stderr, format , ##args)
andrew@0 115 #endif
andrew@0 116
andrew@0 117 #define AUBIO_QUIT(_s) exit(_s)
andrew@0 118 #define AUBIO_SPRINTF sprintf
andrew@0 119
andrew@0 120 /* Libc shortcuts */
andrew@0 121 #define PI (M_PI)
andrew@0 122 #define TWO_PI (PI*2.)
andrew@0 123
andrew@0 124 /* aliases to math.h functions */
andrew@0 125 #define EXP expf
andrew@0 126 #define COS cosf
andrew@0 127 #define SIN sinf
andrew@0 128 #define ABS fabsf
andrew@0 129 #define POW powf
andrew@0 130 #define SQRT sqrtf
andrew@0 131 #define LOG10 log10f
andrew@0 132 #define LOG logf
andrew@0 133 #define FLOOR floorf
andrew@0 134 #define TRUNC truncf
andrew@0 135
andrew@0 136 /* aliases to complex.h functions */
andrew@0 137 #if !defined(HAVE_COMPLEX_H) || defined(WIN32)
andrew@0 138 /* mingw32 does not know about c*f functions */
andrew@0 139 #define EXPC cexp
andrew@0 140 /** complex = CEXPC(complex) */
andrew@0 141 #define CEXPC cexp
andrew@0 142 /** sample = ARGC(complex) */
andrew@0 143 #define ARGC carg
andrew@0 144 /** sample = ABSC(complex) norm */
andrew@0 145 #define ABSC cabs
andrew@0 146 /** sample = REAL(complex) */
andrew@0 147 #define REAL creal
andrew@0 148 /** sample = IMAG(complex) */
andrew@0 149 #define IMAG cimag
andrew@0 150 #else
andrew@0 151 /** sample = EXPC(complex) */
andrew@0 152 #define EXPC cexpf
andrew@0 153 /** complex = CEXPC(complex) */
andrew@0 154 #define CEXPC cexp
andrew@0 155 /** sample = ARGC(complex) */
andrew@0 156 #define ARGC cargf
andrew@0 157 /** sample = ABSC(complex) norm */
andrew@0 158 #define ABSC cabsf
andrew@0 159 /** sample = REAL(complex) */
andrew@0 160 #define REAL crealf
andrew@0 161 /** sample = IMAG(complex) */
andrew@0 162 #define IMAG cimagf
andrew@0 163 #endif
andrew@0 164
andrew@0 165 /* handy shortcuts */
andrew@0 166 #define DB2LIN(g) (POW(10.0f,(g)*0.05f))
andrew@0 167 #define LIN2DB(v) (20.0f*LOG10(v))
andrew@0 168 #define SQR(_a) (_a*_a)
andrew@0 169
andrew@0 170 #define ELEM_SWAP(a,b) { register smpl_t t=(a);(a)=(b);(b)=t; }
andrew@0 171
andrew@0 172 #define UNUSED __attribute__((unused))
andrew@0 173
andrew@0 174 #endif/*_AUBIO_PRIV_H*/