diff layer/SpectrogramLayer.cpp @ 1382:2df1af7ac752 spectrogramparam

Add oversampling option to spectrum as well
author Chris Cannam
date Wed, 07 Nov 2018 11:37:51 +0000
parents b6cca362bbf4
children ba1f0234efa7
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp	Tue Nov 06 15:42:35 2018 +0000
+++ b/layer/SpectrogramLayer.cpp	Wed Nov 07 11:37:51 2018 +0000
@@ -741,13 +741,9 @@
 SpectrogramLayer::setWindowSize(int ws)
 {
     if (m_windowSize == ws) return;
-
     invalidateRenderers();
-    
     m_windowSize = ws;
-    
     recreateFFTModel();
-
     emit layerParametersChanged();
 }
 
@@ -761,13 +757,9 @@
 SpectrogramLayer::setWindowHopLevel(int v)
 {
     if (m_windowHopLevel == v) return;
-
     invalidateRenderers();
-    
     m_windowHopLevel = v;
-    
     recreateFFTModel();
-
     emit layerParametersChanged();
 }
 
@@ -2538,11 +2530,13 @@
     s += QString("channel=\"%1\" "
                  "windowSize=\"%2\" "
                  "windowHopLevel=\"%3\" "
-                 "gain=\"%4\" "
-                 "threshold=\"%5\" ")
+                 "oversampling=\"%4\" "
+                 "gain=\"%5\" "
+                 "threshold=\"%6\" ")
         .arg(m_channel)
         .arg(m_windowSize)
         .arg(m_windowHopLevel)
+        .arg(m_oversampling)
         .arg(m_gain)
         .arg(m_threshold);
 
@@ -2621,6 +2615,9 @@
         }
     }
 
+    int oversampling = attributes.value("oversampling").toUInt(&ok);
+    if (ok) setOversampling(oversampling);
+
     float gain = attributes.value("gain").toFloat(&ok);
     if (ok) setGain(gain);