From 337b7a711d2706f414c4d7acb58313a45adb44c3 Mon Sep 17 00:00:00 2001 From: ronso0 Date: Sat, 24 Feb 2024 22:26:05 +0100 Subject: [PATCH] Add load point option 'First hotcue' --- src/engine/controls/cuecontrol.cpp | 22 ++++++++++++++++------ src/engine/controls/cuecontrol.h | 1 + src/preferences/dialog/dlgprefdeck.cpp | 1 + 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/engine/controls/cuecontrol.cpp b/src/engine/controls/cuecontrol.cpp index a8ddcbf6d1f..f99a7816036 100644 --- a/src/engine/controls/cuecontrol.cpp +++ b/src/engine/controls/cuecontrol.cpp @@ -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); @@ -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; } @@ -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) { diff --git a/src/engine/controls/cuecontrol.h b/src/engine/controls/cuecontrol.h index 3ba5a1d97a6..c3bb82b0ec8 100644 --- a/src/engine/controls/cuecontrol.h +++ b/src/engine/controls/cuecontrol.h @@ -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 diff --git a/src/preferences/dialog/dlgprefdeck.cpp b/src/preferences/dialog/dlgprefdeck.cpp index f9260283317..189f2c82e7e 100644 --- a/src/preferences/dialog/dlgprefdeck.cpp +++ b/src/preferences/dialog/dlgprefdeck.cpp @@ -148,6 +148,7 @@ DlgPrefDeck::DlgPrefDeck(QWidget* parent, UserSettingsPointer pConfig) comboBoxLoadPoint->addItem(tr("Intro start"), static_cast(SeekOnLoadMode::IntroStart)); comboBoxLoadPoint->addItem(tr("Main cue"), static_cast(SeekOnLoadMode::MainCue)); + comboBoxLoadPoint->addItem(tr("First hotcue"), static_cast(SeekOnLoadMode::FirstHotcue)); comboBoxLoadPoint->addItem(tr("First sound (skip silence)"), static_cast(SeekOnLoadMode::FirstSound)); comboBoxLoadPoint->addItem(tr("Beginning of track"), static_cast(SeekOnLoadMode::Beginning)); bool seekModeExisted = m_pConfig->exists(ConfigKey("[Controls]", "CueRecall"));