changeset 299:15ce557e1bf8

* Restore (better quality) y-axis interpolation in spectrogram * Make spectrogram x axis interpolation a preference
author Chris Cannam
date Fri, 06 Feb 2009 15:06:23 +0000
parents 7872a95ee530
children f68506fccb62
files main/PreferencesDialog.cpp main/PreferencesDialog.h
diffstat 2 files changed, 34 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/main/PreferencesDialog.cpp	Thu Feb 05 17:33:21 2009 +0000
+++ b/main/PreferencesDialog.cpp	Fri Feb 06 15:06:23 2009 +0000
@@ -74,12 +74,12 @@
 
     QComboBox *smoothing = new QComboBox;
     
-    int sm = prefs->getPropertyRangeAndValue("Spectrogram Smoothing", &min, &max,
+    int sm = prefs->getPropertyRangeAndValue("Spectrogram Y Smoothing", &min, &max,
                                              &deflt);
     m_spectrogramSmoothing = sm;
 
     for (i = min; i <= max; ++i) {
-        smoothing->addItem(prefs->getPropertyValueLabel("Spectrogram Smoothing", i));
+        smoothing->addItem(prefs->getPropertyValueLabel("Spectrogram Y Smoothing", i));
     }
 
     smoothing->setCurrentIndex(sm);
@@ -87,6 +87,21 @@
     connect(smoothing, SIGNAL(currentIndexChanged(int)),
             this, SLOT(spectrogramSmoothingChanged(int)));
 
+    QComboBox *xsmoothing = new QComboBox;
+    
+    int xsm = prefs->getPropertyRangeAndValue("Spectrogram X Smoothing", &min, &max,
+                                             &deflt);
+    m_spectrogramXSmoothing = xsm;
+
+    for (i = min; i <= max; ++i) {
+        xsmoothing->addItem(prefs->getPropertyValueLabel("Spectrogram X Smoothing", i));
+    }
+
+    xsmoothing->setCurrentIndex(xsm);
+
+    connect(xsmoothing, SIGNAL(currentIndexChanged(int)),
+            this, SLOT(spectrogramXSmoothingChanged(int)));
+
     QComboBox *propertyLayout = new QComboBox;
     int pl = prefs->getPropertyRangeAndValue("Property Box Layout", &min, &max,
                                          &deflt);
@@ -278,10 +293,15 @@
     subgrid->addWidget(frequency, row++, 1, 1, 2);
 
     subgrid->addWidget(new QLabel(prefs->getPropertyLabel
-                                  ("Spectrogram Smoothing")),
+                                  ("Spectrogram Y Smoothing")),
                        row, 0);
     subgrid->addWidget(smoothing, row++, 1, 1, 2);
 
+    subgrid->addWidget(new QLabel(prefs->getPropertyLabel
+                                  ("Spectrogram X Smoothing")),
+                       row, 0);
+    subgrid->addWidget(xsmoothing, row++, 1, 1, 2);
+
     subgrid->addWidget(new QLabel(tr("%1:").arg(prefs->getPropertyLabel
                                                 ("Window Type"))),
                        row, 0);
@@ -328,6 +348,13 @@
 }
 
 void
+PreferencesDialog::spectrogramXSmoothingChanged(int smoothing)
+{
+    m_spectrogramXSmoothing = smoothing;
+    m_applyButton->setEnabled(true);
+}
+
+void
 PreferencesDialog::propertyLayoutChanged(int layout)
 {
     m_propertyLayout = layout;
@@ -420,6 +447,8 @@
     prefs->setWindowType(WindowType(m_windowType));
     prefs->setSpectrogramSmoothing(Preferences::SpectrogramSmoothing
                                    (m_spectrogramSmoothing));
+    prefs->setSpectrogramXSmoothing(Preferences::SpectrogramXSmoothing
+                                   (m_spectrogramXSmoothing));
     prefs->setPropertyBoxLayout(Preferences::PropertyBoxLayout
                                 (m_propertyLayout));
     prefs->setTuningFrequency(m_tuningFrequency);
--- a/main/PreferencesDialog.h	Thu Feb 05 17:33:21 2009 +0000
+++ b/main/PreferencesDialog.h	Fri Feb 06 15:06:23 2009 +0000
@@ -38,6 +38,7 @@
 protected slots:
     void windowTypeChanged(WindowType type);
     void spectrogramSmoothingChanged(int state);
+    void spectrogramXSmoothingChanged(int state);
     void propertyLayoutChanged(int layout);
     void tuningFrequencyChanged(double freq);
     void audioDeviceChanged(int device);
@@ -62,6 +63,7 @@
     
     WindowType m_windowType;
     int m_spectrogramSmoothing;
+    int m_spectrogramXSmoothing;
     int m_propertyLayout;
     float m_tuningFrequency;
     int m_audioDevice;