Skip to content

Commit

Permalink
Merge pull request #12869 from ronso0/track-load-point-hotcue
Browse files Browse the repository at this point in the history
Add load point option 'First hotcue'
  • Loading branch information
daschuer authored May 8, 2024
2 parents 7cb92e3 + 337b7a7 commit accb87f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/engine/controls/cuecontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ void CueControl::trackLoaded(TrackPointer pNewTrack) {
m_pVinylControlMode->get() == MIXXX_VCMODE_ABSOLUTE)) {
seekOnLoad(mixxx::audio::kStartFramePos);
}
break;
return;
case SeekOnLoadMode::FirstSound: {
CuePointer pN60dBSound =
pNewTrack->findCueByType(mixxx::CueType::N60dBSound);
Expand All @@ -567,8 +567,19 @@ void CueControl::trackLoaded(TrackPointer pNewTrack) {
m_pCuePoint->get());
if (mainCuePosition.isValid()) {
seekOnLoad(mainCuePosition);
} else {
seekOnLoad(mixxx::audio::kStartFramePos);
return;
}
break;
}
case SeekOnLoadMode::FirstHotcue: {
mixxx::audio::FramePos firstHotcuePosition;
HotcueControl* pControl = m_hotcueControls.value(0, nullptr);
if (pControl) {
firstHotcuePosition = pControl->getPosition();
if (firstHotcuePosition.isValid()) {
seekOnLoad(firstHotcuePosition);
return;
}
}
break;
}
Expand All @@ -578,16 +589,15 @@ void CueControl::trackLoaded(TrackPointer pNewTrack) {
m_pIntroStartPosition->get());
if (introStartPosition.isValid()) {
seekOnLoad(introStartPosition);
} else {
seekOnLoad(mixxx::audio::kStartFramePos);
return;
}
break;
}
default:
DEBUG_ASSERT(!"Unknown enum value");
seekOnLoad(mixxx::audio::kStartFramePos);
break;
}
seekOnLoad(mixxx::audio::kStartFramePos);
}

void CueControl::seekOnLoad(mixxx::audio::FramePos seekOnLoadPosition) {
Expand Down
1 change: 1 addition & 0 deletions src/engine/controls/cuecontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ enum class SeekOnLoadMode {
Beginning = 1, // Use 0:00.000
FirstSound = 2, // Skip leading silence
IntroStart = 3, // Use intro start cue point
FirstHotcue = 4,
};

/// Used for requesting a specific hotcue type when activating/setting a
Expand Down
1 change: 1 addition & 0 deletions src/preferences/dialog/dlgprefdeck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ DlgPrefDeck::DlgPrefDeck(QWidget* parent, UserSettingsPointer pConfig)

comboBoxLoadPoint->addItem(tr("Intro start"), static_cast<int>(SeekOnLoadMode::IntroStart));
comboBoxLoadPoint->addItem(tr("Main cue"), static_cast<int>(SeekOnLoadMode::MainCue));
comboBoxLoadPoint->addItem(tr("First hotcue"), static_cast<int>(SeekOnLoadMode::FirstHotcue));
comboBoxLoadPoint->addItem(tr("First sound (skip silence)"), static_cast<int>(SeekOnLoadMode::FirstSound));
comboBoxLoadPoint->addItem(tr("Beginning of track"), static_cast<int>(SeekOnLoadMode::Beginning));
bool seekModeExisted = m_pConfig->exists(ConfigKey("[Controls]", "CueRecall"));
Expand Down

0 comments on commit accb87f

Please sign in to comment.