# HG changeset patch # User Chris Cannam # Date 1151502072 0 # Node ID ab55c427e068d357915a1ef44e04e62a308c04ae # Parent f262aa8973e30685985037dd9c819c3e0c8bcb5f * Split large FFT caches up into several files. Ongoing. diff -r f262aa8973e3 -r ab55c427e068 layer/SpectrogramLayer.cpp --- a/layer/SpectrogramLayer.cpp Tue Jun 27 19:18:42 2006 +0000 +++ b/layer/SpectrogramLayer.cpp Wed Jun 28 13:41:12 2006 +0000 @@ -166,7 +166,7 @@ list.push_back("Min Frequency"); list.push_back("Max Frequency"); list.push_back("Frequency Scale"); - list.push_back("Zero Padding"); +// list.push_back("Zero Padding"); return list; } @@ -1631,7 +1631,7 @@ bins = int((double(m_maxFrequency) * m_fftSize) / sr + 0.1); if (bins > m_fftSize / 2) bins = m_fftSize / 2; } - + size_t minbin = 1; if (m_minFrequency > 0) { minbin = int((double(m_minFrequency) * m_fftSize) / sr + 0.1); @@ -1639,6 +1639,19 @@ if (minbin >= bins) minbin = bins - 1; } + //!!! quite wrong and won't work for layers that may be in more than one view + if (v->height() > (bins - minbin) / (m_zeroPadLevel + 1)) { + if (m_zeroPadLevel != 3) { + ((SpectrogramLayer *)this)->setZeroPadLevel(3); + return; + } + } else { + if (m_zeroPadLevel != 0) { + ((SpectrogramLayer *)this)->setZeroPadLevel(0); + return; + } + } + float minFreq = (float(minbin) * sr) / m_fftSize; float maxFreq = (float(bins) * sr) / m_fftSize;