00001 #ifndef MARSYAS_COMMONHEADER_H
00002 #define MARSYAS_COMMONHEADER_H
00003
00009
00010
00011
00012
00013 #include <cstdio>
00014 #include <sys/types.h>
00015 #include <complex>
00016 #include <limits>
00017 #include "marsyas_types.h"
00018 #include "MrsLog.h"
00019
00020
00021
00022
00023
00024 namespace Marsyas
00025 {
00026
00027 const mrs_natural MRS_DEFAULT_SLICE_NSAMPLES = 512;
00028 const mrs_natural MRS_DEFAULT_SLICE_NOBSERVATIONS = 1;
00029 const mrs_real MRS_DEFAULT_SLICE_SRATE = 22050.0;
00030
00031 const mrs_natural FFT_FORWARD = 1;
00032 const mrs_natural FFT_INVERSE = 0;
00033
00034 const mrs_string EMPTYSTRING = "MARSYAS_EMPTY";
00035 #undef max
00036 #undef min
00037
00038 const mrs_real MAXREAL = std::numeric_limits<mrs_real>::max();
00039 const mrs_real MINREAL = std::numeric_limits<mrs_real>::min();
00040 const mrs_natural MAXNATURAL = std::numeric_limits<mrs_natural>::max();
00041 const mrs_natural MINNATURAL = std::numeric_limits<mrs_natural>::min();
00042
00043
00044 const mrs_real PI = 3.14159265358979323846;
00045 const mrs_real TWOPI = 6.28318530717958647692;
00046
00047
00048 }
00049
00050
00051
00052
00053
00054
00055 #define PCM_MAXSHRT 32767
00056 #define PCM_FMAXSHRT 32767.0f
00057
00058 #ifdef NDEBUG
00059 #define MRSASSERT(f)
00060 #else
00061 #define MRSASSERT(f) \
00062 if (f) \
00063 {} \
00064 else \
00065 MrsLog::mrsAssert(__FILE__, __LINE__)
00066 #endif
00067
00068
00069 #define MRSMSG(x) {std::ostringstream oss; MrsLog::mrsMessage((std::ostringstream&)(oss << x));}
00070
00071
00072 #define MRSERR(x) {std::ostringstream oss; MrsLog::mrsErr((std::ostringstream&)(oss << x));}
00073
00074 #define MRSWARN(x) {std::ostringstream oss; MrsLog::mrsWarning((std::ostringstream&)(oss << x));}
00075
00076 #define MRSDIAG(x) {std::ostringstream oss; MrsLog::mrsDiagnostic((std::ostringstream&)(oss << x));}
00077
00078 #define MRS_WARNINGS_OFF MrsLog::warnings_off_ = true;
00079 #define MRS_WARNINGS_ON MrsLog::warnings_off_ = false;
00080 #define MRS_MESSAGES_OFF MrsLog::messages_off_ = true;
00081 #define MRS_MESSAGES_ON MrsLog::messages_off_ = false;
00082
00083
00084
00085
00086 #ifdef __GNUC__
00087 #define DEPRECATED(func) func __attribute__ ((deprecated))
00088 #elif defined(_MSC_VER)
00089 #define DEPRECATED(func) __declspec(deprecated) func
00090 #else
00091 #pragma message("WARNING: You need to implement DEPRECATED for this compiler")
00092 #define DEPRECATED(func) func
00093 #endif
00094
00095
00096 #endif
00097