Preferences.h
Go to the documentation of this file.
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 
3 /*
4  Sonic Visualiser
5  An audio file viewer and annotation editor.
6  Centre for Digital Music, Queen Mary, University of London.
7  This file copyright 2006 Chris Cannam and QMUL.
8 
9  This program is free software; you can redistribute it and/or
10  modify it under the terms of the GNU General Public License as
11  published by the Free Software Foundation; either version 2 of the
12  License, or (at your option) any later version. See the file
13  COPYING included with this distribution for more information.
14 */
15 
16 #ifndef SV_PREFERENCES_H
17 #define SV_PREFERENCES_H
18 
19 #include "PropertyContainer.h"
20 
21 #include "Window.h"
22 
24 {
25  Q_OBJECT
26 
27 public:
28  static Preferences *getInstance();
29 
30  PropertyList getProperties() const override;
31  QString getPropertyLabel(const PropertyName &) const override;
32  PropertyType getPropertyType(const PropertyName &) const override;
33  int getPropertyRangeAndValue(const PropertyName &, int *, int *, int *) const override;
34  QString getPropertyValueLabel(const PropertyName &, int value) const override;
35  QString getPropertyContainerName() const override;
36  QString getPropertyContainerIconName() const override;
37 
41  };
42 
46  };
47 
50  double getTuningFrequency() const { return m_tuningFrequency; }
52 
54 
59  };
61 
62  int getViewFontSize() const { return m_viewFontSize; }
63 
65 
66  QString getTemporaryDirectoryRoot() const { return m_tempDirRoot; }
67 
70  bool getRecordMono() const { return m_recordMono; }
71 
74 
76  bool getResampleOnLoad() const { return m_resampleOnLoad; }
77 
79  bool getUseGaplessMode() const { return m_gapless; }
80 
82  bool getNormaliseAudio() const { return m_normaliseAudio; }
83 
88  };
90 
99  };
101 
102  bool getShowHMS() const { return m_showHMS; }
103 
104  int getOctaveOfMiddleC() const {
105  // weed out unsupported octaves
107  }
109  return getOctaveOfMiddleC() - 5;
110  }
111 
112  bool getShowSplash() const { return m_showSplash; }
113 
114 public slots:
115  void setProperty(const PropertyName &, int) override;
116 
119  void setTuningFrequency(double freq);
121  void setWindowType(WindowType type);
122  void setRunPluginsInProcess(bool r);
123  void setOmitTempsFromRecentFiles(bool omit);
124  void setTemporaryDirectoryRoot(QString tempDirRoot);
126  void setRecordMono(bool);
127  void setResampleOnLoad(bool);
128  void setUseGaplessMode(bool);
129  void setNormaliseAudio(bool);
132  void setShowHMS(bool show);
133  void setOctaveOfMiddleC(int oct);
134  void setViewFontSize(int size);
135  void setShowSplash(bool);
136 
137 private:
138  Preferences(); // may throw DirectoryCreationFailed
139  virtual ~Preferences();
140 
142 
143  // We don't support arbitrary octaves in the gui, because we want
144  // to be able to label what the octave system comes from. These
145  // are the ones we support. (But we save and load as octave
146  // numbers, so as not to make the prefs format really confusing)
152  };
155 
163  QString m_tempDirRoot;
167  bool m_gapless;
172  bool m_showHMS;
173  int m_octave;
175 };
176 
177 #endif
int m_viewFontSize
Definition: Preferences.h:169
double sv_samplerate_t
Sample rate.
Definition: BaseTypes.h:51
void setOctaveOfMiddleC(int oct)
bool getShowHMS() const
Definition: Preferences.h:102
sv_samplerate_t getFixedSampleRate() const
If we should always resample audio to the same rate, return it; otherwise (the normal case) return 0...
Definition: Preferences.h:73
void setResampleOnLoad(bool)
BackgroundMode getBackgroundMode() const
Definition: Preferences.h:89
bool m_gapless
Definition: Preferences.h:167
SpectrogramSmoothing m_spectrogramSmoothing
Definition: Preferences.h:156
int getViewFontSize() const
Definition: Preferences.h:62
void setFixedSampleRate(sv_samplerate_t)
int getOctaveOfLowestMIDINote() const
Definition: Preferences.h:108
PropertyList getProperties() const override
Get a list of the names of all the supported properties on this container.
Definition: Preferences.cpp:95
virtual ~Preferences()
Definition: Preferences.cpp:90
PropertyBoxLayout m_propertyBoxLayout
Definition: Preferences.h:159
QString getPropertyValueLabel(const PropertyName &, int value) const override
If the given property is a ValueProperty, return the display label to be used for the given value for...
SpectrogramXSmoothing getSpectrogramXSmoothing() const
Definition: Preferences.h:49
bool getResampleOnLoad() const
True if we should resample second or subsequent audio file to match first audio file's rate...
Definition: Preferences.h:76
int getOctaveOfMiddleC() const
Definition: Preferences.h:104
int getPropertyRangeAndValue(const PropertyName &, int *, int *, int *) const override
Return the minimum and maximum values for the given property and its current value in this container...
bool m_resampleOnLoad
Definition: Preferences.h:166
void setSpectrogramXSmoothing(SpectrogramXSmoothing smoothing)
QString getPropertyContainerIconName() const override
bool getRunPluginsInProcess() const
Definition: Preferences.h:53
void setRecordMono(bool)
bool m_showSplash
Definition: Preferences.h:174
static Preferences * getInstance()
Definition: Preferences.cpp:31
void setShowSplash(bool)
bool m_omitRecentTemps
Definition: Preferences.h:162
void setUseGaplessMode(bool)
sv_samplerate_t m_fixedSampleRate
Definition: Preferences.h:164
WindowType
Definition: Window.h:30
PropertyBoxLayout getPropertyBoxLayout() const
Definition: Preferences.h:60
void setTimeToTextMode(TimeToTextMode mode)
void setNormaliseAudio(bool)
void setWindowType(WindowType type)
SpectrogramXSmoothing m_spectrogramXSmoothing
Definition: Preferences.h:157
static int getOctaveOfMiddleCInSystem(OctaveNumberingSystem s)
void setSpectrogramSmoothing(SpectrogramSmoothing smoothing)
QString getTemporaryDirectoryRoot() const
Definition: Preferences.h:66
WindowType m_windowType
Definition: Preferences.h:160
bool getNormaliseAudio() const
True if audio files should be loaded with normalisation (max == 1)
Definition: Preferences.h:82
WindowType getWindowType() const
Definition: Preferences.h:51
void setOmitTempsFromRecentFiles(bool omit)
bool getOmitTempsFromRecentFiles() const
Definition: Preferences.h:64
BackgroundMode m_backgroundMode
Definition: Preferences.h:170
bool getRecordMono() const
True if we should always mix down recorded audio to a single channel regardless of how many channels ...
Definition: Preferences.h:70
PropertyBoxLayout
!! harmonise with PaneStack
Definition: Preferences.h:56
void setProperty(const PropertyName &, int) override
SpectrogramSmoothing getSpectrogramSmoothing() const
Definition: Preferences.h:48
static Preferences * m_instance
Definition: Preferences.h:141
void setPropertyBoxLayout(PropertyBoxLayout layout)
void setTemporaryDirectoryRoot(QString tempDirRoot)
QString getPropertyContainerName() const override
PropertyType getPropertyType(const PropertyName &) const override
Return the type of the given property, or InvalidProperty if the property is not supported on this co...
static OctaveNumberingSystem getSystemWithMiddleCInOctave(int o)
void setShowHMS(bool show)
bool m_showHMS
Definition: Preferences.h:172
void setViewFontSize(int size)
double m_tuningFrequency
Definition: Preferences.h:158
bool m_normaliseAudio
Definition: Preferences.h:168
double getTuningFrequency() const
Definition: Preferences.h:50
std::vector< PropertyName > PropertyList
void setRunPluginsInProcess(bool r)
TimeToTextMode m_timeToTextMode
Definition: Preferences.h:171
QString m_tempDirRoot
Definition: Preferences.h:163
bool m_runPluginsInProcess
Definition: Preferences.h:161
QString getPropertyLabel(const PropertyName &) const override
Return the human-readable (and i18n&#39;ised) name of a property.
void setBackgroundMode(BackgroundMode mode)
TimeToTextMode getTimeToTextMode() const
Definition: Preferences.h:100
void setTuningFrequency(double freq)
bool getUseGaplessMode() const
True if mp3 files should be loaded "gaplessly", i.e. compensating for encoder/decoder delay and paddi...
Definition: Preferences.h:79
bool getShowSplash() const
Definition: Preferences.h:112
bool m_recordMono
Definition: Preferences.h:165