changeset 115:c9930ec7a3f9

* Add fuzzy interpolation option as an alternative to zero padding in spectrogram (looks terrible though) * Make spectrogram appear more quickly by having the FFT server notify of updates more often near the start of its run
author Chris Cannam
date Mon, 05 Mar 2007 15:32:55 +0000
parents a46d68ae3c3e
children 99d65ba33c88
files main/PreferencesDialog.cpp main/PreferencesDialog.h
diffstat 2 files changed, 23 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/main/PreferencesDialog.cpp	Fri Mar 02 14:00:12 2007 +0000
+++ b/main/PreferencesDialog.cpp	Mon Mar 05 15:32:55 2007 +0000
@@ -58,17 +58,24 @@
     connect(m_windowTypeSelector, SIGNAL(windowTypeChanged(WindowType)),
             this, SLOT(windowTypeChanged(WindowType)));
 
-    QCheckBox *smoothing = new QCheckBox;
-    m_smoothSpectrogram = prefs->getSmoothSpectrogram();
-    smoothing->setCheckState(m_smoothSpectrogram ?
-                             Qt::Checked : Qt::Unchecked);
+    QComboBox *smoothing = new QComboBox;
+    
+    int sm = prefs->getPropertyRangeAndValue("Spectrogram Smoothing", &min, &max,
+                                             &deflt);
+    m_spectrogramSmoothing = sm;
 
-    connect(smoothing, SIGNAL(stateChanged(int)),
-            this, SLOT(smoothSpectrogramChanged(int)));
+    for (i = min; i <= max; ++i) {
+        smoothing->addItem(prefs->getPropertyValueLabel("Spectrogram Smoothing", i));
+    }
+
+    smoothing->setCurrentIndex(sm);
+
+    connect(smoothing, SIGNAL(currentIndexChanged(int)),
+            this, SLOT(spectrogramSmoothingChanged(int)));
 
     QComboBox *propertyLayout = new QComboBox;
     int pl = prefs->getPropertyRangeAndValue("Property Box Layout", &min, &max,
-                                             &deflt);
+                                         &deflt);
     m_propertyLayout = pl;
 
     for (i = min; i <= max; ++i) {
@@ -126,9 +133,9 @@
     subgrid->addWidget(resampleQuality, row++, 1, 1, 2);
 
     subgrid->addWidget(new QLabel(prefs->getPropertyLabel
-                                  ("Smooth Spectrogram")),
-                       row, 0, 1, 2);
-    subgrid->addWidget(smoothing, row++, 2);
+                                  ("Spectrogram Smoothing")),
+                       row, 0);
+    subgrid->addWidget(smoothing, row++, 1, 1, 2);
 
     subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
                                                 ("Window Type"))),
@@ -166,9 +173,9 @@
 }
 
 void
-PreferencesDialog::smoothSpectrogramChanged(int state)
+PreferencesDialog::spectrogramSmoothingChanged(int smoothing)
 {
-    m_smoothSpectrogram = (state == Qt::Checked);
+    m_spectrogramSmoothing = smoothing;
     m_applyButton->setEnabled(true);
 }
 
@@ -205,7 +212,8 @@
 {
     Preferences *prefs = Preferences::getInstance();
     prefs->setWindowType(WindowType(m_windowType));
-    prefs->setSmoothSpectrogram(m_smoothSpectrogram);
+    prefs->setSpectrogramSmoothing(Preferences::SpectrogramSmoothing
+                                   (m_spectrogramSmoothing));
     prefs->setPropertyBoxLayout(Preferences::PropertyBoxLayout
                                 (m_propertyLayout));
     prefs->setTuningFrequency(m_tuningFrequency);
--- a/main/PreferencesDialog.h	Fri Mar 02 14:00:12 2007 +0000
+++ b/main/PreferencesDialog.h	Mon Mar 05 15:32:55 2007 +0000
@@ -33,7 +33,7 @@
 
 protected slots:
     void windowTypeChanged(WindowType type);
-    void smoothSpectrogramChanged(int state);
+    void spectrogramSmoothingChanged(int state);
     void propertyLayoutChanged(int layout);
     void tuningFrequencyChanged(double freq);
     void resampleQualityChanged(int quality);
@@ -47,7 +47,7 @@
     QPushButton *m_applyButton;
     
     WindowType m_windowType;
-    bool  m_smoothSpectrogram;
+    int   m_spectrogramSmoothing;
     int   m_propertyLayout;
     float m_tuningFrequency;
     int   m_resampleQuality;