# HG changeset patch # User Chris Cannam # Date 1152539689 0 # Node ID 853a7fc542d0762e1f7aab037959d55f9286430d # Parent 782142eaaa845fac9e1f937946ab5f5a03a50563 * fledgling preferences stuff diff -r 782142eaaa84 -r 853a7fc542d0 layer/SpectrogramLayer.cpp --- a/layer/SpectrogramLayer.cpp Fri Jul 07 11:22:32 2006 +0000 +++ b/layer/SpectrogramLayer.cpp Mon Jul 10 13:54:49 2006 +0000 @@ -20,6 +20,7 @@ #include "base/AudioLevel.h" #include "base/Window.h" #include "base/Pitch.h" +#include "base/Preferences.h" #include "fileio/FFTDataServer.h" #include @@ -1390,6 +1391,7 @@ //!!! tidy all this stuff if (m_binDisplay != AllBins) return 0; + if (!Preferences::getInstance()->getSmoothSpectrogram()) return 0; if (m_frequencyScale == LogFrequencyScale) return 3; int sr = m_model->getSampleRate(); @@ -1407,10 +1409,16 @@ if (minbin >= bins) minbin = bins - 1; } - if (v->height() / 1.5 > (bins - minbin) / (m_zeroPadLevel + 1)) { - return 3; + float perPixel = + float(v->height()) / + float((bins - minbin) / (m_zeroPadLevel + 1)); + + if (perPixel > 2.8) { + return 3; // 4x oversampling + } else if (perPixel > 1.5) { + return 1; // 2x } else { - return 0; + return 0; // 1x } }