# HG changeset patch # User Chris Cannam # Date 1559316835 -3600 # Node ID 5998ee1042d3c3d96c88bfeca0925315b167f532 # Parent 7132d952b9a69ae3f9c8f0d4b86855e2b3df3627 Use M_PI diff -r 7132d952b9a6 -r 5998ee1042d3 dsp/chromagram/ConstantQ.cpp --- a/dsp/chromagram/ConstantQ.cpp Fri May 31 16:33:46 2019 +0100 +++ b/dsp/chromagram/ConstantQ.cpp Fri May 31 16:33:55 2019 +0100 @@ -91,7 +91,7 @@ unsigned origin = m_FFTLength/2 - hammingLength/2; for (unsigned i=0; i &onsets ); + void process( double* src, unsigned int len, std::vector &onsets ); private: void initialise( PPickParams Config ); void deInitialise(); - int quadEval( vector &src, vector &idx ); + int quadEval( std::vector &src, std::vector &idx ); DFProcConfig m_DFProcessingParams; diff -r 7132d952b9a6 -r 5998ee1042d3 dsp/tempotracking/TempoTrack.cpp --- a/dsp/tempotracking/TempoTrack.cpp Fri May 31 16:33:46 2019 +0100 +++ b/dsp/tempotracking/TempoTrack.cpp Fri May 31 16:33:55 2019 +0100 @@ -120,7 +120,7 @@ for( i = 0; i < winLength; i++ ) { double dlag = (double)(i+1) - beatLag; Filter[ i ] = exp(-0.5 * pow(( dlag / m_sigma), 2.0) ) / - (sqrt( 2 * PI) * m_sigma); + (sqrt(TWO_PI) * m_sigma); } } } @@ -519,7 +519,7 @@ double temp = 0.0; for( int i = 0; i < scratchLength; i++ ) { - phaseScratch[ i ] = exp( -0.5 * pow( ( i - mu ) / sigma, 2 ) ) / ( sqrt( 2*PI ) *sigma ); + phaseScratch[ i ] = exp( -0.5 * pow( ( i - mu ) / sigma, 2 ) ) / ( sqrt(TWO_PI) *sigma ); } MathUtilities::getFrameMinMax( phaseScratch, scratchLength, &PhaseMin, &PhaseMax ); diff -r 7132d952b9a6 -r 5998ee1042d3 hmm/hmm.c --- a/hmm/hmm.c Fri May 31 16:33:46 2019 +0100 +++ b/hmm/hmm.c Fri May 31 16:33:55 2019 +0100 @@ -627,7 +627,7 @@ s = cblas_ddot(L, z, 1, y, 1); - return exp(-s/2.0) / (pow(2*PI, L/2.0) * sqrt(detcov)); + return exp(-s/2.0) / (pow(2 * M_PI, L/2.0) * sqrt(detcov)); } /* log probability of multivariate Gaussian given mean, inverse and determinant of covariance */ @@ -647,7 +647,7 @@ s = cblas_ddot(L, z, 1, y, 1); - ret = -0.5 * (s + L * log(2*PI) + log(detcov)); + ret = -0.5 * (s + L * log(2 * M_PI) + log(detcov)); return ret; } diff -r 7132d952b9a6 -r 5998ee1042d3 hmm/hmm.h --- a/hmm/hmm.h Fri May 31 16:33:46 2019 +0100 +++ b/hmm/hmm.h Fri May 31 16:33:55 2019 +0100 @@ -20,10 +20,6 @@ extern "C" { #endif -#ifndef PI -#define PI 3.14159265358979323846264338327950288 -#endif - typedef struct _model_t { int N; /* number of states */ double* p0; /* initial probs */ diff -r 7132d952b9a6 -r 5998ee1042d3 maths/MathAliases.h --- a/maths/MathAliases.h Fri May 31 16:33:46 2019 +0100 +++ b/maths/MathAliases.h Fri May 31 16:33:55 2019 +0100 @@ -19,17 +19,9 @@ #include #include -using namespace std; -typedef complex ComplexData; +#define TWO_PI (2. * M_PI) - -#ifndef PI -#define PI (3.14159265358979232846) -#endif - -#define TWO_PI (2. * PI) - -#define EPS 2.2204e-016 +#define EPS 2.2204e-016 /* aliases to math.h functions */ #define EXP exp @@ -43,6 +35,8 @@ #define FLOOR floorf #define TRUNC truncf +typedef std::complex ComplexData; + /* aliases to complex.h functions */ /** sample = EXPC(complex) */ #define EXPC cexpf