Mercurial > hg > svcore
diff 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 |
line wrap: on
line diff
--- a/base/Preferences.cpp Fri Jun 13 16:03:48 2014 +0100 +++ b/base/Preferences.cpp Fri Jun 13 16:12:00 2014 +0100 @@ -45,6 +45,7 @@ m_tempDirRoot(""), m_fixedSampleRate(0), m_resampleOnLoad(false), + m_normaliseAudio(false), m_viewFontSize(10), m_backgroundMode(BackgroundFromTheme), m_timeToTextMode(TimeToTextMs), @@ -65,6 +66,7 @@ m_resampleQuality = settings.value("resample-quality", 1).toInt(); m_fixedSampleRate = settings.value("fixed-sample-rate", 0).toInt(); m_resampleOnLoad = settings.value("resample-on-load", false).toBool(); + m_normaliseAudio = settings.value("normalise-audio", false).toBool(); m_backgroundMode = BackgroundMode (settings.value("background-mode", int(BackgroundFromTheme)).toInt()); m_timeToTextMode = TimeToTextMode @@ -95,6 +97,7 @@ props.push_back("Resample Quality"); props.push_back("Omit Temporaries from Recent Files"); props.push_back("Resample On Load"); + props.push_back("Normalise Audio"); props.push_back("Fixed Sample Rate"); props.push_back("Temporary Directory Root"); props.push_back("Background Mode"); @@ -126,6 +129,9 @@ if (name == "Resample Quality") { return tr("Playback resampler type"); } + if (name == "Normalise Audio") { + return tr("Normalise audio signal when reading from audio file"); + } if (name == "Omit Temporaries from Recent Files") { return tr("Omit temporaries from Recent Files menu"); } @@ -177,6 +183,9 @@ if (name == "Resample Quality") { return ValueProperty; } + if (name == "Normalise Audio") { + return ToggleProperty; + } if (name == "Omit Temporaries from Recent Files") { return ToggleProperty; } @@ -547,6 +556,19 @@ } void +Preferences::setNormaliseAudio(bool norm) +{ + if (m_normaliseAudio != norm) { + m_normaliseAudio = norm; + QSettings settings; + settings.beginGroup("Preferences"); + settings.setValue("normalise-audio", norm); + settings.endGroup(); + emit propertyChanged("Normalise Audio"); + } +} + +void Preferences::setBackgroundMode(BackgroundMode mode) { if (m_backgroundMode != mode) {