![]() |
Mixxx
|
00001 /*************************************************************************** 00002 defs.h - description 00003 ------------------- 00004 copyright : (C) 2002 by Tue and Ken Haste Andersen 00005 email : 00006 ***************************************************************************/ 00007 00008 /*************************************************************************** 00009 * * 00010 * This program is free software; you can redistribute it and/or modify * 00011 * it under the terms of the GNU General Public License as published by * 00012 * the Free Software Foundation; either version 2 of the License, or * 00013 * (at your option) any later version. * 00014 * * 00015 ***************************************************************************/ 00016 00017 #ifndef DEFS_H 00018 #define DEFS_H 00019 00020 #define MIXXX_PROMO_DIR "promo" 00021 00022 #include <math.h> 00023 #include <iostream> 00024 #include <stdlib.h> 00025 00026 typedef short int SAMPLE; // Data type used in output buffer. S16_LE works on SB/ALSA. 00027 //const int SAMPLE_SIZE = 2; // Number of bytes used to store 1 sample 00028 typedef float CSAMPLE; // CSAMPLE defines the CSAMPLE type used for 00029 // intermidiate calculations 00030 typedef CSAMPLE FLOAT_TYPE; // Float type, used for non sample data 00031 00032 const int OK = 0; // Just defs to use for returning errors from functions 00033 const int ERR = -1; 00034 00035 const int BUFFER_SIZE = 2048; // Buffer size used both for input and output as default 00036 00038 const unsigned int READCHUNKSIZE = 20480; //40960; 00042 const int READCHUNK_NO = 40; 00043 const unsigned int READBUFFERSIZE = READCHUNKSIZE*READCHUNK_NO; 00045 const int WINDOWSIZE = 2048; 00047 const int STEPSIZE = 1024; //WINDOWSIZE/2; //WINDOWSIZE/STEPSIZE must result in an integer value 00048 00050 const int MAX_BUFFER_LEN = 160000; 00051 00052 // Various fixed constants 00053 // static CSAMPLE pi = acos(-1.0); // Conflicts with macx headers 00054 // static CSAMPLE two_pi = (2.f*acos(-1.f)); 00055 // two_pi has been moved to mathstuff.h clear up the "defs.h:55: warning: ‘two_pi’ defined but not used" it generates for every file including defs.h 00056 00057 // Ensure that CSAMPLE x stays above the intel cpu denormalization range, 00058 // otherwise sets x equal to 0. 00059 inline double zap_denormal(double x) 00060 { 00061 // fabs too slow on Windows... 00062 double absx; 00063 if (x<0) 00064 absx = -x; 00065 else 00066 absx = x; 00067 00068 return (absx > 1e-15f && absx < 1e15f) ? x : 0.f; 00069 } 00070 00071 #ifndef math_max 00072 #define math_max(a,b) (((a) > (b)) ? (a) : (b)) 00073 #endif 00074 00075 #ifndef math_min 00076 #define math_min(a,b) (((a) < (b)) ? (a) : (b)) 00077 #endif 00078 00079 #endif 00080