diff src/Analyser.cpp @ 227:ae0bf8dc5833

Crude ability to adjust displayed frequency range
author Chris Cannam
date Tue, 11 Mar 2014 09:26:04 +0000
parents 9bdff8d10a86
children d40c6cdb30a4
line wrap: on
line diff
--- a/src/Analyser.cpp	Mon Mar 10 14:59:50 2014 +0000
+++ b/src/Analyser.cpp	Tue Mar 11 09:26:04 2014 +0000
@@ -116,19 +116,35 @@
     m_reAnalysingSelection = Selection();
 }
 
+bool
+Analyser::getDisplayFrequencyExtents(float &min, float &max)
+{
+    if (!m_layers[Spectrogram]) return false;
+    return m_layers[Spectrogram]->getDisplayExtents(min, max);
+}
+
+bool
+Analyser::setDisplayFrequencyExtents(float min, float max)
+{
+    if (!m_layers[Spectrogram]) return false;
+    m_layers[Spectrogram]->setDisplayExtents(min, max);
+}
+
 QString
 Analyser::addVisualisations()
 {
-/*
+    // A spectrogram, off by default. Must go at the back because it's
+    // opaque
+
+/* This is roughly what we'd do for a constant-Q spectrogram, but it
+   currently has issues with y-axis alignment
+  
     TransformFactory *tf = TransformFactory::getInstance();
 
     QString name = "Constant-Q";
     QString base = "vamp:cqvamp:cqvamp:";
     QString out = "constantq";
 
-    // A spectrogram, off by default. Must go at the back because it's
-    // opaque
-
     QString notFound = tr("Transform \"%1\" not found, spectrogram will not be enabled.<br><br>Is the %2 Vamp plugin correctly installed?");
     if (!tf->haveTransform(base + out)) {
 	return notFound.arg(base + out).arg(name);
@@ -149,9 +165,6 @@
 
     spectrogram->setColourMap((int)ColourMapper::BlackOnWhite);
     spectrogram->setNormalizeHybrid(true);
-//    spectrogram->setSmooth(true);
-//    spectrogram->setGain(0.5); //!!! arbitrary at this point
-    spectrogram->setMinFrequency(15);
     spectrogram->setGain(100);
     m_document->addLayerToView(m_pane, spectrogram);
     spectrogram->setLayerDormant(m_pane, true);