# HG changeset patch # User Chris Cannam # Date 1412004016 -3600 # Node ID cb79f27f0748e575d9a5cee26b3ccc79cfd9b101 # Parent eafb3a7f80fb7193da898a8521abd0658bb128e1 Clamp cyclic tempogram min and max BPM to the BPM equivalents of the actual underlying min and max tempogram bins, rather than the "input" min and max BPM (fixed root cause of #1054) diff -r eafb3a7f80fb -r cb79f27f0748 TempogramPlugin.cpp --- a/TempogramPlugin.cpp Mon Sep 29 16:19:12 2014 +0100 +++ b/TempogramPlugin.cpp Mon Sep 29 16:20:16 2014 +0100 @@ -556,15 +556,23 @@ { vector< vector > logBins; + cerr << "calculateTempogramNearestNeighbourLogBins: octaves = " + << m_cyclicTempogramNumberOfOctaves << endl; + for (int octave = 0; octave < (int)m_cyclicTempogramNumberOfOctaves; octave++){ vector octaveBins; - + + cerr << "octave " << octave << ":" << endl; + for (int bin = 0; bin < (int)m_cyclicTempogramOctaveDivider; bin++){ float bpm = m_cyclicTempogramMinBPM*pow(2.0f, octave+(float)bin/m_cyclicTempogramOctaveDivider); octaveBins.push_back(bpmToBin(bpm)); + cerr << bpmToBin(bpm) << " "; //cout << octaveBins.back() << endl; } + cerr << endl; logBins.push_back(octaveBins); + } return logBins; @@ -648,8 +656,13 @@ return false; } - m_cyclicTempogramMinBPM = m_tempogramMinBPM; - float cyclicTempogramMaxBPM = m_tempogramMaxBPM; + m_cyclicTempogramMinBPM = max(binToBPM(m_tempogramMinBin), m_tempogramMinBPM); + float cyclicTempogramMaxBPM = min(binToBPM(m_tempogramMaxBin), m_tempogramMaxBPM); + + cerr << "tempogram min bpm = " << m_tempogramMinBPM << ", cyclic min = " + << m_cyclicTempogramMinBPM << endl; + cerr << "tempogram max bpm = " << m_tempogramMaxBPM << ", cyclic max = " + << cyclicTempogramMaxBPM << endl; m_cyclicTempogramNumberOfOctaves = floor(log2(cyclicTempogramMaxBPM/m_cyclicTempogramMinBPM));