# HG changeset patch # User Chris Cannam # Date 1202378498 0 # Node ID 9aedf5ea8c3536221469828924a709172e4fddf7 # Parent d7b81af99b5e70b029b8118c43943bc8a43c645f * remove exceptions from Polyfit, return bool instead of int from isModeMinor diff -r d7b81af99b5e -r 9aedf5ea8c35 dsp/keydetection/GetKeyMode.cpp --- a/dsp/keydetection/GetKeyMode.cpp Fri Feb 01 16:46:36 2008 +0000 +++ b/dsp/keydetection/GetKeyMode.cpp Thu Feb 07 10:01:38 2008 +0000 @@ -290,7 +290,7 @@ } -int GetKeyMode::isModeMinor( int key ) +bool GetKeyMode::isModeMinor( int key ) { return (key > 12); } diff -r d7b81af99b5e -r 9aedf5ea8c35 dsp/keydetection/GetKeyMode.h --- a/dsp/keydetection/GetKeyMode.h Fri Feb 01 16:46:36 2008 +0000 +++ b/dsp/keydetection/GetKeyMode.h Thu Feb 07 10:01:38 2008 +0000 @@ -44,7 +44,7 @@ double *getKeyStrengths() { return m_keyStrengths; } - int isModeMinor( int key ); + bool isModeMinor( int key ); protected: diff -r d7b81af99b5e -r 9aedf5ea8c35 maths/Polyfit.h --- a/maths/Polyfit.h Fri Feb 01 16:46:36 2008 +0000 +++ b/maths/Polyfit.h Thu Feb 07 10:01:38 2008 +0000 @@ -40,10 +40,10 @@ // Modified by CLandone for VC6 Aug 2004 /////////////////////////////////////////////////////////////////////////////// +#include using std::vector; - class TPolyFit { typedef vector > Matrix; @@ -116,12 +116,18 @@ zeroise(g, nterms); zeroise(a, nterms, nterms); zeroise(xmatr, npoints, nterms); - if(nterms < 1) - throw "PolyFit called with less than one term"; - if(npoints < 2) - throw "PolyFit called with less than two points"; - if(npoints != y.size()) - throw "PolyFit called with x and y of unequal size"; + if (nterms < 1) { + std::cerr << "ERROR: PolyFit called with less than one term" << std::endl; + return 0; + } + if(npoints < 2) { + std::cerr << "ERROR: PolyFit called with less than two points" << std::endl; + return 0; + } + if(npoints != y.size()) { + std::cerr << "ERROR: PolyFit called with x and y of unequal size" << std::endl; + return 0; + } for(i = 0; i < npoints; ++i) { // { setup x matrix } @@ -247,7 +253,8 @@ { if(index [k][2] != 0) { - throw "Error in GaussJordan: matrix is singular"; + std::cerr << "ERROR: Error in PolyFit::GaussJordan: matrix is singular" << std::endl; + return false; } } @@ -290,8 +297,10 @@ { for(int k = 0; k < ncol; ++k) { - if(index[k][2] > 0) - throw "Error in GaussJordan2: matrix is singular"; + if(index[k][2] > 0) { + std::cerr << "ERROR: Error in PolyFit::GaussJordan2: matrix is singular" << std::endl; + return false; + } if(index[k][2] < 0 && fabs(b[j][k]) > big) { diff -r d7b81af99b5e -r 9aedf5ea8c35 qm-dsp.pro --- a/qm-dsp.pro Fri Feb 01 16:46:36 2008 +0000 +++ b/qm-dsp.pro Thu Feb 07 10:01:38 2008 +0000 @@ -4,7 +4,7 @@ OBJECTS_DIR = tmp_obj MOC_DIR = tmp_moc -linux-g++:QMAKE_CXXFLAGS_RELEASE += -DNDEBUG -O3 -march=pentium3 -mfpmath=sse -msse -ffast-math +linux-g++:QMAKE_CXXFLAGS_RELEASE += -DNDEBUG -O3 -fno-exceptions -fPIC -march=pentium3 -mfpmath=sse -msse -ffast-math #DEPENDPATH += base \ # dsp/chromagram \