diff layer/SpectrogramLayer.cpp @ 101:0f36cdf407a6 sv1-v0.9rc1

* Make vertical scale alignment modes work in note layer as well as time-value layer, and several significant fixes to it * Make it possible to draw notes properly on the note layer * Show units (and frequencies etc in note layer's case) in the time-value and note layer description boxes * Minor fix to item edit dialog layout * Some minor menu rearrangement * Comment out a lot of debug output * Add SV website and reference URLs to Help menu, and add code to (attempt to) open them in the user's preferred browser
author Chris Cannam
date Fri, 12 May 2006 14:40:43 +0000
parents a0e7edf9703a
children 8ce53683d0d7
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp	Thu May 11 15:02:14 2006 +0000
+++ b/layer/SpectrogramLayer.cpp	Fri May 12 14:40:43 2006 +0000
@@ -34,7 +34,7 @@
 #include <cassert>
 #include <cmath>
 
-#define DEBUG_SPECTROGRAM_REPAINT 1
+//#define DEBUG_SPECTROGRAM_REPAINT 1
 
 static double mod(double x, double y)
 {
@@ -111,7 +111,7 @@
 void
 SpectrogramLayer::setModel(const DenseTimeValueModel *model)
 {
-    std::cerr << "SpectrogramLayer(" << this << "): setModel(" << model << ")" << std::endl;
+//    std::cerr << "SpectrogramLayer(" << this << "): setModel(" << model << ")" << std::endl;
 
     m_mutex.lock();
     m_cacheInvalid = true;
@@ -637,8 +637,8 @@
 void
 SpectrogramLayer::setGain(float gain)
 {
-    std::cerr << "SpectrogramLayer::setGain(" << gain << ") (my gain is now "
-	      << m_gain << ")" << std::endl;
+//    std::cerr << "SpectrogramLayer::setGain(" << gain << ") (my gain is now "
+//	      << m_gain << ")" << std::endl;
 
     if (m_gain == gain) return;
 
@@ -1292,18 +1292,18 @@
 	    m_fillExtent = 0;
 	    m_fillCompletion = 0;
 
-	    std::cerr << "SpectrogramLayer::CacheFillThread::run: model is ready" << std::endl;
+	//    std::cerr << "SpectrogramLayer::CacheFillThread::run: model is ready" << std::endl;
 
 	    size_t start = m_layer.m_model->getStartFrame();
 	    size_t end = m_layer.m_model->getEndFrame();
 
-	    std::cerr << "start = " << start << ", end = " << end << std::endl;
+	//    std::cerr << "start = " << start << ", end = " << end << std::endl;
 
 	    WindowType windowType = m_layer.m_windowType;
 	    size_t windowSize = m_layer.m_windowSize;
 	    size_t windowIncrement = m_layer.getWindowIncrement();
 
-            std::cerr << "\nWINDOW INCREMENT: " << windowIncrement << " (for hop level " << m_layer.m_windowHopLevel << ")\n" << std::endl;
+        //    std::cerr << "\nWINDOW INCREMENT: " << windowIncrement << " (for hop level " << m_layer.m_windowHopLevel << ")\n" << std::endl;
 
 	    size_t visibleStart = m_layer.m_candidateFillStartFrame;
 	    visibleStart = (visibleStart / windowIncrement) * windowIncrement;
@@ -2174,15 +2174,25 @@
 }
 
 bool
-SpectrogramLayer::getValueExtents(float &min, float &max, QString &unit) const
+SpectrogramLayer::getValueExtents(float &min, float &max,
+                                  bool &logarithmic, QString &unit) const
 {
     min = getEffectiveMinFrequency();
     max = getEffectiveMaxFrequency();
+    logarithmic = (m_frequencyScale == LogFrequencyScale);
     unit = "Hz";
     return true;
 }
 
 bool
+SpectrogramLayer::getDisplayExtents(float &min, float &max) const
+{
+    min = getEffectiveMinFrequency();
+    max = getEffectiveMaxFrequency();
+    return true;
+}    
+
+bool
 SpectrogramLayer::snapToFeatureFrame(View *v, int &frame,
 				     size_t &resolution,
 				     SnapType snap) const