comparison TempogramPlugin.cpp @ 45:e6a43500629b

I think that the tempogram max lag can't exceed the window length - 1, rather than the window length, because it is used as an index into a vector of the window length
author Chris Cannam
date Thu, 25 Sep 2014 18:42:35 +0100
parents a908a5a56267
children eafb3a7f80fb
comparison
equal deleted inserted replaced
44:a908a5a56267 45:e6a43500629b
633 << ": can't proceed, failing initialise" << endl; 633 << ": can't proceed, failing initialise" << endl;
634 return false; 634 return false;
635 } 635 }
636 636
637 m_tempogramMinLag = max((int)ceil((60/(m_inputStepSize * m_tempogramMaxBPM))*m_inputSampleRate), 0); 637 m_tempogramMinLag = max((int)ceil((60/(m_inputStepSize * m_tempogramMaxBPM))*m_inputSampleRate), 0);
638 m_tempogramMaxLag = min((int)floor((60/(m_inputStepSize * m_tempogramMinBPM))*m_inputSampleRate), (int)m_tempogramWindowLength); 638 m_tempogramMaxLag = min((int)floor((60/(m_inputStepSize * m_tempogramMinBPM))*m_inputSampleRate), (int)m_tempogramWindowLength-1);
639 639
640 if (m_tempogramMaxLag < m_tempogramMinLag) { 640 if (m_tempogramMaxLag < m_tempogramMinLag) {
641 cerr << "At audio sample rate " << m_inputSampleRate 641 cerr << "At audio sample rate " << m_inputSampleRate
642 << ", tempogram sample rate " << tempogramInputSampleRate 642 << ", tempogram sample rate " << tempogramInputSampleRate
643 << ", window length " << m_tempogramWindowLength 643 << ", window length " << m_tempogramWindowLength