Skip to content

Commit

Permalink
AutoDJ: add option for xfader auto-recenter after disabling
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed May 30, 2024
1 parent 113c113 commit 5b80d3a
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/library/autodj/autodjprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,11 @@ AutoDJProcessor::AutoDJError AutoDJProcessor::toggleAutoDJ(bool enable) {
for (const auto& pDeck : std::as_const(m_decks)) {
pDeck->disconnect(this);
}
// if (m_pConfig->getValue<bool>(ConfigKey(kAutoDJGroup,
if (m_pConfig->getValue<bool>(ConfigKey(kConfigKey,
QStringLiteral("center_xfader_when_disabling")))) {
m_pCOCrossfader->set(0);
}
emitAutoDJStateChanged(m_eState);
}
return ADJ_OK;
Expand Down
9 changes: 9 additions & 0 deletions src/preferences/dialog/dlgprefautodj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ void DlgPrefAutoDJ::slotUpdate() {
ConfigKey("[Auto DJ]", "EnableRandomQueue"))
? Qt::Checked
: Qt::Unchecked);

// Re-center the crossfader instantly when AutoDJ is disabled
CenterXfaderCheckBox->setChecked(m_pConfig->getValue(
ConfigKey("[Auto DJ]", "center_xfader_when_disabling"), false));
}

void DlgPrefAutoDJ::slotApply() {
Expand All @@ -74,6 +78,9 @@ void DlgPrefAutoDJ::slotApply() {
m_pConfig->setValue(
ConfigKey("[Auto DJ]", "RandomQueueMinimumAllowed"),
RandomQueueMinimumSpinBox->value());

m_pConfig->setValue(ConfigKey("[Auto DJ]", "center_xfader_when_disabling"),
CenterXfaderCheckBox->isChecked());
}

void DlgPrefAutoDJ::slotResetToDefaults() {
Expand All @@ -88,6 +95,8 @@ void DlgPrefAutoDJ::slotResetToDefaults() {
RandomQueueCheckBox->setEnabled(true);
RandomQueueMinimumSpinBox->setEnabled(false);
RandomQueueMinimumSpinBox->setValue(5);

CenterXfaderCheckBox->setChecked(false);
}

void DlgPrefAutoDJ::slotToggleRequeueIgnore(int buttonState) {
Expand Down
67 changes: 67 additions & 0 deletions src/preferences/dialog/dlgprefautodjdlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,72 @@
</widget>
</item>

<item>
<widget class="QGroupBox" name="CrossfaderBehaviour">
<property name="title">
<string>Crossfader Behaviour</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<layout class="QGridLayout" name="CrossfaderBehaviourLayout">

<item row="0" column="0">
<widget class="QLabel" name="CenterXfaderLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Reset the Crossfader back to center after disabling AutoDJ</string>
</property>
<property name="buddy">
<cstring>CenterXfaderCheckBox</cstring>
</property>
</widget>
</item>

<item row="0" column="1">
<widget class="QCheckBox" name="CenterXfaderCheckBox"/>
</item>

<item row="0" column="2">
<spacer name="horizontalSpacerxfaderbehaviour">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</spacer>
</item>

<item row="1" column="0" colspan="3">
<widget class="QLabel" name="CenterXfaderHintText">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="text">
<string>Hint: Resetting the crossfader to center will cause a drop of the main output's volume if you've selected "Constant Power" crossfader curve in the Mixer preferences.</string>
</property>
</widget>
</item>

</layout>
</widget>
</item>

<item>
<spacer name="verticalSpacer">
<property name="orientation">
Expand All @@ -270,5 +336,6 @@
</layout>
</widget>
<resources/>
<!-- tabstops -->
<connections/>
</ui>

0 comments on commit 5b80d3a

Please sign in to comment.