comparison base/Preferences.cpp @ 921:2896b8872834 tonioni

Add normalise preference and take it into account in WaveFileModel
author Chris Cannam
date Fri, 13 Jun 2014 16:12:00 +0100
parents 4c7b4040bd2d
children 344c9ea90181
comparison
equal deleted inserted replaced
920:f3cda3280398 921:2896b8872834
43 m_resampleQuality(1), 43 m_resampleQuality(1),
44 m_omitRecentTemps(true), 44 m_omitRecentTemps(true),
45 m_tempDirRoot(""), 45 m_tempDirRoot(""),
46 m_fixedSampleRate(0), 46 m_fixedSampleRate(0),
47 m_resampleOnLoad(false), 47 m_resampleOnLoad(false),
48 m_normaliseAudio(false),
48 m_viewFontSize(10), 49 m_viewFontSize(10),
49 m_backgroundMode(BackgroundFromTheme), 50 m_backgroundMode(BackgroundFromTheme),
50 m_timeToTextMode(TimeToTextMs), 51 m_timeToTextMode(TimeToTextMs),
51 m_octave(4), 52 m_octave(4),
52 m_showSplash(true) 53 m_showSplash(true)
63 m_windowType = WindowType 64 m_windowType = WindowType
64 (settings.value("window-type", int(HanningWindow)).toInt()); 65 (settings.value("window-type", int(HanningWindow)).toInt());
65 m_resampleQuality = settings.value("resample-quality", 1).toInt(); 66 m_resampleQuality = settings.value("resample-quality", 1).toInt();
66 m_fixedSampleRate = settings.value("fixed-sample-rate", 0).toInt(); 67 m_fixedSampleRate = settings.value("fixed-sample-rate", 0).toInt();
67 m_resampleOnLoad = settings.value("resample-on-load", false).toBool(); 68 m_resampleOnLoad = settings.value("resample-on-load", false).toBool();
69 m_normaliseAudio = settings.value("normalise-audio", false).toBool();
68 m_backgroundMode = BackgroundMode 70 m_backgroundMode = BackgroundMode
69 (settings.value("background-mode", int(BackgroundFromTheme)).toInt()); 71 (settings.value("background-mode", int(BackgroundFromTheme)).toInt());
70 m_timeToTextMode = TimeToTextMode 72 m_timeToTextMode = TimeToTextMode
71 (settings.value("time-to-text-mode", int(TimeToTextMs)).toInt()); 73 (settings.value("time-to-text-mode", int(TimeToTextMs)).toInt());
72 m_octave = (settings.value("octave-of-middle-c", 4)).toInt(); 74 m_octave = (settings.value("octave-of-middle-c", 4)).toInt();
93 props.push_back("Property Box Layout"); 95 props.push_back("Property Box Layout");
94 props.push_back("Window Type"); 96 props.push_back("Window Type");
95 props.push_back("Resample Quality"); 97 props.push_back("Resample Quality");
96 props.push_back("Omit Temporaries from Recent Files"); 98 props.push_back("Omit Temporaries from Recent Files");
97 props.push_back("Resample On Load"); 99 props.push_back("Resample On Load");
100 props.push_back("Normalise Audio");
98 props.push_back("Fixed Sample Rate"); 101 props.push_back("Fixed Sample Rate");
99 props.push_back("Temporary Directory Root"); 102 props.push_back("Temporary Directory Root");
100 props.push_back("Background Mode"); 103 props.push_back("Background Mode");
101 props.push_back("Time To Text Mode"); 104 props.push_back("Time To Text Mode");
102 props.push_back("Octave Numbering System"); 105 props.push_back("Octave Numbering System");
124 return tr("Spectral analysis window shape"); 127 return tr("Spectral analysis window shape");
125 } 128 }
126 if (name == "Resample Quality") { 129 if (name == "Resample Quality") {
127 return tr("Playback resampler type"); 130 return tr("Playback resampler type");
128 } 131 }
132 if (name == "Normalise Audio") {
133 return tr("Normalise audio signal when reading from audio file");
134 }
129 if (name == "Omit Temporaries from Recent Files") { 135 if (name == "Omit Temporaries from Recent Files") {
130 return tr("Omit temporaries from Recent Files menu"); 136 return tr("Omit temporaries from Recent Files menu");
131 } 137 }
132 if (name == "Resample On Load") { 138 if (name == "Resample On Load") {
133 return tr("Resample mismatching files on import"); 139 return tr("Resample mismatching files on import");
174 if (name == "Window Type") { 180 if (name == "Window Type") {
175 return ValueProperty; 181 return ValueProperty;
176 } 182 }
177 if (name == "Resample Quality") { 183 if (name == "Resample Quality") {
178 return ValueProperty; 184 return ValueProperty;
185 }
186 if (name == "Normalise Audio") {
187 return ToggleProperty;
179 } 188 }
180 if (name == "Omit Temporaries from Recent Files") { 189 if (name == "Omit Temporaries from Recent Files") {
181 return ToggleProperty; 190 return ToggleProperty;
182 } 191 }
183 if (name == "Resample On Load") { 192 if (name == "Resample On Load") {
545 emit propertyChanged("Fixed Sample Rate"); 554 emit propertyChanged("Fixed Sample Rate");
546 } 555 }
547 } 556 }
548 557
549 void 558 void
559 Preferences::setNormaliseAudio(bool norm)
560 {
561 if (m_normaliseAudio != norm) {
562 m_normaliseAudio = norm;
563 QSettings settings;
564 settings.beginGroup("Preferences");
565 settings.setValue("normalise-audio", norm);
566 settings.endGroup();
567 emit propertyChanged("Normalise Audio");
568 }
569 }
570
571 void
550 Preferences::setBackgroundMode(BackgroundMode mode) 572 Preferences::setBackgroundMode(BackgroundMode mode)
551 { 573 {
552 if (m_backgroundMode != mode) { 574 if (m_backgroundMode != mode) {
553 575
554 m_backgroundMode = mode; 576 m_backgroundMode = mode;