Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make better use of intro/outro markers with AutoDJ #2103

Merged
merged 225 commits into from
Nov 10, 2019
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
225 commits
Select commit Hold shift + click to select a range
0147a4f
make better use of intro/outro markers with AutoDJ
Be-ing May 6, 2019
7163fd3
add option to choose shorter or longer of intro/outro for AutoDJ
Be-ing May 6, 2019
7cfe38e
convert SeekOnLoadMode to enum class
Be-ing May 7, 2019
febce9b
don't load at intro start when not using intro/outro with AutoDJ
Be-ing May 7, 2019
450d409
add option to load tracks at intro start marker
Be-ing May 7, 2019
c45b27f
convert Cue::CueType to enum class
Be-ing May 7, 2019
580c20b
convert Cue::CueSource to enum class
Be-ing May 7, 2019
bad1178
rename tio -> pTrack in AnalyzerSilence
Be-ing May 7, 2019
648aaa7
add new FirstSound/LastSound cues separate from Intro/Outro
Be-ing May 7, 2019
6532bd7
add new AutoDJ mode that skips silence with fixed fade time
Be-ing May 7, 2019
3e11cf5
add "Fade mode" label to DlgAutoDJ
Be-ing May 7, 2019
45f68e4
add AutoDJ mode to start at cue point with fixed fade time
Be-ing May 7, 2019
04b02f7
rename introOutroCombobox -> fadeModeCombobox
Be-ing May 7, 2019
b1a74b5
AutoDJProcessor refactor useIntro/OutroFadeTime functions
Be-ing May 7, 2019
1fa74b0
remove hacky message passing via CO from AutoDJProcessor to CueControl
Be-ing May 7, 2019
eec6bad
AutoDJProcessor: seek on track load, not at transition
Be-ing May 7, 2019
d3748e9
update outdated function names
Be-ing May 7, 2019
bc78357
seek to correct start point when changing AutoDJ mode
Be-ing May 7, 2019
caaff2d
rename posThreshold -> fadeBeginPos
Be-ing May 7, 2019
b02feb0
AutoDJ: add align intro/outro start/end modes
Be-ing May 8, 2019
c7cbebd
remove debug messages
Be-ing May 9, 2019
8a6dc26
change name of new ConfigKey to better match its function
Be-ing May 9, 2019
3971e4a
change default transition mode to align intro + outro start
Be-ing May 9, 2019
adb4b14
AutoDJ: remove "Intro/outro" transition modes
Be-ing May 9, 2019
5df43f6
use QComboBox itemData in DlgAutoDJ
Be-ing May 9, 2019
cbe8b37
move "Align intro + outro start/end" modes to top of combobox
Be-ing May 9, 2019
d3910ed
shorten variable names for easier readability
Be-ing May 9, 2019
98d9daa
use first/last sound as fallbacks for intro start/outro end
Be-ing May 9, 2019
e5571d7
simplify code a little
Be-ing May 9, 2019
bf7a20c
add comment explaining how fadeDuration is determined
Be-ing May 9, 2019
313e894
AutoDJ: improve error handling if next track is too short
Be-ing May 9, 2019
a38c0b3
AutoDJ: remove redundant error handling if next track is too short
Be-ing May 9, 2019
2320643
AutoDJ: use last sound as end point with load at cue mode
Be-ing May 9, 2019
222a991
DlgPrefDeck: change load point selection from radio buttons to combobox
Be-ing May 9, 2019
97597d3
add option to load new tracks at intro end point
Be-ing May 9, 2019
c1dd217
AutoDJ: improve error handling when next track is 0 length
Be-ing May 9, 2019
66c42b1
Merge remote-tracking branch 'upstream/master' into autodj_intro_outro
Be-ing May 10, 2019
187e5a9
Merge remote-tracking branch 'upstream/master' into autodj_intro_outro
Be-ing May 15, 2019
6c7b335
AutoDJ: add tooltip for fade mode combobox
Be-ing May 25, 2019
5faf0de
AutoDJ: explicitly explain spinbox is not used in intro/outro modes
Be-ing May 25, 2019
242ab69
Merge remote-tracking branch 'upstream/master' into autodj_intro_outro
Be-ing Jun 9, 2019
fc5eb53
fix segfaulting in AutoDJ tests
Be-ing Jun 9, 2019
a1b1038
Merge remote-tracking branch 'upstream/master' into autodj_intro_outro
Be-ing Jun 17, 2019
0bc0587
Merge remote-tracking branch 'upstream/master' into autodj_intro_outro
Be-ing Jun 17, 2019
9c43bac
rename variable for clarity
Be-ing Jun 17, 2019
4c035dc
"Beginning of file" -> "Beginning of track"
Be-ing Jun 17, 2019
c7ba79c
Merge remote-tracking branch 'upstream/master' into autodj_intro_outro3
daschuer Jul 8, 2019
4393cc6
Added missing includes
daschuer Jun 11, 2019
fb7114e
Introduce kKeepPosition to allow not requeing the "to deck"
daschuer Jul 9, 2019
0697e5a
Improve assertions if the tracks have no duration
daschuer Jul 9, 2019
80557fc
Inhibit transition recalculation during loading a track
daschuer Jul 9, 2019
cd3896c
Use switch in calculateTransition()
daschuer Jul 9, 2019
422429a
Clang-format: reorder includes
daschuer Jul 9, 2019
4492823
Fix negative intro and outro length
daschuer Jul 9, 2019
9b562c9
Adjust autro in case of FadeNow
daschuer Jul 10, 2019
06beddc
imrove switch cases in calculateTransition() a bit
daschuer Jul 13, 2019
d80648e
Clean up playerPositionChanged()
daschuer Jul 13, 2019
29ab888
use fadeEndPos instead of fadeDuration, because it is more significan…
daschuer Jul 14, 2019
eaca9ff
improve debug
daschuer Jul 14, 2019
f640846
Intergate short track checks into conditional blocks of fade modes
daschuer Jul 16, 2019
6850e7f
Rename ADJ_P1/2FADING to ADJ_LEFT/RIGHT_FADING
daschuer Jul 16, 2019
499146a
stop transition if toDeck track OR fromDeck track is too short.
daschuer Jul 16, 2019
6f98fd4
Respect manual xfader changes in case of Auto DJ is fading as well. F…
daschuer Jul 20, 2019
825912c
Adopt current position as new fade start point in case of manual cue-…
daschuer Jul 21, 2019
570e50c
Merge pull request #23 from daschuer/autodj_intro_outro_merge
Be-ing Jul 22, 2019
6e7f171
fix typos
daschuer Jul 22, 2019
71c7acf
improve comments
daschuer Jul 22, 2019
032dc1f
remove stray "
daschuer Jul 22, 2019
d212dd9
Fix issue that Woverview displays an outdated playposition
daschuer Jul 22, 2019
e109bf1
Improve comments more
daschuer Jul 22, 2019
c7a1d1d
rename parameter seek to seekToStartPoint
daschuer Jul 23, 2019
d87db38
delete removed "seekonload_mode" CO from tests
daschuer Jul 23, 2019
c0052a9
Merge pull request #22 from daschuer/autodj_intro_outro
Be-ing Jul 23, 2019
33ac5c5
minor code style
daschuer Jul 28, 2019
7b8aade
Introduce a new LimitedIntroOutroStart transition mode
daschuer Aug 3, 2019
a4d8b4e
getOutroEndPosition() always returns a valid value
daschuer Aug 3, 2019
adcbc3a
getIntroStartPosition() alwasy returns a valid value
daschuer Aug 3, 2019
a5d3b9f
Adjust tests for new crossfader handling
daschuer Aug 4, 2019
8e4669c
fix more AutoDJ tets
daschuer Aug 4, 2019
72dd93c
Merge pull request #24 from daschuer/autodj_intro_outro
Be-ing Aug 9, 2019
689b5a0
use fadeLength instead of m_transitionTime
Be-ing Aug 9, 2019
79c1b00
edit comments for typos and clarity
Be-ing Aug 9, 2019
d315f0c
AutoDJ: add intro/outro smooth and quick modes
Be-ing Aug 9, 2019
a1174e0
AutoDJ: set default transition mode to "Intro/Outro (smooth transition)"
Be-ing Aug 9, 2019
b52de8a
AutoDJ: remove align intro/outro start/end modes
Be-ing Aug 9, 2019
c3108c6
AutoDJ: remove "Limited intro + outro start" mode
Be-ing Aug 9, 2019
c48afb0
AutoDJ: remove "Fixed time (start at cue)" mode
Be-ing Aug 9, 2019
f8c5633
improve comments with diagrams
Be-ing Aug 9, 2019
f6153cc
rearrange code
Be-ing Aug 9, 2019
3fc81c7
move AutoDJ repeat playlist option to main window from preferences
Be-ing Aug 9, 2019
8784be7
fix reloading of AutoDJ transition mode on startup
Be-ing Aug 10, 2019
73089e5
make AutoDJ TransitionMode enum class 0 indexed
Be-ing Aug 10, 2019
932c48c
replace FirstSound & LastSound cue types with one AudibleSound range cue
Be-ing Aug 10, 2019
1263b46
fix CueControl tests
Be-ing Aug 10, 2019
e69c34b
fix engine tests
Be-ing Aug 10, 2019
461b7ca
AutoDJ: update transition mode tooltip
Be-ing Aug 10, 2019
f846e67
remove "Intro/Outro (quick transition)" mode; leave only the smooth mode
Be-ing Aug 10, 2019
bd39923
remove option to load decks at intro end
Be-ing Aug 11, 2019
7cdb5ed
reimplement Align Intro + Outro Start mode
Be-ing Aug 11, 2019
429da12
AutoDJ: edit transition mode tooltip
Be-ing Aug 11, 2019
611503c
AutoDJ: let user seek to end of next deck to set outro cues
Be-ing Aug 11, 2019
8e6268b
AutoDJ: if the "to deck" is played to the end, seek back to the start
Be-ing Aug 11, 2019
2e045d3
fix segfault in AutoDJ tests
Be-ing Aug 11, 2019
888464b
AutoDJ: workaround to avoid weird state with deck cloning feature
Be-ing Aug 11, 2019
05beecf
AutoDJ: fix transitions with a transition time of 0
Be-ing Aug 12, 2019
620e5f6
AutoDJ: use intro length as transition time for "Fade now" button
Be-ing Aug 12, 2019
107c61d
remove useless tracking of automatic vs manually placed cues
Be-ing Aug 12, 2019
aa05871
clarify code with a named constant
Be-ing Aug 12, 2019
654e984
AutoDJ: rename "Intro + Outro" transition mode to "Full Intro + Outro"
Be-ing Aug 13, 2019
1ed918c
AutoDJ: edit transition mode tooltip
Be-ing Aug 13, 2019
fbb274c
Merge remote-tracking branch 'upstream/master' into autodj_intro_outro
Be-ing Aug 20, 2019
9d66c63
move workaround for AutoDJ cloning decks to PlayerManager
Be-ing Aug 20, 2019
2f8d524
Merge remote-tracking branch 'upstream/master' into autodj_intro_outro
Be-ing Aug 23, 2019
ddd872b
add option to move intro start with main cue
Be-ing Aug 27, 2019
1f93568
create enum class for CueMode
Be-ing Aug 31, 2019
0a5c8d6
move intro start with main cue if not using Denon or Numark modes
Be-ing Aug 31, 2019
f62e4ee
update AutoDJ tests for new intro/outro transition modes
Be-ing Aug 27, 2019
7189270
Merge remote-tracking branch 'upstream/master' into autodj_intro_outro
Be-ing Aug 31, 2019
651b620
AutoDJ: disable debugging output
Be-ing Sep 1, 2019
561bc5e
DlgAutoDJ: remove "Fade mode" label for combobox
Be-ing Sep 2, 2019
e2b5dba
AutoDJ: rename transition modes and revise transition mode tooltip
Be-ing Sep 2, 2019
0bf4166
Cue::Type::Hotcue -> Cue::Type::HotCue
Be-ing Sep 2, 2019
4f753c9
AutoDJ: use outroEnd/introStart as fallbacks instead of first/last sound
Be-ing Sep 2, 2019
7fd8e71
AutoDJ: improve handling of edge case with Fade Now button
Be-ing Sep 2, 2019
8d26c08
AutoDJ: simplify redundant code
Be-ing Sep 2, 2019
05351e6
AutoDJ: load next track if user crossfades manually
Be-ing Sep 2, 2019
29c31f4
Style Auto DJ dialog
daschuer Sep 3, 2019
be58358
Group transition time with transition mode combobox.
daschuer Sep 3, 2019
500cb4d
Merge pull request #25 from daschuer/autodj_intro_outro
Be-ing Sep 6, 2019
6e1932c
Merge remote-tracking branch 'upstream/master' into autodj_intro_outro
Be-ing Sep 9, 2019
af9a2ff
add SkinButton class and use it for WLibrary
Be-ing Sep 10, 2019
bcc8d16
AutoDJ: change Repeat playlist checkbox to button with icon
Be-ing Sep 10, 2019
0bcd3f4
reuse looping icons for AutoDJ repeat playlist button
Be-ing Sep 10, 2019
2e6f6fd
DlgAutoDJ: use Qt5 function pointer signal-slot syntax
Be-ing Sep 10, 2019
5f3bc70
remove debug message
Be-ing Sep 10, 2019
4b6567f
DlgAutoDJ: let skins specify icons for rest of buttons
Be-ing Sep 10, 2019
4a6dab2
WLibrary: make m_icons private and add const getter function
Be-ing Sep 10, 2019
381ba21
Merge remote-tracking branch 'upstream/master' into autodj_intro_outro
Be-ing Sep 15, 2019
d15eee1
use more accurate local variable name
Be-ing Sep 19, 2019
cdb8148
AutoDJ: don't skip to next track when pausing during a transition
Be-ing Sep 19, 2019
0fd21f9
AutoDJ: use spinbox time for Fade Now if before intro start
Be-ing Sep 19, 2019
3a7df2e
Merge remote-tracking branch 'upstream/master' into autodj_intro_outro
Be-ing Sep 19, 2019
f13bb5d
AutoDJ: skip track if its duration is <= 0
Be-ing Sep 26, 2019
ccdcb47
Merge remote-tracking branch 'upstream/master' into autodj_intro_outro
Be-ing Oct 1, 2019
ab21ba9
Merge remote-tracking branch 'upstream/master' into autodj_intro_outro
Be-ing Oct 1, 2019
d5b11cf
AutoDJProcessor: improve debug message in calculateTransition
Be-ing Oct 5, 2019
27c0b6d
AutoDJProcessor: fix Full Track mode with transtion time 0
Be-ing Oct 6, 2019
d635329
AutoDJProcessor: remove superfluous if condition
Be-ing Oct 14, 2019
36e31e5
CueControl: move local variable declaration closer to usage
Be-ing Oct 14, 2019
d284d5e
use ControlProxy::toBool
Be-ing Oct 14, 2019
2003966
use parented_ptr for ControlProxy
Be-ing Oct 14, 2019
3d7320b
PlayerManager: fix initialization order
Be-ing Oct 14, 2019
f576021
CueControl: move setting intro start with main cue to loadCuesFromTrack
Be-ing Oct 14, 2019
6a4ea7c
DlgAutoDJ: add header to fade mode tooltip
Be-ing Oct 14, 2019
11ce939
AutoDJProcessor: correct comment
Be-ing Oct 14, 2019
f97d31e
Fix stalled auto DJ when track is seeked to the very end and the user
daschuer Oct 16, 2019
a44daca
move setting of intro start to main cue point to AnalyzerSilence
Be-ing Oct 21, 2019
8d23116
AnalyzerSilence: don't run if user has unset intro start or outro end
Be-ing Oct 21, 2019
ece0161
AnalyzerSilence: only add AudibleSound cue if it does not exist already
Be-ing Oct 21, 2019
5ab052d
AnalyzerSilence: rename oldMainCue -> mainCue
Be-ing Oct 21, 2019
77d25ad
DlgPrefDeck: improve wording/tooltip for intro start option
Be-ing Oct 21, 2019
0b79250
AnalyzerSilence: better name for local variables
Be-ing Oct 22, 2019
b2d35ef
AnalyzerSilence: simplify conditional logic
Be-ing Oct 22, 2019
187024f
AnalyzerSilence: improve local variable naming again
Be-ing Oct 22, 2019
b2d8bdd
AnalyzerSilence: reimplement moving default cue point to first sound …
Be-ing Oct 22, 2019
0a2fda2
Cue: rename setPosition to setStartPosition
Be-ing Oct 22, 2019
4970f0b
Cue: add setEndPosition method
Be-ing Oct 22, 2019
dd77030
AnalyzerSilence: use Cue::setEndPosition instead of Cue::setLength
Be-ing Oct 22, 2019
0bc70f6
WTrackTableView: add clear Intro/Outro actions to Reset metadata menu
Be-ing Oct 22, 2019
61e2e28
AnalyzerSilence: always set AudibleSound start/end point
Be-ing Oct 22, 2019
65fc8d0
explicitly compare to nullptr
Be-ing Oct 22, 2019
1d97fb6
replace <Buttons> in skin XML for DlgAutoDJ with <ShowButtonText> option
Be-ing Oct 22, 2019
e997ff1
Merge remote-tracking branch 'upstream/master' into autodj_intro_outro
Be-ing Oct 22, 2019
33adf4b
Use Cue::kPositionNotDefined for unset cue positions.
daschuer Oct 22, 2019
e1726f3
Merge pull request #30 from daschuer/autodj_intro_outro
Be-ing Oct 22, 2019
cba9dce
rename Cue::kPositionNotDefined -> Cue::kNoPosition
Be-ing Oct 22, 2019
a15169e
move kNoHotCue constant from WaveformMark to Cue
Be-ing Oct 23, 2019
b204342
use Cue::kNoHotCue constant
Be-ing Oct 23, 2019
ee9cfcc
CueControl: use Cue::kNoPosition constant in more places
Be-ing Oct 23, 2019
28d5066
Seek to start if the to deck is already behind the fade start of the …
daschuer Oct 23, 2019
d855e37
Use transition time when starting autoDJ with fromDeck behind the out…
daschuer Oct 23, 2019
0663bab
Improve comments
daschuer Oct 23, 2019
7daa180
Merge pull request #31 from daschuer/autodj_intro_outro
Be-ing Oct 23, 2019
eb2b0ba
AutoDJProcessor: add debug assertion for fadeNow
Be-ing Oct 24, 2019
c00eb3f
Merge branch 'autodj_intro_outro' of github.com:Be-ing/mixxx into aut…
Be-ing Oct 24, 2019
e53e9e5
add AutoDJ icons to LateNight
ronso0 Oct 24, 2019
01f354f
add AutoDJ icons to Deere, and ...
ronso0 Oct 24, 2019
2076520
add AutoDJ icons to Shade, adapt AutoDJ controls to color schemes
ronso0 Oct 25, 2019
8757fdf
add AutoDJ icons to Tango
ronso0 Oct 25, 2019
0d02783
brighter AutoDJ icons in LateNight
ronso0 Oct 25, 2019
aea297c
new Skip icon in Deere
ronso0 Oct 25, 2019
4c7b352
re-arrange AutoDJ controls, adapt skin stylesheets
ronso0 Oct 25, 2019
265b3c6
Merge pull request #32 from ronso0/autodj-icons2
Be-ing Oct 25, 2019
1fd1a04
Use mode dependent pToDeck->fadeBeginPos for limiting the transition …
daschuer Oct 25, 2019
010fd5c
Fix auto dj stop issue in case of short tracks
daschuer Oct 26, 2019
e93ee52
Merge pull request #33 from daschuer/autodj_intro_outro
Be-ing Oct 26, 2019
c1010a6
make emitLoadTrackToPlayer and emitAutoDJStateChanged a protected non…
daschuer Oct 27, 2019
cf658a9
move no outro start fallback code into getOutroStartPosition()
daschuer Oct 27, 2019
df29633
consider current position of the from deck after chaning the transiti…
daschuer Oct 27, 2019
2b1f525
fix AutoDJProcessorTest.FadeToDeck2_Long_Transition test. This fixes …
daschuer Oct 27, 2019
5e6988e
Cache hasFadeTransition before possible override
daschuer Oct 28, 2019
74fdcb8
Adjust FadeToDeck2_Pause_Transition for no fading transitions
daschuer Oct 28, 2019
277f5da
improve comments
daschuer Oct 28, 2019
96a5a45
improve error handing in case of -1 cue positions.
daschuer Oct 28, 2019
873e313
improve crossfaderChanged()
daschuer Oct 29, 2019
d6e6cf4
Adjust short track workaround in outro start mode
daschuer Oct 30, 2019
70214df
Adjust intro and outro change slots
daschuer Oct 30, 2019
e1c45e5
don't bother with playing state when calculating a new transition
daschuer Oct 30, 2019
6dac3a6
Don't use non cons references in playerPositionChanged() and remove f…
daschuer Oct 31, 2019
fd36927
Don't use non const references in toggleAutoDJ()
daschuer Oct 31, 2019
2f88f54
Reset startPos, just in case calculateTransition() is not able to set…
daschuer Oct 31, 2019
7036b74
Set the just loaded deck as toDeck
daschuer Nov 3, 2019
9951daa
respect the rate slider when calculating auto-DJ transitions
daschuer Nov 4, 2019
db49654
Whatch rate changes
daschuer Nov 4, 2019
efa6c00
fix recursive positionChanged call. Fix omitting fist seek.
daschuer Nov 7, 2019
7658b51
Merge pull request #34 from daschuer/autodj_intro_outro
Be-ing Nov 7, 2019
e9bee7f
fix incorrect cue quantization with prevBeat
Swiftb0y Nov 8, 2019
d099f04
small refactor: CueControl:quantizeCurrentPosition
Swiftb0y Nov 8, 2019
10a4949
added quantize fix to QuantizeCurrentPosition
Swiftb0y Nov 8, 2019
7a6bdc7
refactored ternary expressions to if clauses
Swiftb0y Nov 8, 2019
a744e43
Merge pull request #36 from Swiftb0y/fix_hotcue_setting
Be-ing Nov 8, 2019
5aafbd2
Prevent to move outro end past the end of the track if quantize is en…
daschuer Nov 9, 2019
ea3f2b9
git-clang-format
daschuer Nov 9, 2019
082e2e6
Fix a bug where outro end was passed the end of the track, because no…
daschuer Nov 10, 2019
1ab1853
Merge pull request #38 from daschuer/autodj_intro_outro
Be-ing Nov 10, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
60 changes: 30 additions & 30 deletions src/engine/controls/cuecontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ CueControl::CueControl(QString group,

m_pCueMode = new ControlObject(ConfigKey(group, "cue_mode"));

m_pSeekOnLoadMode = new ControlObject(ConfigKey(group, "seekonload_mode"));
m_pSeekOnLoadModeAutoDjOverride = new ControlObject(ConfigKey(group, "seekonload_mode_autodj"));
m_pSeekOnLoadModeAutoDjOverride->set(static_cast<double>(
static_cast<int>(SeekOnLoadMode::UsePreference)));

m_pCueSet = new ControlPushButton(ConfigKey(group, "cue_set"));
m_pCueSet->setButtonMode(ControlPushButton::TRIGGER);
Expand Down Expand Up @@ -207,7 +209,7 @@ CueControl::CueControl(QString group,
CueControl::~CueControl() {
delete m_pCuePoint;
delete m_pCueMode;
delete m_pSeekOnLoadMode;
delete m_pSeekOnLoadModeAutoDjOverride;
delete m_pCueSet;
delete m_pCueClear;
delete m_pCueGoto;
Expand Down Expand Up @@ -347,29 +349,26 @@ void CueControl::trackLoaded(TrackPointer pNewTrack) {
loadCuesFromTrack();

// Seek track according to SeekOnLoadMode.
SeekOnLoadMode seekOnLoadMode = getSeekOnLoadMode();
SeekOnLoadMode seekOnLoadMode = getSeekOnLoadModeAutoDjOverride();
if (seekOnLoadMode == SeekOnLoadMode::UsePreference) {
seekOnLoadMode = getSeekOnLoadPreference();
}
switch (seekOnLoadMode) {
case SEEK_ON_LOAD_ZERO_POS:
seekExact(0.0);
case SeekOnLoadMode::Beginning:
// This allows users to load tracks and have the needle-drop be maintained.
if (!(m_pVinylControlEnabled->get() &&
m_pVinylControlMode->get() == MIXXX_VCMODE_ABSOLUTE)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this should be checked for any other SeekOnLoadModes. @ywwg maybe you can clarify?

seekExact(0.0);
}
break;
case SEEK_ON_LOAD_MAIN_CUE:
case SeekOnLoadMode::MainCue:
seekExact(m_pCuePoint->get());
break;
case SEEK_ON_LOAD_INTRO_CUE:
case SeekOnLoadMode::IntroStart:
seekExact(m_pIntroStartPosition->get());
break;
default:
// Respect cue recall preference option.
if (isCueRecallEnabled() && m_pCuePoint->get() != -1.0) {
// If cue recall is ON and main cue point is set, seek to it.
seekExact(m_pCuePoint->get());
} else if (!(m_pVinylControlEnabled->get() &&
m_pVinylControlMode->get() == MIXXX_VCMODE_ABSOLUTE)) {
// Otherwise, seek to zero unless vinylcontrol is on and
// set to absolute. This allows users to load tracks and
// have the needle-drop be maintained.
seekExact(0.0);
}
seekExact(0.0);
break;
}
}
Expand Down Expand Up @@ -491,16 +490,16 @@ void CueControl::reloadCuesFromTrack() {
double intro = m_pIntroStartPosition->get();

// Make track follow the updated cues.
SeekOnLoadMode seekOnLoadMode = getSeekOnLoadMode();
if (seekOnLoadMode == SEEK_ON_LOAD_DEFAULT) {
if ((trackAt == TrackAt::Cue || wasTrackAtZeroPos) && cue != -1.0 && isCueRecallEnabled()) {
seekExact(cue);
}
} else if (seekOnLoadMode == SEEK_ON_LOAD_MAIN_CUE) {
SeekOnLoadMode seekOnLoadMode = getSeekOnLoadModeAutoDjOverride();
if (seekOnLoadMode == SeekOnLoadMode::UsePreference) {
seekOnLoadMode = getSeekOnLoadPreference();
}

if (seekOnLoadMode == SeekOnLoadMode::MainCue) {
if ((trackAt == TrackAt::Cue || wasTrackAtZeroPos) && cue != -1.0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use kNoTrigger and everywhere else in this file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we put this off? I am not trying to refactor all the code. This PR has already had to deal with lots of merge conflicts because of making big changes and sitting unmerged for months.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was introduced in this PR that we use kNoTrigger, originally introduced for looping also for cue points. It is ok for me to reuse this constant for cue here, but that means to update all occurences. Without this, there is a risk of errors in case we decide later to move a way from the -1 that is unfortunate a valid cue point on the lead in.
It would be also ok to postpone this change into a separate PR. In general this is the best strategy anyway, cut out trivial refactorings and merge them before a feature PR.

seekExact(cue);
}
} else if (seekOnLoadMode == SEEK_ON_LOAD_INTRO_CUE) {
} else if (seekOnLoadMode == SeekOnLoadMode::IntroStart) {
if ((wasTrackAtIntroCue || wasTrackAtZeroPos) && intro != -1.0) {
Be-ing marked this conversation as resolved.
Show resolved Hide resolved
seekExact(intro);
}
Expand Down Expand Up @@ -1631,13 +1630,14 @@ bool CueControl::isPlayingByPlayButton() {
!m_iCurrentlyPreviewingHotcues && !m_bPreviewing;
}

bool CueControl::isCueRecallEnabled() {
// Note that [Controls],CueRecall == 0 corresponds to "ON", not "OFF".
return getConfig()->getValue(ConfigKey("[Controls]", "CueRecall"), 0) == 0;
SeekOnLoadMode CueControl::getSeekOnLoadPreference() {
int configValue = getConfig()->getValue(ConfigKey("[Controls]", "CueRecall"),
static_cast<int>(SeekOnLoadMode::IntroStart));
return static_cast<SeekOnLoadMode>(configValue);
}

SeekOnLoadMode CueControl::getSeekOnLoadMode() {
return seekOnLoadModeFromDouble(m_pSeekOnLoadMode->get());
SeekOnLoadMode CueControl::getSeekOnLoadModeAutoDjOverride() {
return seekOnLoadModeFromDouble(m_pSeekOnLoadModeAutoDjOverride->get());
}


Expand Down
26 changes: 11 additions & 15 deletions src/engine/controls/cuecontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,17 @@ class ControlObject;
class ControlPushButton;
class ControlIndicator;

enum SeekOnLoadMode {
SEEK_ON_LOAD_DEFAULT = 0, // Use CueRecall preference setting
SEEK_ON_LOAD_ZERO_POS = 1, // Use 0:00.000
SEEK_ON_LOAD_MAIN_CUE = 2, // Use main cue point
SEEK_ON_LOAD_INTRO_CUE = 3, // Use intro cue point
SEEK_ON_LOAD_NUM_MODES
// This enum class is shared between the preference option in DlgPrefDeck
// and AutoDJ's override of that option from AutoDJProcessor.
enum class SeekOnLoadMode {
MainCue = 0, // Use main cue point
Beginning = 1, // Use 0:00.000
Be-ing marked this conversation as resolved.
Show resolved Hide resolved
IntroStart = 2, // Use intro start cue point
UsePreference = 3, // Use CueRecall preference setting
};

inline SeekOnLoadMode seekOnLoadModeFromDouble(double value) {
// msvs does not allow to cast from double to an enum
SeekOnLoadMode mode = static_cast<SeekOnLoadMode>(int(value));
if (mode >= SEEK_ON_LOAD_NUM_MODES || mode < 0) {
return SEEK_ON_LOAD_DEFAULT;
}
return mode;
return static_cast<SeekOnLoadMode>(int(value));;
}

class HotcueControl : public QObject {
Expand Down Expand Up @@ -126,9 +122,9 @@ class CueControl : public EngineControl {
void resetIndicators();
bool isPlayingByPlayButton();
bool getPlayFlashingAtPause();
bool isCueRecallEnabled();
SeekOnLoadMode getSeekOnLoadPreference();
void trackLoaded(TrackPointer pNewTrack) override;
SeekOnLoadMode getSeekOnLoadMode();
SeekOnLoadMode getSeekOnLoadModeAutoDjOverride();

private slots:
void quantizeChanged(double v);
Expand Down Expand Up @@ -210,7 +206,7 @@ class CueControl : public EngineControl {
ControlObject* m_pTrackSamples;
ControlObject* m_pCuePoint;
ControlObject* m_pCueMode;
ControlObject* m_pSeekOnLoadMode;
ControlObject* m_pSeekOnLoadModeAutoDjOverride;
ControlPushButton* m_pCueSet;
ControlPushButton* m_pCueClear;
ControlPushButton* m_pCueCDJ;
Expand Down