comparison 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
comparison
equal deleted inserted replaced
889:7f97a4d9d14f 892:451f7f3ab6e7
84 TimeToText50Frame, 84 TimeToText50Frame,
85 TimeToText60Frame 85 TimeToText60Frame
86 }; 86 };
87 TimeToTextMode getTimeToTextMode() const { return m_timeToTextMode; } 87 TimeToTextMode getTimeToTextMode() const { return m_timeToTextMode; }
88 88
89 int getOctaveOfMiddleC() const {
90 // weed out unsupported octaves
91 return getOctaveOfMiddleCInSystem(getSystemWithMiddleCInOctave(m_octave));
92 }
93 int getOctaveOfLowestMIDINote() const {
94 return getOctaveOfMiddleC() - 5;
95 }
96
89 bool getShowSplash() const { return m_showSplash; } 97 bool getShowSplash() const { return m_showSplash; }
90 98
91 public slots: 99 public slots:
92 virtual void setProperty(const PropertyName &, int); 100 virtual void setProperty(const PropertyName &, int);
93 101
100 void setOmitTempsFromRecentFiles(bool omit); 108 void setOmitTempsFromRecentFiles(bool omit);
101 void setTemporaryDirectoryRoot(QString tempDirRoot); 109 void setTemporaryDirectoryRoot(QString tempDirRoot);
102 void setResampleOnLoad(bool); 110 void setResampleOnLoad(bool);
103 void setBackgroundMode(BackgroundMode mode); 111 void setBackgroundMode(BackgroundMode mode);
104 void setTimeToTextMode(TimeToTextMode mode); 112 void setTimeToTextMode(TimeToTextMode mode);
113 void setOctaveOfMiddleC(int oct);
105 void setViewFontSize(int size); 114 void setViewFontSize(int size);
106 void setShowSplash(bool); 115 void setShowSplash(bool);
107 116
108 private: 117 private:
109 Preferences(); // may throw DirectoryCreationFailed 118 Preferences(); // may throw DirectoryCreationFailed
110 virtual ~Preferences(); 119 virtual ~Preferences();
111 120
112 static Preferences *m_instance; 121 static Preferences *m_instance;
122
123 // We don't support arbitrary octaves in the gui, because we want
124 // to be able to label what the octave system comes from. These
125 // are the ones we support. (But we save and load as octave
126 // numbers, so as not to make the prefs format really confusing)
127 enum OctaveNumberingSystem {
128 C0_Centre,
129 C3_Logic,
130 C4_ASA,
131 C5_Sonar
132 };
133 static int getOctaveOfMiddleCInSystem(OctaveNumberingSystem s);
134 static OctaveNumberingSystem getSystemWithMiddleCInOctave(int o);
113 135
114 SpectrogramSmoothing m_spectrogramSmoothing; 136 SpectrogramSmoothing m_spectrogramSmoothing;
115 SpectrogramXSmoothing m_spectrogramXSmoothing; 137 SpectrogramXSmoothing m_spectrogramXSmoothing;
116 float m_tuningFrequency; 138 float m_tuningFrequency;
117 PropertyBoxLayout m_propertyBoxLayout; 139 PropertyBoxLayout m_propertyBoxLayout;
121 QString m_tempDirRoot; 143 QString m_tempDirRoot;
122 bool m_resampleOnLoad; 144 bool m_resampleOnLoad;
123 int m_viewFontSize; 145 int m_viewFontSize;
124 BackgroundMode m_backgroundMode; 146 BackgroundMode m_backgroundMode;
125 TimeToTextMode m_timeToTextMode; 147 TimeToTextMode m_timeToTextMode;
148 int m_octave;
126 bool m_showSplash; 149 bool m_showSplash;
127 }; 150 };
128 151
129 #endif 152 #endif