# HG changeset patch # User cannam # Date 1226325715 0 # Node ID 38bf099279426094e633e28dd4ccb7bedb5eecb6 # Parent 4f1870dbab2c817bb69cbaff40a1e621d5824b94 * Build fixes for gcc 4.3.2 * _Maybe_, but probably not, fix crash in tempo tracker... let's see how we get on diff -r 4f1870dbab2c -r 38bf09927942 dsp/keydetection/GetKeyMode.cpp --- a/dsp/keydetection/GetKeyMode.cpp Thu Jul 24 16:09:25 2008 +0000 +++ b/dsp/keydetection/GetKeyMode.cpp Mon Nov 10 14:01:55 2008 +0000 @@ -10,6 +10,9 @@ #include +#include +#include + // Chords profile static double MajProfile[36] = { 0.0384, 0.0629, 0.0258, 0.0121, 0.0146, 0.0106, 0.0364, 0.0610, 0.0267, diff -r 4f1870dbab2c -r 38bf09927942 dsp/mfcc/MFCC.cpp --- a/dsp/mfcc/MFCC.cpp Thu Jul 24 16:09:25 2008 +0000 +++ b/dsp/mfcc/MFCC.cpp Mon Nov 10 14:01:55 2008 +0000 @@ -10,6 +10,7 @@ #include #include +#include #include "MFCC.h" #include "dsp/transforms/FFT.h" diff -r 4f1870dbab2c -r 38bf09927942 dsp/onsets/DetectionFunction.cpp --- a/dsp/onsets/DetectionFunction.cpp Thu Jul 24 16:09:25 2008 +0000 +++ b/dsp/onsets/DetectionFunction.cpp Mon Nov 10 14:01:55 2008 +0000 @@ -9,6 +9,7 @@ */ #include "DetectionFunction.h" +#include ////////////////////////////////////////////////////////////////////// // Construction/Destruction diff -r 4f1870dbab2c -r 38bf09927942 dsp/onsets/PeakPicking.cpp --- a/dsp/onsets/PeakPicking.cpp Thu Jul 24 16:09:25 2008 +0000 +++ b/dsp/onsets/PeakPicking.cpp Mon Nov 10 14:01:55 2008 +0000 @@ -12,6 +12,8 @@ #include "maths/Polyfit.h" #include +#include + ////////////////////////////////////////////////////////////////////// // Construction/Destruction diff -r 4f1870dbab2c -r 38bf09927942 dsp/signalconditioning/DFProcess.cpp --- a/dsp/signalconditioning/DFProcess.cpp Thu Jul 24 16:09:25 2008 +0000 +++ b/dsp/signalconditioning/DFProcess.cpp Mon Nov 10 14:01:55 2008 +0000 @@ -11,6 +11,8 @@ #include "DFProcess.h" #include "maths/MathUtilities.h" +#include + ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// diff -r 4f1870dbab2c -r 38bf09927942 dsp/tempotracking/TempoTrack.cpp --- a/dsp/tempotracking/TempoTrack.cpp Thu Jul 24 16:09:25 2008 +0000 +++ b/dsp/tempotracking/TempoTrack.cpp Mon Nov 10 14:01:55 2008 +0000 @@ -17,6 +17,8 @@ #include +//#define DEBUG_TEMPO_TRACK 1 + #define RAY43VAL @@ -164,7 +166,9 @@ numelem = tsig; } +#ifdef DEBUG_TEMPO_TRACK std::cerr << "tempoMM: m_winLength = " << m_winLength << ", m_lagLength = " << m_lagLength << ", numelem = " << numelem << std::endl; +#endif for(i=1;i TempoTrack::process(double *DF, unsigned int length) -{ - m_dataLength = length; - - double period = 0.0; - int stepFlag = 0; - int constFlag = 0; - int FSP = 0; - int tsig = 0; - int lastBeat = 0; - - - double* RW = new double[ m_lagLength ]; - for( unsigned int clear = 0; clear < m_lagLength; clear++){ RW[ clear ] = 0.0;} - - double* GW = new double[ m_lagLength ]; - for(unsigned int clear = 0; clear < m_lagLength; clear++){ GW[ clear ] = 0.0;} - - double* PW = new double[ m_lagLength ]; - for(unsigned int clear = 0; clear < m_lagLength; clear++){ PW[ clear ] = 0.0;} - - m_DFFramer.setSource( DF, m_dataLength ); - - unsigned int TTFrames = m_DFFramer.getMaxNoFrames(); - - double* periodP = new double[ TTFrames ]; - for(unsigned int clear = 0; clear < TTFrames; clear++){ periodP[ clear ] = 0.0;} - - double* periodG = new double[ TTFrames ]; - for(unsigned int clear = 0; clear < TTFrames; clear++){ periodG[ clear ] = 0.0;} - - double* alignment = new double[ TTFrames ]; - for(unsigned int clear = 0; clear < TTFrames; clear++){ alignment[ clear ] = 0.0;} - - m_beats.clear(); - - createCombFilter( RW, m_lagLength, 0, 0 ); - - int TTLoopIndex = 0; - - for( unsigned int i = 0; i < TTFrames; i++ ) - { - m_DFFramer.getFrame( m_rawDFFrame ); - - m_DFConditioning->process( m_rawDFFrame, m_smoothDFFrame ); - - m_correlator.doAutoUnBiased( m_smoothDFFrame, m_frameACF, m_winLength ); - - periodP[ TTLoopIndex ] = tempoMM( m_frameACF, RW, 0 ); - - if( GW[ 0 ] != 0 ) - { - periodG[ TTLoopIndex ] = tempoMM( m_frameACF, GW, tsig ); - } - else - { - periodG[ TTLoopIndex ] = 0.0; - } - - stepDetect( periodP, periodG, TTLoopIndex, &stepFlag ); - - if( stepFlag == 1) - { - constDetect( periodP, TTLoopIndex, &constFlag ); - stepFlag = 0; - } - else - { - stepFlag -= 1; - } - - if( stepFlag < 0 ) - { - stepFlag = 0; - } - - if( constFlag != 0) - { - tsig = findMeter( m_frameACF, m_winLength, periodP[ TTLoopIndex ] ); - - createCombFilter( GW, m_lagLength, tsig, periodP[ TTLoopIndex ] ); - - periodG[ TTLoopIndex ] = tempoMM( m_frameACF, GW, tsig ); - - period = periodG[ TTLoopIndex ]; - - // am temporarily changing the last input parameter to lastBeat instead of '0' - createPhaseExtractor( PW, m_winLength, period, FSP, lastBeat ); - - constFlag = 0; - - } - else - { - if( GW[ 0 ] != 0 ) - { - period = periodG[ TTLoopIndex ]; - createPhaseExtractor( PW, m_winLength, period, FSP, lastBeat ); - - } - else - { - period = periodP[ TTLoopIndex ]; - createPhaseExtractor( PW, m_winLength, period, FSP, 0 ); - } - } - - alignment[ TTLoopIndex ] = phaseMM( m_rawDFFrame, PW, m_winLength, period ); - - lastBeat = beatPredict(FSP, alignment[ TTLoopIndex ], period, m_lagLength ); - - FSP += (m_lagLength); - - TTLoopIndex++; - } - - - delete [] periodP; - delete [] periodG; - delete [] alignment; - - delete [] RW; - delete [] GW; - delete [] PW; - - return m_beats; -} - - - vector TempoTrack::process( vector DF, @@ -829,6 +727,10 @@ m_DFFramer.setSource( &causalDF[0], m_dataLength ); unsigned int TTFrames = m_DFFramer.getMaxNoFrames(); + +#ifdef DEBUG_TEMPO_TRACK + std::cerr << "TTFrames = " << TTFrames << std::endl; +#endif double* periodP = new double[ TTFrames ]; for(unsigned clear = 0; clear < TTFrames; clear++){ periodP[ clear ] = 0.0;} @@ -891,7 +793,9 @@ period = periodG[ TTLoopIndex ]; - std::cerr << "TempoTrack::process(2): constFlag == " << constFlag << ", TTLoopIndex = " << TTLoopIndex << ", period from periodG = " << period << std::endl; +#ifdef DEBUG_TEMPO_TRACK + std::cerr << "TempoTrack::process: constFlag == " << constFlag << ", TTLoopIndex = " << TTLoopIndex << ", period from periodG = " << period << std::endl; +#endif createPhaseExtractor( PW, m_winLength, period, FSP, 0 ); @@ -904,10 +808,12 @@ { period = periodG[ TTLoopIndex ]; - std::cerr << "TempoTrack::process(2): GW[0] == " << GW[0] << ", TTLoopIndex = " << TTLoopIndex << ", period from periodG = " << period << std::endl; +#ifdef DEBUG_TEMPO_TRACK + std::cerr << "TempoTrack::process: GW[0] == " << GW[0] << ", TTLoopIndex = " << TTLoopIndex << ", period from periodG = " << period << std::endl; +#endif if (period > 10000) { - std::cerr << "WARNING! Highly implausible period value!" << std::endl; + std::cerr << "TempoTrack::process: WARNING! Highly implausible period value " << period << "!" << std::endl; std::cerr << "periodG contains (of " << TTFrames << " frames): " << std::endl; for (int i = 0; i < TTLoopIndex + 3 && i < TTFrames; ++i) { std::cerr << i << " -> " << periodG[i] << std::endl; @@ -916,6 +822,7 @@ for (int i = 0; i < TTLoopIndex + 3 && i < TTFrames; ++i) { std::cerr << i << " -> " << periodP[i] << std::endl; } + period = 5168 / 120; } createPhaseExtractor( PW, m_winLength, period, FSP, lastBeat ); @@ -925,7 +832,9 @@ { period = periodP[ TTLoopIndex ]; - std::cerr << "TempoTrack::process(2): GW[0] == " << GW[0] << ", TTLoopIndex = " << TTLoopIndex << ", period from periodP = " << period << std::endl; +#ifdef DEBUG_TEMPO_TRACK + std::cerr << "TempoTrack::process: GW[0] == " << GW[0] << ", TTLoopIndex = " << TTLoopIndex << ", period from periodP = " << period << std::endl; +#endif createPhaseExtractor( PW, m_winLength, period, FSP, 0 ); } diff -r 4f1870dbab2c -r 38bf09927942 dsp/tempotracking/TempoTrack.h --- a/dsp/tempotracking/TempoTrack.h Thu Jul 24 16:09:25 2008 +0000 +++ b/dsp/tempotracking/TempoTrack.h Mon Nov 10 14:01:55 2008 +0000 @@ -48,7 +48,6 @@ virtual ~TempoTrack(); vector process( vector DF, vector *tempoReturn = 0); - vector process( double* DF, unsigned int length ); private: diff -r 4f1870dbab2c -r 38bf09927942 qm-dsp.pro --- a/qm-dsp.pro Thu Jul 24 16:09:25 2008 +0000 +++ b/qm-dsp.pro Mon Nov 10 14:01:55 2008 +0000 @@ -1,5 +1,5 @@ TEMPLATE = lib -CONFIG += warn_on staticlib release +CONFIG += warn_on staticlib debug CONFIG -= qt OBJECTS_DIR = tmp_obj MOC_DIR = tmp_moc