# HG changeset patch # User cannam # Date 1202378498 0 # Node ID b4921bfd2aea738ae173d426ec269c39a96eb9b9 # Parent d894e92ff6730d225521be02911ee6eb796d7695 * remove exceptions from Polyfit, return bool instead of int from isModeMinor diff -r d894e92ff673 -r b4921bfd2aea 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 d894e92ff673 -r b4921bfd2aea 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 d894e92ff673 -r b4921bfd2aea 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 d894e92ff673 -r b4921bfd2aea 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 \