changeset 138:6332e41c1619

* Various experiments in spectrogram colour scaling, etc. Nothing final here yet, but some promising developments.
author Chris Cannam
date Fri, 14 Jul 2006 17:12:16 +0000
parents 0aafdda005ce
children 8ce30801f39a
files base/FFTCache.h base/Preferences.cpp base/Preferences.h
diffstat 3 files changed, 49 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/base/FFTCache.h	Wed Jul 12 14:15:46 2006 +0000
+++ b/base/FFTCache.h	Fri Jul 14 17:12:16 2006 +0000
@@ -34,6 +34,7 @@
 	
     virtual float getMagnitudeAt(size_t x, size_t y) const = 0;
     virtual float getNormalizedMagnitudeAt(size_t x, size_t y) const = 0;
+    virtual float getMaximumMagnitudeAt(size_t x) const = 0;
     virtual float getPhaseAt(size_t x, size_t y) const = 0;
 
     virtual void getValuesAt(size_t x, size_t y, float &real, float &imaginary) const = 0;
@@ -92,6 +93,10 @@
         return float(m_magnitude[x][y]) / 65535.0;
     }
     
+    virtual float getMaximumMagnitudeAt(size_t x) const {
+        return m_factor[x];
+    }
+    
     virtual float getPhaseAt(size_t x, size_t y) const {
         int16_t i = (int16_t)m_phase[x][y];
         return (float(i) / 32767.0) * M_PI;
--- a/base/Preferences.cpp	Wed Jul 12 14:15:46 2006 +0000
+++ b/base/Preferences.cpp	Fri Jul 14 17:12:16 2006 +0000
@@ -30,6 +30,7 @@
     PropertyList props;
     props.push_back("Smooth Spectrogram");
     props.push_back("Tuning Frequency");
+    props.push_back("Property Box Layout");
     return props;
 }
 
@@ -42,6 +43,9 @@
     if (name == "Tuning Frequency") {
         return tr("Tuning Frequency (concert A)");
     }
+    if (name == "Property Box Layout") {
+        return tr("Arrangement of Layer Properties");
+    }
     return name;
 }
 
@@ -54,6 +58,9 @@
     if (name == "Tuning Frequency") {
         return RangeProperty;
     }
+    if (name == "Property Box Layout") {
+        return ValueProperty;
+    }
     return InvalidProperty;
 }
 
@@ -69,6 +76,12 @@
 
     //!!! freq mapping
 
+    if (name == "Property Box Layout") {
+        if (min) *min = 0;
+        if (max) *max = 1;
+        return m_propertyBoxLayout == Layered ? 1 : 0;
+    }        
+
     return 0;
 }
 
@@ -76,7 +89,10 @@
 Preferences::getPropertyValueLabel(const PropertyName &name,
                                    int value) const
 {
-    //!!!
+    if (name == "Property Box Layout") {
+        if (value == 0) return tr("Vertically Stacked");
+        else return tr("Layered");
+    }
     return "";
 }
 
@@ -99,20 +115,35 @@
         setSmoothSpectrogram(value > 0.1);
     } else if (name == "Tuning Frequency") {
         //!!!
+    } else if (name == "Property Box Layout") {
+        setPropertyBoxLayout(value == 0 ? VerticallyStacked : Layered);
     }
 }
 
 void
 Preferences::setSmoothSpectrogram(bool smooth)
 {
-    m_smoothSpectrogram = smooth;
+    if (m_smoothSpectrogram != smooth) {
+        m_smoothSpectrogram = smooth;
 //!!!    emit 
+    }
 }
 
 void
 Preferences::setTuningFrequency(float freq)
 {
-    m_tuningFrequency = freq;
-    //!!! emit
+    if (m_tuningFrequency != freq) {
+        m_tuningFrequency = freq;
+        //!!! emit
+    }
 }
 
+void
+Preferences::setPropertyBoxLayout(PropertyBoxLayout layout)
+{
+    if (m_propertyBoxLayout != layout) {
+        m_propertyBoxLayout = layout;
+        //!!! emit
+    }
+}
+
--- a/base/Preferences.h	Wed Jul 12 14:15:46 2006 +0000
+++ b/base/Preferences.h	Fri Jul 14 17:12:16 2006 +0000
@@ -36,11 +36,19 @@
     bool getSmoothSpectrogram() const { return m_smoothSpectrogram; }
     float getTuningFrequency() const { return m_tuningFrequency; }
 
+    //!!! harmonise with PaneStack
+    enum PropertyBoxLayout {
+        VerticallyStacked,
+        Layered
+    };
+    PropertyBoxLayout getPropertyBoxLayout() const { return m_propertyBoxLayout; }
+
 public slots:
     virtual void setProperty(const PropertyName &, int);
 
     void setSmoothSpectrogram(bool smooth);
     void setTuningFrequency(float freq);
+    void setPropertyBoxLayout(PropertyBoxLayout layout);
 
 private:
     Preferences(); 
@@ -50,6 +58,7 @@
 
     bool m_smoothSpectrogram;
     float m_tuningFrequency;
+    PropertyBoxLayout m_propertyBoxLayout;
 };
 
 #endif