Skip to content

Commit

Permalink
Introduction of a new transition mode: called "Skip Silence Start Ful…
Browse files Browse the repository at this point in the history
…l Volume".

As an option to set the Crossfader to the center as AutoDj starts a crossfade so the track starts at full volume.
  • Loading branch information
davidlmorris authored and daschuer committed Oct 8, 2024
1 parent 400ae46 commit fad5b9d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
27 changes: 19 additions & 8 deletions src/library/autodj/autodjprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down Expand Up @@ -169,6 +171,7 @@ 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));
Expand Down Expand Up @@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion src/library/autodj/autodjprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ class AutoDJProcessor : public QObject {
FullIntroOutro,
FadeAtOutroStart,
FixedFullTrack,
FixedSkipSilence
FixedSkipSilence,
FixedStartCenterSkipSilence
};

AutoDJProcessor(QObject* pParent,
Expand Down Expand Up @@ -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<DeckAttributes*> m_decks;

Expand Down
2 changes: 2 additions & 0 deletions src/library/autodj/dlgautodj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ DlgAutoDJ::DlgAutoDJ(WLibrary* parent,
static_cast<int>(AutoDJProcessor::TransitionMode::FixedFullTrack));
fadeModeCombobox->addItem(tr("Skip Silence"),
static_cast<int>(AutoDJProcessor::TransitionMode::FixedSkipSilence));
fadeModeCombobox->addItem(tr("Skip Silence Start Full Volume"),
static_cast<int>(AutoDJProcessor::TransitionMode::FixedStartCenterSkipSilence));
fadeModeCombobox->setCurrentIndex(
fadeModeCombobox->findData(static_cast<int>(m_pAutoDJProcessor->getTransitionMode())));
connect(fadeModeCombobox,
Expand Down

0 comments on commit fad5b9d

Please sign in to comment.