summaryrefslogtreecommitdiffstats
path: root/src/dlgautodj.cpp
diff options
context:
space:
mode:
authorDaniel Schürmann <daschuer@mixxx.org>2014-07-10 23:28:39 +0200
committerDaniel Schürmann <daschuer@mixxx.org>2014-07-10 23:28:39 +0200
commit2254d84d7bd56a888ebb41dcf19d72fe72dd700d (patch)
tree4c35923283df860dd4a3922327dcee2e9c394dc7 /src/dlgautodj.cpp
parenta442a09bc7998a28d02592f08484d040424a6ff2 (diff)
Fix bug that produces a suddent crossfader jump ..
when using auto dj and you have moved the crossfader manually. The fix is a kind of softtacover for the crossfader from auto DJ.
Diffstat (limited to 'src/dlgautodj.cpp')
-rw-r--r--src/dlgautodj.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/dlgautodj.cpp b/src/dlgautodj.cpp
index efb7f482bd..cd251fece6 100644
--- a/src/dlgautodj.cpp
+++ b/src/dlgautodj.cpp
@@ -169,11 +169,23 @@ double DlgAutoDJ::getCrossfader() const {
return m_pCOCrossfader->get();
}
-void DlgAutoDJ::setCrossfader(double value) {
+void DlgAutoDJ::setCrossfader(double value, bool right) {
if (m_pCOCrossfaderReverse->get() > 0.0) {
value *= -1.0;
+ right = !right;
+ }
+ double current_value = m_pCOCrossfader->get();
+ if (right) {
+ // ignore if we move slider left
+ if (value > current_value) {
+ m_pCOCrossfader->set(value);
+ }
+ } else {
+ // ignore if we move slider right
+ if (value < current_value) {
+ m_pCOCrossfader->set(value);
+ }
}
- m_pCOCrossfader->slotSet(value);
}
void DlgAutoDJ::loadSelectedTrack() {
@@ -365,7 +377,7 @@ void DlgAutoDJ::player1PositionChanged(double value) {
if (m_eState == ADJ_ENABLE_P1LOADED) {
// Auto DJ Start
if (!deck1Playing && !deck2Playing) {
- setCrossfader(-1.0); // Move crossfader to the left!
+ setCrossfader(-1.0, false); // Move crossfader to the left!
m_pCOPlay1->slotSet(1.0); // Play the track in player 1
removePlayingTrackFromQueue("[Channel1]");
} else {
@@ -388,7 +400,7 @@ void DlgAutoDJ::player1PositionChanged(double value) {
if (m_eState == ADJ_P2FADING) {
if (deck1Playing && !deck2Playing) {
// End State
- setCrossfader(-1.0); // Move crossfader to the left!
+ setCrossfader(-1.0, false); // Move crossfader to the left!
m_eState = ADJ_IDLE;
pushButtonFadeNow->setEnabled(true);
loadNextTrackFromQueue();
@@ -437,7 +449,7 @@ void DlgAutoDJ::player1PositionChanged(double value) {
2*(value-m_posThreshold1)/(posFadeEnd-m_posThreshold1);
// crossfadeValue = -1.0f -> + 1.0f
// Move crossfader to the right!
- setCrossfader(crossfadeValue);
+ setCrossfader(crossfadeValue, true);
}
}
}
@@ -462,7 +474,7 @@ void DlgAutoDJ::player2PositionChanged(double value) {
if (!deck1Playing && deck2Playing) {
// End State
// Move crossfader to the right!
- setCrossfader(1.0);
+ setCrossfader(1.0, true);
m_eState = ADJ_IDLE;
pushButtonFadeNow->setEnabled(true);
loadNextTrackFromQueue();
@@ -510,7 +522,7 @@ void DlgAutoDJ::player2PositionChanged(double value) {
float crossfadeValue = 1.0f -
2*(value-m_posThreshold2)/(posFadeEnd-m_posThreshold2);
// crossfadeValue = 1.0f -> + -1.0f
- setCrossfader(crossfadeValue); //Move crossfader to the right!
+ setCrossfader(crossfadeValue, false); // Move crossfader to the left!
}
}
}