summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/dlgautodj.cpp6
-rw-r--r--src/dlgautodj.h1
-rw-r--r--src/dlgautodj.ui2
-rw-r--r--src/dlgprefreplaygain.cpp123
-rw-r--r--src/dlgprefreplaygain.h20
-rw-r--r--src/dlgprefreplaygaindlg.ui328
-rw-r--r--src/engine/enginebuffer.cpp7
-rw-r--r--src/engine/enginepregain.cpp76
-rw-r--r--src/engine/enginepregain.h3
-rw-r--r--src/library/autodj/autodjfeature.cpp59
-rw-r--r--src/library/autodj/autodjfeature.h2
-rw-r--r--src/library/dao/autodjcratesdao.cpp102
-rw-r--r--src/library/dao/autodjcratesdao.h3
-rw-r--r--src/vinylcontrol/steadypitch.cpp19
-rw-r--r--src/vinylcontrol/steadypitch.h2
-rw-r--r--src/vinylcontrol/vinylcontrolxwax.cpp13
16 files changed, 480 insertions, 286 deletions
diff --git a/src/dlgautodj.cpp b/src/dlgautodj.cpp
index 588ba42525..5a4808b348 100644
--- a/src/dlgautodj.cpp
+++ b/src/dlgautodj.cpp
@@ -163,12 +163,6 @@ void DlgAutoDJ::transitionSliderChanged(int value) {
m_pAutoDJProcessor->setTransitionTime(value);
}
-void DlgAutoDJ::enableRandomButton(bool enabled) {
-#ifdef __AUTODJCRATES__
- pushButtonAddRandom->setEnabled(enabled);
-#endif // __AUTODJCRATES__
-}
-
void DlgAutoDJ::autoDJStateChanged(AutoDJProcessor::AutoDJState state) {
if (state == AutoDJProcessor::ADJ_DISABLED) {
pushButtonAutoDJ->setChecked(false);
diff --git a/src/dlgautodj.h b/src/dlgautodj.h
index 41275c794e..3caac21a60 100644
--- a/src/dlgautodj.h
+++ b/src/dlgautodj.h
@@ -38,7 +38,6 @@ class DlgAutoDJ : public QWidget, public Ui::DlgAutoDJ, public LibraryView {
void toggleAutoDJButton(bool enable);
void transitionTimeChanged(int time);
void transitionSliderChanged(int value);
- void enableRandomButton(bool enabled);
void autoDJStateChanged(AutoDJProcessor::AutoDJState state);
void setTrackTableFont(const QFont& font);
void setTrackTableRowHeight(int rowHeight);
diff --git a/src/dlgautodj.ui b/src/dlgautodj.ui
index 380422217b..6201b0c1cc 100644
--- a/src/dlgautodj.ui
+++ b/src/dlgautodj.ui
@@ -56,7 +56,7 @@
<item>
<widget class="QPushButton" name="pushButtonAddRandom">
<property name="toolTip">
- <string>Add a random track from track sources (crates) to the Auto DJ playlist.</string>
+ <string>Add a random track from track sources (crates) or Library to the Auto DJ playlist.</string>
</property>
<property name="text">
<string>Add Random</string>
diff --git a/src/dlgprefreplaygain.cpp b/src/dlgprefreplaygain.cpp
index bf3f4a8088..77a50e55c9 100644
--- a/src/dlgprefreplaygain.cpp
+++ b/src/dlgprefreplaygain.cpp
@@ -7,17 +7,26 @@
DlgPrefReplayGain::DlgPrefReplayGain(QWidget * parent, ConfigObject<ConfigValue> * _config)
- : DlgPreferencePage(parent),
- config(_config),
- m_COTReplayGainBoost(kConfigKey, "ReplayGainBoost"),
- m_COTEnabled(kConfigKey, "ReplayGainEnabled") {
+ : DlgPreferencePage(parent),
+ config(_config),
+ m_replayGainBoost(kConfigKey, "ReplayGainBoost"),
+ m_defaultBoost(kConfigKey, "DefaultBoost"),
+ m_enabled(kConfigKey, "ReplayGainEnabled") {
setupUi(this);
//Connections
- connect(EnableGain, SIGNAL(stateChanged(int)), this, SLOT(slotSetRGEnabled()));
- connect(EnableAnalyser, SIGNAL(stateChanged(int)), this, SLOT(slotSetRGAnalyserEnabled()));
- connect(SliderBoost, SIGNAL(valueChanged(int)), this, SLOT(slotUpdateBoost()));
- connect(SliderBoost, SIGNAL(sliderReleased()), this, SLOT(slotApply()));
+ connect(EnableGain, SIGNAL(stateChanged(int)),
+ this, SLOT(slotSetRGEnabled()));
+ connect(EnableAnalyser, SIGNAL(stateChanged(int)),
+ this, SLOT(slotSetRGAnalyserEnabled()));
+ connect(SliderReplayGainBoost, SIGNAL(valueChanged(int)),
+ this, SLOT(slotUpdateReplayGainBoost()));
+ connect(SliderReplayGainBoost, SIGNAL(sliderReleased()),
+ this, SLOT(slotApply()));
+ connect(SliderDefaultBoost, SIGNAL(valueChanged(int)),
+ this, SLOT(slotUpdateDefaultBoost()));
+ connect(SliderDefaultBoost, SIGNAL(sliderReleased()),
+ this, SLOT(slotApply()));
loadSettings();
}
@@ -26,24 +35,29 @@ DlgPrefReplayGain::~DlgPrefReplayGain() {
}
void DlgPrefReplayGain::loadSettings() {
- if(config->getValueString(ConfigKey(kConfigKey,"ReplayGainEnabled"))==QString("")) {
- slotResetToDefaults();
- } else {
- int iReplayGainBoost =
- config->getValueString(ConfigKey(kConfigKey, "InitialReplayGainBoost")).toInt();
- SliderBoost->setValue(iReplayGainBoost);
- lcddB->display(iReplayGainBoost);
-
- bool gainEnabled =
- config->getValueString(ConfigKey(kConfigKey, "ReplayGainEnabled")).toInt() == 1;
- EnableGain->setChecked(gainEnabled);
-
- bool analyserEnabled =
- config->getValueString(ConfigKey(kConfigKey, "ReplayGainAnalyserEnabled")).toInt();
- EnableAnalyser->setChecked(analyserEnabled);
- }
+ int iReplayGainBoost = config->getValueString(
+ ConfigKey(kConfigKey, "InitialReplayGainBoost"), "0").toInt();
+ SliderReplayGainBoost->setValue(iReplayGainBoost);
+ setLabelCurrentReplayGainBoost(iReplayGainBoost);
+
+
+ int iDefaultBoost = config->getValueString(
+ ConfigKey(kConfigKey, "InitialDefaultBoost"), "-6").toInt();
+ SliderDefaultBoost->setValue(iDefaultBoost);
+ LabelCurrentDefaultBoost->setText(
+ QString("%1 dB").arg(iDefaultBoost));
+
+ bool gainEnabled = config->getValueString(
+ ConfigKey(kConfigKey, "ReplayGainEnabled"), "1").toInt() == 1;
+ EnableGain->setChecked(gainEnabled);
+
+ bool analyserEnabled = config->getValueString(
+ ConfigKey(kConfigKey, "ReplayGainAnalyserEnabled"), "1").toInt();
+ EnableAnalyser->setChecked(analyserEnabled);
+
slotUpdate();
- slotUpdateBoost();
+ slotUpdateReplayGainBoost();
+ slotUpdateDefaultBoost();
}
void DlgPrefReplayGain::slotResetToDefaults() {
@@ -51,8 +65,18 @@ void DlgPrefReplayGain::slotResetToDefaults() {
// Turn ReplayGain Analyser on by default as it does not give appreciable
// delay on recent hardware (<5 years old).
EnableAnalyser->setChecked(true);
- SliderBoost->setValue(0);
- lcddB->display(0);
+ SliderReplayGainBoost->setValue(0);
+ setLabelCurrentReplayGainBoost(0);
+ SliderDefaultBoost->setValue(-6);
+ LabelCurrentDefaultBoost->setText("-6 dB");
+
+ int iDefaultBoost = config->getValueString(
+ ConfigKey(kConfigKey, "InitialDefaultBoost"), "-6").toInt();
+ SliderDefaultBoost->setValue(iDefaultBoost);
+ LabelCurrentDefaultBoost->setText(
+ QString("%1 dB").arg(iDefaultBoost));
+
+
slotUpdate();
slotApply();
}
@@ -62,10 +86,7 @@ void DlgPrefReplayGain::slotSetRGEnabled() {
config->set(ConfigKey(kConfigKey,"ReplayGainEnabled"), ConfigValue(1));
} else {
config->set(ConfigKey(kConfigKey,"ReplayGainEnabled"), ConfigValue(0));
- config->set(ConfigKey(kConfigKey,"ReplayGainAnalyserEnabled"),
- ConfigValue(0));
}
-
slotUpdate();
slotApply();
}
@@ -77,30 +98,42 @@ void DlgPrefReplayGain::slotSetRGAnalyserEnabled() {
slotApply();
}
-void DlgPrefReplayGain::slotUpdateBoost() {
+void DlgPrefReplayGain::slotUpdateReplayGainBoost() {
+ int value = SliderReplayGainBoost->value();
config->set(ConfigKey(kConfigKey, "InitialReplayGainBoost"),
- ConfigValue(SliderBoost->value()));
+ ConfigValue(value));
+ setLabelCurrentReplayGainBoost(value);
+ slotApply();
+}
+
+void DlgPrefReplayGain::setLabelCurrentReplayGainBoost(int value) {
+ LabelCurrentReplayGainBoost->setText(
+ QString(tr("%1 dB (average %2 dB)")).arg(
+ QString().sprintf("%+d", value), QString::number(value - 14)));
+}
+
+void DlgPrefReplayGain::slotUpdateDefaultBoost() {
+ int value = SliderDefaultBoost->value();
+ config->set(ConfigKey(kConfigKey, "InitialDefaultBoost"),
+ ConfigValue(value));
+ LabelCurrentDefaultBoost->setText(
+ QString("%1 dB").arg(value));
slotApply();
}
void DlgPrefReplayGain::slotUpdate() {
if (config->getValueString(
- ConfigKey(kConfigKey,"ReplayGainEnabled")).toInt()==1) {
- EnableAnalyser->setEnabled(true);
- SliderBoost->setEnabled(true);
+ ConfigKey(kConfigKey,"ReplayGainEnabled")).toInt() == 1) {
+ SliderReplayGainBoost->setEnabled(true);
} else {
- EnableAnalyser->setChecked(false);
- EnableAnalyser->setEnabled(false);
- SliderBoost->setEnabled(false);
+ SliderReplayGainBoost->setEnabled(false);
}
}
void DlgPrefReplayGain::slotApply() {
- double replayGainBoostDb = SliderBoost->value();
- m_COTReplayGainBoost.set(db2ratio(replayGainBoostDb));
- int iRGenabled = 0;
- if (EnableGain->isChecked()) {
- iRGenabled = 1;
- }
- m_COTEnabled.set(iRGenabled);
+ double replayGainBoostDb = SliderReplayGainBoost->value();
+ m_replayGainBoost.set(db2ratio(replayGainBoostDb));
+ double defaultBoostDb = SliderDefaultBoost->value();
+ m_defaultBoost.set(db2ratio(defaultBoostDb));
+ m_enabled.set(EnableGain->isChecked() ? 1.0 : 0.0);
}
diff --git a/src/dlgprefreplaygain.h b/src/dlgprefreplaygain.h
index ad36be233b..e5f021beac 100644
--- a/src/dlgprefreplaygain.h
+++ b/src/dlgprefreplaygain.h
@@ -1,10 +1,3 @@
-/*
- * dlgprefreplaygain.h
- *
- * Created on: 18/ott/2010
- * Author: Vittorio Colao
- */
-
#ifndef DLGPREFREPLAYGAIN_H_
#define DLGPREFREPLAYGAIN_H_
@@ -15,7 +8,8 @@
#include "controlobjectslave.h"
#include "preferences/dlgpreferencepage.h"
-class DlgPrefReplayGain: public DlgPreferencePage, public Ui::DlgPrefReplayGainDlg {
+class DlgPrefReplayGain: public DlgPreferencePage,
+ public Ui::DlgPrefReplayGainDlg {
Q_OBJECT
public:
DlgPrefReplayGain(QWidget *parent, ConfigObject<ConfigValue> *_config);
@@ -23,7 +17,8 @@ class DlgPrefReplayGain: public DlgPreferencePage, public Ui::DlgPrefReplayGainD
public slots:
// Update initial gain increment
- void slotUpdateBoost();
+ void slotUpdateReplayGainBoost();
+ void slotUpdateDefaultBoost();
void slotSetRGEnabled();
void slotSetRGAnalyserEnabled();
@@ -37,13 +32,14 @@ class DlgPrefReplayGain: public DlgPreferencePage, public Ui::DlgPrefReplayGainD
private:
// Determines whether or not to gray out the preferences
void loadSettings();
+ void setLabelCurrentReplayGainBoost(int value);
// Pointer to config object
ConfigObject<ConfigValue>* config;
- ControlObjectSlave m_COTReplayGainBoost;
- ControlObjectSlave m_COTEnabled;
+ ControlObjectSlave m_replayGainBoost;
+ ControlObjectSlave m_defaultBoost;
+ ControlObjectSlave m_enabled;
};
-
#endif /* DLGPREFREPLAYGAIN_H_ */
diff --git a/src/dlgprefreplaygaindlg.ui b/src/dlgprefreplaygaindlg.ui
index 0aded95767..773eef8b5c 100644
--- a/src/dlgprefreplaygaindlg.ui
+++ b/src/dlgprefreplaygaindlg.ui
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>433</width>
- <height>488</height>
+ <height>609</height>
</rect>
</property>
<property name="windowTitle">
@@ -17,36 +17,26 @@
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
- <string>ReplayGain Normalization</string>
+ <string>ReplayGain Loudness Normalization</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
- <widget class="QCheckBox" name="EnableGain">
+ <widget class="QCheckBox" name="EnableAnalyser">
<property name="toolTip">
- <string>Apply volume normalization to loaded tracks.</string>
+ <string>Calculate ReplayGain normalization for tracks which are missing ReplayGain metadata.</string>
</property>
<property name="text">
- <string>Enable ReplayGain</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Line" name="line1">
- <property name="frameShape">
- <enum>QFrame::HLine</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Sunken</enum>
+ <string>Enable ReplayGain Analysis</string>
</property>
</widget>
</item>
<item>
- <widget class="QCheckBox" name="EnableAnalyser">
+ <widget class="QCheckBox" name="EnableGain">
<property name="toolTip">
- <string>Calculate ReplayGain normalization for tracks which are missing ReplayGain metadata.</string>
+ <string>Apply volume normalization to loaded tracks.</string>
</property>
<property name="text">
- <string>Enable ReplayGain Analysis</string>
+ <string>Apply ReplayGain</string>
</property>
</widget>
</item>
@@ -62,133 +52,189 @@
</size>
</property>
<property name="title">
- <string/>
+ <string>Initial Boost</string>
</property>
<layout class="QGridLayout">
- <item row="0" column="0">
- <layout class="QVBoxLayout" name="_2">
+ <item row="3" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>20</number>
+ </property>
<item>
- <layout class="QHBoxLayout" name="_3">
- <item>
- <widget class="QLabel" name="label_boost">
- <property name="text">
- <string>Initial Boost</string>
- </property>
- <property name="buddy">
- <cstring>SliderBoost</cstring>
- </property>
- </widget>
- </item>
- <item>
- <spacer>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>-12 dB</string>
+ </property>
+ </widget>
</item>
<item>
- <widget class="QSlider" name="SliderBoost">
- <property name="toolTip">
- <string>Initial Gain Boost</string>
- </property>
- <property name="locale">
- <locale language="C" country="AnyCountry"/>
- </property>
- <property name="minimum">
- <number>-6</number>
- </property>
- <property name="maximum">
- <number>15</number>
- </property>
- <property name="singleStep">
- <number>1</number>
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
</property>
- <property name="pageStep">
- <number>1</number>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
</property>
- <property name="value">
- <number>0</number>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="LabelCurrentReplayGainBoost">
+ <property name="text">
+ <string>TextLabel</string>
</property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
- <property name="tickInterval">
- <number>5</number>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
</property>
- </widget>
+ </spacer>
</item>
<item>
- <layout class="QHBoxLayout" name="_4">
- <item>
- <spacer>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QLCDNumber" name="lcddB">
- <property name="locale">
- <locale language="C" country="AnyCountry"/>
- </property>
- <property name="numDigits">
- <number>2</number>
- </property>
- <property name="digitCount">
- <number>2</number>
- </property>
- <property name="segmentStyle">
- <enum>QLCDNumber::Flat</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>dB</string>
- </property>
- </widget>
- </item>
- </layout>
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>+12 dB</string>
+ </property>
+ </widget>
</item>
</layout>
</item>
- <item row="1" column="0">
- <spacer>
+ <item row="2" column="0">
+ <widget class="QSlider" name="SliderReplayGainBoost">
+ <property name="toolTip">
+ <string>Initial Gain Boost</string>
+ </property>
+ <property name="locale">
+ <locale language="C" country="AnyCountry"/>
+ </property>
+ <property name="minimum">
+ <number>-12</number>
+ </property>
+ <property name="maximum">
+ <number>12</number>
+ </property>
+ <property name="singleStep">
+ <number>1</number>
+ </property>
+ <property name="pageStep">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>0</number>
+ </property>
<property name="orientation">
- <enum>Qt::Vertical</enum>
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="tickInterval">
+ <number>5</number>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>without ReplayGain</string>
</property>
- <property name="sizeType">
- <enum>QSizePolicy::MinimumExpanding</enum>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_boost">
+ <property name="text">
+ <string>in addition to ReplayGain</string>
</property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
+ <property name="buddy">
+ <cstring>SliderReplayGainBoost</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QSlider" name="SliderDefaultBoost">
+ <property name="minimum">
+ <number>-12</number>
</property>
- </spacer>
+ <property name="maximum">
+ <number>12</number>
+ </property>
+ <property name="pageStep">
+ <number>1</number>
+ </property>
+ <property name="sliderPosition">
+ <number>0</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>-12 dB</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="LabelCurrentDefaultBoost">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>+12 dB</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
</layout>
</widget>
@@ -202,7 +248,20 @@
<item row="4" column="0">
<widget class="QLabel" name="label_26">
<property name="text">
- <string>It may take a few seconds after track analysis is finished for a newly calculated ReplayGain to be applied. To avoid abrupt volume changes, Mixxx does not change the ReplayGain of playing tracks.</string>
+ <string>While an unanalyzed track is playing, Mixxx won't apply the a newly calculated ReplayGain to avoid an abrupt volume change. </string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_8">
+ <property name="text">
+ <string>The normal average ReplayGain playback level is -14 dB. You may increase it using the inital boost, if your tracks does not require the full dynamic headroom, or reduce it if you experience that your tracks are clipping by default. For more information about headroom and clipping have a look at the manual.</string>
+ </property>
+ <property name="scaledContents">
+ <bool>true</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
@@ -229,22 +288,5 @@
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
- <connections>
- <connection>
- <sender>SliderBoost</sender>
- <signal>sliderMoved(int)</signal>
- <receiver>lcddB</receiver>
- <slot>display(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>220</x>
- <y>298</y>
- </hint>
- <hint type="destinationlabel">
- <x>355</x>
- <y>331</y>
- </hint>
- </hints>
- </connection>
- </connections>
+ <connections/>
</ui>
diff --git a/src/engine/enginebuffer.cpp b/src/engine/enginebuffer.cpp
index b09ea19e5c..e4c153b5bb 100644
--- a/src/engine/enginebuffer.cpp
+++ b/src/engine/enginebuffer.cpp
@@ -774,9 +774,12 @@ void EngineBuffer::process(CSAMPLE* pOutput, const int iBufferSize) {
double speed = m_pRateControl->calculateSpeed(
baserate, tempoRatio, paused, iBufferSize, &is_scratching);
+ // TODO(owen): Maybe change this so that rubberband doesn't disable
+ // keylock on scratch. (just check m_pScaleKeylock == m_pScaleST)
if (is_scratching || fabs(speed) > 1.9) {
- // Scratching always disables keylock because keylock sounds
- // terrible when not going at a constant rate.
+ // Scratching and high speeds with Soundtouch always disables keylock
+ // because Soundtouch sounds terrible in these conditions. Rubberband
+ // sounds better, but still has some problems.
// High seek speeds also disables keylock. Our pitch slider could go
// to 90%, so that's the cutoff point.
pitchRatio = speed;
diff --git a/src/engine/enginepregain.cpp b/src/engine/enginepregain.cpp
index f756b6ca4c..3ae9399816 100644
--- a/src/engine/enginepregain.cpp
+++ b/src/engine/enginepregain.cpp
@@ -26,6 +26,7 @@
#include "sampleutil.h"
ControlPotmeter* EnginePregain::s_pReplayGainBoost = NULL;
+ControlPotmeter* EnginePregain::s_pDefaultBoost = NULL;
ControlObject* EnginePregain::s_pEnableReplayGain = NULL;
/*----------------------------------------------------------------
@@ -35,27 +36,30 @@ EnginePregain::EnginePregain(QString group)
: m_dSpeed(0),
m_fPrevGain(1.0),
m_bSmoothFade(false) {
- m_pPotmeterPregain = new ControlAudioTaperPot(ConfigKey(group, "pregain"), -12, +12, 0.5);
+ m_pPotmeterPregain = new ControlAudioTaperPot(ConfigKey(group, "pregain"), -12, 12, 0.5);
//Replay Gain things
- m_pControlReplayGain = new ControlObject(ConfigKey(group, "replaygain"));
+ m_pCOReplayGain = new ControlObject(ConfigKey(group, "replaygain"));
m_pTotalGain = new ControlObject(ConfigKey(group, "total_gain"));
m_pPassthroughEnabled = ControlObject::getControl(ConfigKey(group, "passthrough"));
if (s_pReplayGainBoost == NULL) {
- s_pReplayGainBoost = new ControlPotmeter(ConfigKey("[ReplayGain]", "ReplayGainBoost"), -6, 15);
+ s_pReplayGainBoost = new ControlAudioTaperPot(ConfigKey("[ReplayGain]", "ReplayGainBoost"), -12, 12, 0.5);
+ s_pDefaultBoost = new ControlAudioTaperPot(ConfigKey("[ReplayGain]", "DefaultBoost"), -12, 12, 0.5);
s_pEnableReplayGain = new ControlObject(ConfigKey("[ReplayGain]", "ReplayGainEnabled"));
}
}
EnginePregain::~EnginePregain() {
delete m_pPotmeterPregain;
- delete m_pControlReplayGain;
+ delete m_pCOReplayGain;
delete m_pTotalGain;
delete s_pEnableReplayGain;
s_pEnableReplayGain = NULL;
delete s_pReplayGainBoost;
s_pReplayGainBoost = NULL;
+ delete s_pDefaultBoost;
+ s_pDefaultBoost = NULL;
}
void EnginePregain::setSpeed(double speed) {
@@ -63,25 +67,34 @@ void EnginePregain::setSpeed(double speed) {
}
void EnginePregain::process(CSAMPLE* pInOut, const int iBufferSize) {
- float fEnableReplayGain = s_pEnableReplayGain->get();
- const float fReplayGainBoost = s_pReplayGainBoost->get();
- float fGain = m_pPotmeterPregain->get();
- float fReplayGain = m_pControlReplayGain->get();
- float fReplayGainCorrection = 1;
- float fPassing = m_pPassthroughEnabled->get();
-
- // Override replaygain value if passing through
- if (fPassing > 0) {
- fReplayGain = 1.0;
- } else if (fReplayGain * fEnableReplayGain != 0) {
- // Here is the point, when ReplayGain Analyser takes its action, suggested gain changes from 0 to a nonzero value
+ const float fReplayGain = m_pCOReplayGain->get();
+ float fReplayGainCorrection;
+ if (!s_pEnableReplayGain->toBool() || m_pPassthroughEnabled->toBool()) {
+ // Override replaygain value if passing through
+ // TODO(XXX): consider a good default.
+ // Do we expect an replaygain leveled input or
+ // Normalized to 1 input?
+ fReplayGainCorrection = 1; // We expect a replaygain leveled input
+ } else if (fReplayGain == 0) {
+ // use predicted replaygain
+ fReplayGainCorrection = (float)s_pDefaultBoost->get();
+ // We prepare for smoothfading to ReplayGain suggested gain
+ // if ReplayGain value changes or ReplayGain is enabled
+ m_bSmoothFade = true;
+ m_timer.restart();
+ } else {
+ // Here is the point, when ReplayGain Analyser takes its action,
+ // suggested gain changes from 0 to a nonzero value
// We want to smoothly fade to this last.
- // Anyway we have some the problem that code cannot block the full process for one second.
+ // Anyway we have some the problem that code cannot block the
+ // full process for one second.
// So we need to alter gain each time ::process is called.
- const float fullReplayGainBoost = fReplayGain * fReplayGainBoost;
+ const float fullReplayGainBoost = fReplayGain *
+ (float)s_pReplayGainBoost->get();
- // This means that a ReplayGain value has been calculated after the track has been loaded
+ // This means that a ReplayGain value has been calculated after the
+ // track has been loaded
const double kFadeSeconds = 1.0;
if (m_bSmoothFade) {
@@ -89,7 +102,8 @@ void EnginePregain::process(CSAMPLE* pInOut, const int iBufferSize) {
if (seconds < kFadeSeconds) {
// Fade smoothly
double fadeFrac = seconds / kFadeSeconds;
- fReplayGainCorrection = (1.0 - fadeFrac) + fadeFrac * fullReplayGainBoost;
+ fReplayGainCorrection = m_fPrevGain * (1.0 - fadeFrac) +
+ fadeFrac * fullReplayGainBoost;
} else {
m_bSmoothFade = false;
fReplayGainCorrection = fullReplayGainBoost;
@@ -98,19 +112,15 @@ void EnginePregain::process(CSAMPLE* pInOut, const int iBufferSize) {
// Passing a user defined boost
fReplayGainCorrection = fullReplayGainBoost;
}
- } else if (fEnableReplayGain != 0) {
- // If track has not ReplayGain value and ReplayGain is enabled
- // we prepare for smoothfading to ReplayGain suggested gain
- m_bSmoothFade = true;
- m_timer.restart();
}
// Clamp gain to within [0, 10.0] to prevent insane gains. This can happen
// (some corrupt files get really high replay gain values).
// 10 allows a maximum replay Gain Boost * calculated replay gain of ~2
- fGain *= math_clamp(fReplayGainCorrection, 0.0f, 10.0f);
+ float totalGain = (float)m_pPotmeterPregain->get() *
+ math_clamp(fReplayGainCorrection, 0.0f, 10.0f);
- m_pTotalGain->set(fGain);
+ m_pTotalGain->set(totalGain);
// Vinylsoundemu:
// As the speed approaches zero, hearing small bursts of sound at full volume
@@ -118,15 +128,15 @@ void EnginePregain::process(CSAMPLE* pInOut, const int iBufferSize) {
// Instead, reduce gain to provide a soft rolloff.
const float kThresholdSpeed = 0.070; // Scale volume if playback speed is below 7%.
if (fabs(m_dSpeed) < kThresholdSpeed) {
- fGain *= fabs(m_dSpeed) / kThresholdSpeed;
+ totalGain *= fabs(m_dSpeed) / kThresholdSpeed;
}
- if (fGain != m_fPrevGain) {
- // Prevent soundwave discontinuities by interpolating from old to new gain.
- SampleUtil::applyRampingGain(pInOut, m_fPrevGain, fGain, iBufferSize);
+ if (totalGain != m_fPrevGain) {
+ // Prevent sound wave discontinuities by interpolating from old to new gain.
+ SampleUtil::applyRampingGain(pInOut, m_fPrevGain, totalGain, iBufferSize);
+ m_fPrevGain = totalGain;
} else {
// SampleUtil deals with aliased buffers and gains of 1 or 0.
- SampleUtil::applyGain(pInOut, fGain, iBufferSize);
+ SampleUtil::applyGain(pInOut, totalGain, iBufferSize