diff --git a/src/library/autodj/autodjprocessor.cpp b/src/library/autodj/autodjprocessor.cpp index 165d2c6c4c9..3c1e0d6f927 100644 --- a/src/library/autodj/autodjprocessor.cpp +++ b/src/library/autodj/autodjprocessor.cpp @@ -120,15 +120,17 @@ AutoDJProcessor::AutoDJProcessor( m_eState(ADJ_DISABLED), m_transitionProgress(0.0), m_transitionTime(kTransitionPreferenceDefault) { - m_pAutoDJTableModel = new PlaylistTableModel(this, pTrackCollectionManager, - "mixxx.db.model.autodj"); + m_pAutoDJTableModel = new PlaylistTableModel( + this, pTrackCollectionManager, "mixxx.db.model.autodj"); m_pAutoDJTableModel->selectPlaylist(iAutoDJPlaylistId); m_pAutoDJTableModel->select(); m_pShufflePlaylist = new ControlPushButton( ConfigKey("[AutoDJ]", "shuffle_playlist")); - connect(m_pShufflePlaylist, &ControlPushButton::valueChanged, - this, &AutoDJProcessor::controlShuffle); + connect(m_pShufflePlaylist, + &ControlPushButton::valueChanged, + this, + &AutoDJProcessor::controlShuffle); m_pSkipNext = new ControlPushButton( ConfigKey("[AutoDJ]", "skip_next")); @@ -169,7 +171,8 @@ AutoDJProcessor::AutoDJProcessor( m_pCOCrossfader = new ControlProxy("[Master]", "crossfader"); m_pCOCrossfaderReverse = new ControlProxy("[Mixer Profile]", "xFaderReverse"); - + m_crossfaderStartCenter = false; + QString str_autoDjTransition = m_pConfig->getValueString( ConfigKey(kConfigKey, kTransitionPreferenceName)); if (!str_autoDjTransition.isEmpty()) { @@ -808,12 +811,14 @@ void AutoDJProcessor::playerPositionChanged(DeckAttributes* pAttributes, otherDeck->setPlayPosition(otherDeck->startPos); } - if (!otherDeckPlaying) { - otherDeck->play(); + if (m_crossfaderStartCenter) { + setCrossfader(0.0); + } else if (thisDeck->fadeBeginPos >= thisDeck->fadeEndPos) { + setCrossfader(thisDeck->isLeft() ? 1.0 : -1.0); } - if (thisDeck->fadeBeginPos >= thisDeck->fadeEndPos) { - setCrossfader(thisDeck->isLeft() ? 1.0 : -1.0); + if (!otherDeckPlaying) { + otherDeck->play(); } // Now that we have started the other deck playing, remove the track @@ -832,6 +837,7 @@ void AutoDJProcessor::playerPositionChanged(DeckAttributes* pAttributes, double crossfaderTarget; if (m_eState == ADJ_LEFT_FADING) { crossfaderTarget = 1.0; + } else if (m_eState == ADJ_RIGHT_FADING) { crossfaderTarget = -1.0; } else { @@ -1342,6 +1348,7 @@ void AutoDJProcessor::calculateTransition(DeckAttributes* pFromDeck, << "outroLength" << outroLength; } + m_crossfaderStartCenter = false; switch (m_transitionMode) { case TransitionMode::FullIntroOutro: { // Use the outro or intro length for the transition time, whichever is @@ -1441,6 +1448,10 @@ void AutoDJProcessor::calculateTransition(DeckAttributes* pFromDeck, useFixedFadeTime(pFromDeck, pToDeck, fromDeckPosition, outroEnd, toDeckStartSeconds); } } break; + case TransitionMode::FixedStartCenterSkipSilence: + m_crossfaderStartCenter = true; + // fall through intended! + [[fallthrough]]; case TransitionMode::FixedSkipSilence: { double toDeckStartSecond; pToDeck->fadeBeginPos = getLastSoundSecond(pToDeck); diff --git a/src/library/autodj/autodjprocessor.h b/src/library/autodj/autodjprocessor.h index 600cf7bfb70..3d60893b7c5 100644 --- a/src/library/autodj/autodjprocessor.h +++ b/src/library/autodj/autodjprocessor.h @@ -163,7 +163,8 @@ class AutoDJProcessor : public QObject { FullIntroOutro, FadeAtOutroStart, FixedFullTrack, - FixedSkipSilence + FixedSkipSilence, + FixedStartCenterSkipSilence }; AutoDJProcessor(QObject* pParent, @@ -285,6 +286,7 @@ class AutoDJProcessor : public QObject { double m_transitionProgress; double m_transitionTime; // the desired value set by the user TransitionMode m_transitionMode; + bool m_crossfaderStartCenter; QList m_decks; diff --git a/src/library/autodj/dlgautodj.cpp b/src/library/autodj/dlgautodj.cpp index c8d2582a0ce..84d931444ff 100644 --- a/src/library/autodj/dlgautodj.cpp +++ b/src/library/autodj/dlgautodj.cpp @@ -179,6 +179,8 @@ DlgAutoDJ::DlgAutoDJ(WLibrary* parent, static_cast(AutoDJProcessor::TransitionMode::FixedFullTrack)); fadeModeCombobox->addItem(tr("Skip Silence"), static_cast(AutoDJProcessor::TransitionMode::FixedSkipSilence)); + fadeModeCombobox->addItem(tr("Skip Silence Start Full Volume"), + static_cast(AutoDJProcessor::TransitionMode::FixedStartCenterSkipSilence)); fadeModeCombobox->setCurrentIndex( fadeModeCombobox->findData(static_cast(m_pAutoDJProcessor->getTransitionMode()))); connect(fadeModeCombobox,