comparison examples/FixedTempoEstimator.cpp @ 502:d129bf797f24

Avoid buffer underflow
author Chris Cannam
date Tue, 30 Jan 2018 15:28:15 +0000
parents 7d59dd1ba5de
children
comparison
equal deleted inserted replaced
500:4a86f866bb6b 502:d129bf797f24
527 527
528 std::map<float, int> candidates; 528 std::map<float, int> candidates;
529 529
530 for (int i = p0; i <= p1 && i+1 < n/2; ++i) { 530 for (int i = p0; i <= p1 && i+1 < n/2; ++i) {
531 531
532 if (i < 1) continue;
533
532 if (m_fr[i] > m_fr[i-1] && 534 if (m_fr[i] > m_fr[i-1] &&
533 m_fr[i] > m_fr[i+1]) { 535 m_fr[i] > m_fr[i+1]) {
534 536
535 // This is a peak in the filtered autocorrelation: stick 537 // This is a peak in the filtered autocorrelation: stick
536 // it into the map from filtered autocorrelation to lag 538 // it into the map from filtered autocorrelation to lag