[96fb8ad] | 1 | /* |
---|
| 2 | Copyright (C) 2003 Paul Brossier |
---|
| 3 | |
---|
| 4 | This program is free software; you can redistribute it and/or modify |
---|
| 5 | it under the terms of the GNU General Public License as published by |
---|
| 6 | the Free Software Foundation; either version 2 of the License, or |
---|
| 7 | (at your option) any later version. |
---|
| 8 | |
---|
| 9 | This program is distributed in the hope that it will be useful, |
---|
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 12 | GNU General Public License for more details. |
---|
| 13 | |
---|
| 14 | You should have received a copy of the GNU General Public License |
---|
| 15 | along with this program; if not, write to the Free Software |
---|
| 16 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
| 17 | |
---|
| 18 | */ |
---|
| 19 | |
---|
| 20 | /** @file |
---|
| 21 | * Private include file |
---|
| 22 | * |
---|
| 23 | * This file is for inclusion from _within_ the library only. |
---|
| 24 | */ |
---|
| 25 | |
---|
| 26 | #ifndef _AUBIO_PRIV_H |
---|
| 27 | #define _AUBIO_PRIV_H |
---|
| 28 | |
---|
| 29 | /********************* |
---|
| 30 | * |
---|
| 31 | * External includes |
---|
| 32 | * |
---|
| 33 | */ |
---|
| 34 | |
---|
| 35 | #if HAVE_CONFIG_H |
---|
| 36 | #include "config.h" |
---|
| 37 | #endif |
---|
| 38 | |
---|
| 39 | #if HAVE_STDLIB_H |
---|
| 40 | #include <stdlib.h> |
---|
| 41 | #endif |
---|
| 42 | |
---|
| 43 | #if HAVE_STDIO_H |
---|
| 44 | #include <stdio.h> |
---|
| 45 | #endif |
---|
| 46 | |
---|
| 47 | #if HAVE_COMPLEX_H |
---|
| 48 | #include <complex.h> |
---|
| 49 | #endif |
---|
| 50 | /* |
---|
| 51 | #include <complex.h> |
---|
| 52 | #include <fftw3.h> |
---|
| 53 | #define FFTW_TYPE fftwf_complex |
---|
| 54 | */ |
---|
| 55 | #if HAVE_FFTW3_H |
---|
| 56 | #include <fftw3.h> |
---|
| 57 | //#define FFTW_TYPE fftwf_complex |
---|
| 58 | #endif |
---|
| 59 | |
---|
| 60 | #if HAVE_MATH_H |
---|
| 61 | #include <math.h> |
---|
| 62 | #endif |
---|
| 63 | |
---|
| 64 | #if HAVE_STRINGS_H |
---|
| 65 | #include <string.h> |
---|
| 66 | #endif |
---|
| 67 | |
---|
[b49daf6] | 68 | #ifdef ALSA_SUPPORT |
---|
| 69 | #ifdef LADCCA_SUPPORT |
---|
| 70 | #include <ladcca/ladcca.h> |
---|
| 71 | extern cca_client_t * aubio_cca_client; |
---|
| 72 | #endif /* LADCCA_SUPPORT */ |
---|
| 73 | #endif /* ALSA_SUPPORT */ |
---|
| 74 | |
---|
[96fb8ad] | 75 | |
---|
| 76 | #include "types.h" |
---|
| 77 | |
---|
| 78 | /**** |
---|
| 79 | * |
---|
| 80 | * SYSTEM INTERFACE |
---|
| 81 | * |
---|
| 82 | */ |
---|
| 83 | |
---|
| 84 | /* Memory management */ |
---|
| 85 | #define AUBIO_MALLOC(_n) malloc(_n) |
---|
| 86 | #define AUBIO_REALLOC(_p,_n) realloc(_p,_n) |
---|
| 87 | #define AUBIO_NEW(_t) (_t*)malloc(sizeof(_t)) |
---|
| 88 | #define AUBIO_ARRAY(_t,_n) (_t*)malloc((_n)*sizeof(_t)) |
---|
| 89 | #define AUBIO_MEMCPY(_dst,_src,_n) memcpy(_dst,_src,_n) |
---|
| 90 | #define AUBIO_MEMSET(_dst,_src,_t) memset(_dst,_src,sizeof(_t)) |
---|
| 91 | #define AUBIO_FREE(_p) free(_p) |
---|
| 92 | |
---|
| 93 | |
---|
| 94 | /* file interface */ |
---|
| 95 | #define AUBIO_FOPEN(_f,_m) fopen(_f,_m) |
---|
| 96 | #define AUBIO_FCLOSE(_f) fclose(_f) |
---|
| 97 | #define AUBIO_FREAD(_p,_s,_n,_f) fread(_p,_s,_n,_f) |
---|
| 98 | #define AUBIO_FSEEK(_f,_n,_set) fseek(_f,_n,_set) |
---|
| 99 | |
---|
| 100 | /* strings */ |
---|
| 101 | #define AUBIO_STRLEN(_s) strlen(_s) |
---|
| 102 | #define AUBIO_STRCMP(_s,_t) strcmp(_s,_t) |
---|
| 103 | #define AUBIO_STRNCMP(_s,_t,_n) strncmp(_s,_t,_n) |
---|
| 104 | #define AUBIO_STRCPY(_dst,_src) strcpy(_dst,_src) |
---|
| 105 | #define AUBIO_STRCHR(_s,_c) strchr(_s,_c) |
---|
| 106 | #ifdef strdup |
---|
| 107 | #define AUBIO_STRDUP(s) strdup(s) |
---|
| 108 | #else |
---|
| 109 | #define AUBIO_STRDUP(s) AUBIO_STRCPY(AUBIO_MALLOC(AUBIO_STRLEN(s) + 1), s) |
---|
| 110 | #endif |
---|
| 111 | |
---|
| 112 | |
---|
| 113 | /* Error reporting */ |
---|
| 114 | typedef enum { |
---|
| 115 | AUBIO_OK = 0, |
---|
| 116 | AUBIO_FAIL = -1 |
---|
| 117 | } aubio_status; |
---|
| 118 | |
---|
| 119 | #define AUBIO_ERR(...) fprintf(stderr,__VA_ARGS__) |
---|
| 120 | #define AUBIO_MSG(...) fprintf(stdout,__VA_ARGS__) |
---|
| 121 | #define AUBIO_DBG(...) fprintf(stderr,__VA_ARGS__) |
---|
| 122 | #define AUBIO_QUIT(_s) exit(_s) |
---|
| 123 | #define AUBIO_SPRINTF sprintf |
---|
| 124 | |
---|
| 125 | #endif/*_AUBIO_PRIV_H*/ |
---|