diff layer/SpectrumLayer.cpp @ 290:3101c68a00c1

* Restore Scale setting which had mistakenly disappeared from spectrum * Some tweaks to spectrum peaks * Make spectrum default to 4096/75%... or is that overdoing it? * Show harmonic cursor even during playback if in measure mode and mouse in relevant pane * Avoid crash when trying to measure a non-layer * Various adjustments to some icons to make them look better in white-on-black schemes
author Chris Cannam
date Fri, 13 Jul 2007 15:54:17 +0000
parents cd2492c5fe45
children c0b9eec70639
line wrap: on
line diff
--- a/layer/SpectrumLayer.cpp	Fri Jul 13 13:19:15 2007 +0000
+++ b/layer/SpectrumLayer.cpp	Fri Jul 13 15:54:17 2007 +0000
@@ -29,9 +29,9 @@
     m_originModel(0),
     m_channel(-1),
     m_channelSet(false),
-    m_windowSize(1024),
+    m_windowSize(4096),
     m_windowType(HanningWindow),
-    m_windowHopLevel(2),
+    m_windowHopLevel(3),
     m_showPeaks(false),
     m_newFFTNeeded(true)
 {
@@ -658,8 +658,13 @@
         paint.setRenderHint(QPainter::Antialiasing, false);
         paint.setPen(QColor(160, 160, 160)); //!!!
 
+        int peakminbin = 0;
+        int peakmaxbin = fft->getHeight() - 1;
+        float peakmaxfreq = Pitch::getFrequencyForPitch(128);
+        peakmaxbin = ((peakmaxfreq * fft->getHeight() * 2) / fft->getSampleRate());
+        
         FFTModel::PeakSet peaks = fft->getPeakFrequencies
-            (FFTModel::MajorPitchAdaptivePeaks, col);
+            (FFTModel::MajorPitchAdaptivePeaks, col, peakminbin, peakmaxbin);
 
         ColourMapper mapper(ColourMapper::BlackOnWhite, 0, 1);