diff base/Preferences.h @ 892:451f7f3ab6e7

Make octave numbering configurable, and change default to C4 = middle C
author Chris Cannam
date Thu, 27 Mar 2014 13:32:56 +0000
parents 75f154085a4d
children 4c7b4040bd2d
line wrap: on
line diff
--- a/base/Preferences.h	Tue Mar 11 17:29:44 2014 +0000
+++ b/base/Preferences.h	Thu Mar 27 13:32:56 2014 +0000
@@ -86,6 +86,14 @@
     };
     TimeToTextMode getTimeToTextMode() const { return m_timeToTextMode; }
 
+    int getOctaveOfMiddleC() const {
+        // weed out unsupported octaves
+        return getOctaveOfMiddleCInSystem(getSystemWithMiddleCInOctave(m_octave));
+    }
+    int getOctaveOfLowestMIDINote() const {
+        return getOctaveOfMiddleC() - 5;
+    }
+    
     bool getShowSplash() const { return m_showSplash; }
 
 public slots:
@@ -102,6 +110,7 @@
     void setResampleOnLoad(bool);
     void setBackgroundMode(BackgroundMode mode);
     void setTimeToTextMode(TimeToTextMode mode);
+    void setOctaveOfMiddleC(int oct);
     void setViewFontSize(int size);
     void setShowSplash(bool);
 
@@ -111,6 +120,19 @@
 
     static Preferences *m_instance;
 
+    // We don't support arbitrary octaves in the gui, because we want
+    // to be able to label what the octave system comes from. These
+    // are the ones we support. (But we save and load as octave
+    // numbers, so as not to make the prefs format really confusing)
+    enum OctaveNumberingSystem {
+        C0_Centre,
+        C3_Logic,
+        C4_ASA,
+        C5_Sonar
+    };
+    static int getOctaveOfMiddleCInSystem(OctaveNumberingSystem s);
+    static OctaveNumberingSystem getSystemWithMiddleCInOctave(int o);
+
     SpectrogramSmoothing m_spectrogramSmoothing;
     SpectrogramXSmoothing m_spectrogramXSmoothing;
     float m_tuningFrequency;
@@ -123,6 +145,7 @@
     int m_viewFontSize;
     BackgroundMode m_backgroundMode;
     TimeToTextMode m_timeToTextMode;
+    int m_octave;
     bool m_showSplash;
 };