Chris@136
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@136
|
2
|
Chris@136
|
3 /*
|
Chris@136
|
4 Sonic Visualiser
|
Chris@136
|
5 An audio file viewer and annotation editor.
|
Chris@136
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@202
|
7 This file copyright 2006 Chris Cannam and QMUL.
|
Chris@136
|
8
|
Chris@136
|
9 This program is free software; you can redistribute it and/or
|
Chris@136
|
10 modify it under the terms of the GNU General Public License as
|
Chris@136
|
11 published by the Free Software Foundation; either version 2 of the
|
Chris@136
|
12 License, or (at your option) any later version. See the file
|
Chris@136
|
13 COPYING included with this distribution for more information.
|
Chris@136
|
14 */
|
Chris@136
|
15
|
Chris@1581
|
16 #ifndef SV_PREFERENCES_H
|
Chris@1581
|
17 #define SV_PREFERENCES_H
|
Chris@136
|
18
|
Chris@136
|
19 #include "PropertyContainer.h"
|
Chris@136
|
20
|
Chris@140
|
21 #include "Window.h"
|
Chris@140
|
22
|
Chris@136
|
23 class Preferences : public PropertyContainer
|
Chris@136
|
24 {
|
Chris@136
|
25 Q_OBJECT
|
Chris@136
|
26
|
Chris@136
|
27 public:
|
Chris@156
|
28 static Preferences *getInstance();
|
Chris@136
|
29
|
Chris@1580
|
30 PropertyList getProperties() const override;
|
Chris@1580
|
31 QString getPropertyLabel(const PropertyName &) const override;
|
Chris@1580
|
32 PropertyType getPropertyType(const PropertyName &) const override;
|
Chris@1580
|
33 int getPropertyRangeAndValue(const PropertyName &, int *, int *, int *) const override;
|
Chris@1580
|
34 QString getPropertyValueLabel(const PropertyName &, int value) const override;
|
Chris@1580
|
35 QString getPropertyContainerName() const override;
|
Chris@1580
|
36 QString getPropertyContainerIconName() const override;
|
Chris@136
|
37
|
Chris@246
|
38 enum SpectrogramSmoothing {
|
Chris@246
|
39 NoSpectrogramSmoothing,
|
Chris@1578
|
40 SpectrogramInterpolated
|
Chris@246
|
41 };
|
Chris@246
|
42
|
Chris@553
|
43 enum SpectrogramXSmoothing {
|
Chris@553
|
44 NoSpectrogramXSmoothing,
|
Chris@553
|
45 SpectrogramXInterpolated
|
Chris@553
|
46 };
|
Chris@553
|
47
|
Chris@246
|
48 SpectrogramSmoothing getSpectrogramSmoothing() const { return m_spectrogramSmoothing; }
|
Chris@553
|
49 SpectrogramXSmoothing getSpectrogramXSmoothing() const { return m_spectrogramXSmoothing; }
|
Chris@1038
|
50 double getTuningFrequency() const { return m_tuningFrequency; }
|
Chris@140
|
51 WindowType getWindowType() const { return m_windowType; }
|
Chris@136
|
52
|
Chris@1225
|
53 bool getRunPluginsInProcess() const { return m_runPluginsInProcess; }
|
Chris@1225
|
54
|
Chris@138
|
55 //!!! harmonise with PaneStack
|
Chris@138
|
56 enum PropertyBoxLayout {
|
Chris@138
|
57 VerticallyStacked,
|
Chris@138
|
58 Layered
|
Chris@138
|
59 };
|
Chris@138
|
60 PropertyBoxLayout getPropertyBoxLayout() const { return m_propertyBoxLayout; }
|
Chris@138
|
61
|
Chris@354
|
62 int getViewFontSize() const { return m_viewFontSize; }
|
Chris@354
|
63
|
Chris@277
|
64 bool getOmitTempsFromRecentFiles() const { return m_omitRecentTemps; }
|
Chris@277
|
65
|
Chris@297
|
66 QString getTemporaryDirectoryRoot() const { return m_tempDirRoot; }
|
Chris@297
|
67
|
Chris@1868
|
68 /// True if we should always mix down recorded audio to a single
|
Chris@1868
|
69 /// channel regardless of how many channels the device opens
|
Chris@1868
|
70 bool getRecordMono() const { return m_recordMono; }
|
Chris@1868
|
71
|
Chris@919
|
72 /// If we should always resample audio to the same rate, return it; otherwise (the normal case) return 0
|
Chris@1047
|
73 sv_samplerate_t getFixedSampleRate() const { return m_fixedSampleRate; }
|
Chris@919
|
74
|
Chris@919
|
75 /// True if we should resample second or subsequent audio file to match first audio file's rate
|
Chris@1313
|
76 bool getResampleOnLoad() const { return m_resampleOnLoad; }
|
Chris@1313
|
77
|
Chris@1313
|
78 /// True if mp3 files should be loaded "gaplessly", i.e. compensating for encoder/decoder delay and padding
|
Chris@1313
|
79 bool getUseGaplessMode() const { return m_gapless; }
|
Chris@297
|
80
|
Chris@921
|
81 /// True if audio files should be loaded with normalisation (max == 1)
|
Chris@921
|
82 bool getNormaliseAudio() const { return m_normaliseAudio; }
|
Chris@921
|
83
|
Chris@297
|
84 enum BackgroundMode {
|
Chris@297
|
85 BackgroundFromTheme,
|
Chris@297
|
86 DarkBackground,
|
Chris@297
|
87 LightBackground
|
Chris@297
|
88 };
|
Chris@297
|
89 BackgroundMode getBackgroundMode() const { return m_backgroundMode; }
|
Chris@297
|
90
|
Chris@612
|
91 enum TimeToTextMode {
|
Chris@612
|
92 TimeToTextMs,
|
Chris@612
|
93 TimeToTextUs,
|
Chris@612
|
94 TimeToText24Frame,
|
Chris@612
|
95 TimeToText25Frame,
|
Chris@612
|
96 TimeToText30Frame,
|
Chris@612
|
97 TimeToText50Frame,
|
Chris@612
|
98 TimeToText60Frame
|
Chris@612
|
99 };
|
Chris@612
|
100 TimeToTextMode getTimeToTextMode() const { return m_timeToTextMode; }
|
Chris@612
|
101
|
Chris@1031
|
102 bool getShowHMS() const { return m_showHMS; }
|
Chris@1031
|
103
|
Chris@892
|
104 int getOctaveOfMiddleC() const {
|
Chris@892
|
105 // weed out unsupported octaves
|
Chris@892
|
106 return getOctaveOfMiddleCInSystem(getSystemWithMiddleCInOctave(m_octave));
|
Chris@892
|
107 }
|
Chris@892
|
108 int getOctaveOfLowestMIDINote() const {
|
Chris@892
|
109 return getOctaveOfMiddleC() - 5;
|
Chris@892
|
110 }
|
Chris@892
|
111
|
Chris@372
|
112 bool getShowSplash() const { return m_showSplash; }
|
Chris@372
|
113
|
Chris@136
|
114 public slots:
|
Chris@1580
|
115 void setProperty(const PropertyName &, int) override;
|
Chris@136
|
116
|
Chris@246
|
117 void setSpectrogramSmoothing(SpectrogramSmoothing smoothing);
|
Chris@553
|
118 void setSpectrogramXSmoothing(SpectrogramXSmoothing smoothing);
|
Chris@1038
|
119 void setTuningFrequency(double freq);
|
Chris@138
|
120 void setPropertyBoxLayout(PropertyBoxLayout layout);
|
Chris@140
|
121 void setWindowType(WindowType type);
|
Chris@1225
|
122 void setRunPluginsInProcess(bool r);
|
Chris@277
|
123 void setOmitTempsFromRecentFiles(bool omit);
|
Chris@297
|
124 void setTemporaryDirectoryRoot(QString tempDirRoot);
|
Chris@1047
|
125 void setFixedSampleRate(sv_samplerate_t);
|
Chris@1868
|
126 void setRecordMono(bool);
|
Chris@297
|
127 void setResampleOnLoad(bool);
|
Chris@1313
|
128 void setUseGaplessMode(bool);
|
Chris@921
|
129 void setNormaliseAudio(bool);
|
Chris@297
|
130 void setBackgroundMode(BackgroundMode mode);
|
Chris@612
|
131 void setTimeToTextMode(TimeToTextMode mode);
|
Chris@1031
|
132 void setShowHMS(bool show);
|
Chris@892
|
133 void setOctaveOfMiddleC(int oct);
|
Chris@354
|
134 void setViewFontSize(int size);
|
Chris@372
|
135 void setShowSplash(bool);
|
Chris@136
|
136
|
Chris@136
|
137 private:
|
Chris@145
|
138 Preferences(); // may throw DirectoryCreationFailed
|
Chris@145
|
139 virtual ~Preferences();
|
Chris@136
|
140
|
Chris@136
|
141 static Preferences *m_instance;
|
Chris@136
|
142
|
Chris@892
|
143 // We don't support arbitrary octaves in the gui, because we want
|
Chris@892
|
144 // to be able to label what the octave system comes from. These
|
Chris@892
|
145 // are the ones we support. (But we save and load as octave
|
Chris@892
|
146 // numbers, so as not to make the prefs format really confusing)
|
Chris@892
|
147 enum OctaveNumberingSystem {
|
Chris@892
|
148 C0_Centre,
|
Chris@892
|
149 C3_Logic,
|
Chris@892
|
150 C4_ASA,
|
Chris@892
|
151 C5_Sonar
|
Chris@892
|
152 };
|
Chris@892
|
153 static int getOctaveOfMiddleCInSystem(OctaveNumberingSystem s);
|
Chris@892
|
154 static OctaveNumberingSystem getSystemWithMiddleCInOctave(int o);
|
Chris@892
|
155
|
Chris@246
|
156 SpectrogramSmoothing m_spectrogramSmoothing;
|
Chris@553
|
157 SpectrogramXSmoothing m_spectrogramXSmoothing;
|
Chris@1038
|
158 double m_tuningFrequency;
|
Chris@138
|
159 PropertyBoxLayout m_propertyBoxLayout;
|
Chris@140
|
160 WindowType m_windowType;
|
Chris@1225
|
161 bool m_runPluginsInProcess;
|
Chris@277
|
162 bool m_omitRecentTemps;
|
Chris@297
|
163 QString m_tempDirRoot;
|
Chris@1047
|
164 sv_samplerate_t m_fixedSampleRate;
|
Chris@1868
|
165 bool m_recordMono;
|
Chris@297
|
166 bool m_resampleOnLoad;
|
Chris@1313
|
167 bool m_gapless;
|
Chris@921
|
168 bool m_normaliseAudio;
|
Chris@354
|
169 int m_viewFontSize;
|
Chris@297
|
170 BackgroundMode m_backgroundMode;
|
Chris@612
|
171 TimeToTextMode m_timeToTextMode;
|
Chris@1031
|
172 bool m_showHMS;
|
Chris@892
|
173 int m_octave;
|
Chris@372
|
174 bool m_showSplash;
|
Chris@136
|
175 };
|
Chris@136
|
176
|
Chris@136
|
177 #endif
|