From 409c77f71931e18860535de00b7d0cc53d8e3845 Mon Sep 17 00:00:00 2001 From: ronso0 Date: Tue, 2 Jul 2024 10:40:32 +0200 Subject: [PATCH 01/11] AutoDJ: force-show decks 3/4 if we are going to use them --- src/library/autodj/autodjprocessor.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/library/autodj/autodjprocessor.cpp b/src/library/autodj/autodjprocessor.cpp index 0910d6f9b89..041b9a8d236 100644 --- a/src/library/autodj/autodjprocessor.cpp +++ b/src/library/autodj/autodjprocessor.cpp @@ -407,6 +407,12 @@ AutoDJProcessor::AutoDJError AutoDJProcessor::toggleAutoDJ(bool enable) { } } + if (pLeftDeck->index > 1 || pRightDeck->index > 1) { + // Left and/or right deck is deck 3/4 which may not be visible. + // Make sure it is, if the current skin is a 4-deck skin. + ControlObject::set(ConfigKey("[Skin]", "show_4decks"), 1); + } + // Never load the same track if it is already playing if (leftDeckPlaying) { removeLoadedTrackFromTopOfQueue(*pLeftDeck); From cd182c19ee809c833af0de956416be0a738b2851 Mon Sep 17 00:00:00 2001 From: ronso0 Date: Sun, 22 Sep 2024 14:16:59 +0200 Subject: [PATCH 02/11] (fix) Track menu: avoid crash with track nullptr --- src/widget/wtrackmenu.cpp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/widget/wtrackmenu.cpp b/src/widget/wtrackmenu.cpp index 7b2178a7f5d..eb8b9f17088 100644 --- a/src/widget/wtrackmenu.cpp +++ b/src/widget/wtrackmenu.cpp @@ -722,11 +722,9 @@ std::pair WTrackMenu::getTrackBpmLockStates() const { break; } } - } else { - if (m_pTrack) { - anyBpmLocked = m_pTrack->isBpmLocked(); - anyBpmNotLocked = !anyBpmLocked; - } + } else if (m_pTrack) { + anyBpmLocked = m_pTrack->isBpmLocked(); + anyBpmNotLocked = !anyBpmLocked; } return std::pair(anyBpmLocked, anyBpmNotLocked); } @@ -815,8 +813,11 @@ CoverInfo WTrackMenu::getCoverInfoOfLastTrack() const { .data() .toString(); return coverInfo; - } else { + } else if (m_pTrack) { return m_pTrack->getCoverInfoWithLocation(); + } else { + // No track, no track model + return CoverInfo(); } } @@ -968,13 +969,15 @@ void WTrackMenu::updateMenus() { } else if (m_pTrack) { pTrack = m_pTrack; } - const double bpm = pTrack->getBpm(); - appendBpmPreviewtoBpmAction(m_pBpmDoubleAction, bpm); - appendBpmPreviewtoBpmAction(m_pBpmHalveAction, bpm); - appendBpmPreviewtoBpmAction(m_pBpmTwoThirdsAction, bpm); - appendBpmPreviewtoBpmAction(m_pBpmThreeFourthsAction, bpm); - appendBpmPreviewtoBpmAction(m_pBpmFourThirdsAction, bpm); - appendBpmPreviewtoBpmAction(m_pBpmThreeHalvesAction, bpm); + if (pTrack) { + const double bpm = pTrack->getBpm(); + appendBpmPreviewtoBpmAction(m_pBpmDoubleAction, bpm); + appendBpmPreviewtoBpmAction(m_pBpmHalveAction, bpm); + appendBpmPreviewtoBpmAction(m_pBpmTwoThirdsAction, bpm); + appendBpmPreviewtoBpmAction(m_pBpmThreeFourthsAction, bpm); + appendBpmPreviewtoBpmAction(m_pBpmFourThirdsAction, bpm); + appendBpmPreviewtoBpmAction(m_pBpmThreeHalvesAction, bpm); + } } } } From 925274931305c51a7888538fb095ee90291c85e5 Mon Sep 17 00:00:00 2001 From: ronso0 Date: Mon, 23 Sep 2024 12:52:04 +0200 Subject: [PATCH 03/11] (fix) Track Properties: reset window title when clearing the fields --- src/library/dlgtrackinfo.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/library/dlgtrackinfo.cpp b/src/library/dlgtrackinfo.cpp index 69904b12f3d..78ecc395595 100644 --- a/src/library/dlgtrackinfo.cpp +++ b/src/library/dlgtrackinfo.cpp @@ -623,6 +623,8 @@ void DlgTrackInfo::saveTrack() { void DlgTrackInfo::clear() { const QSignalBlocker signalBlocker(this); + setWindowTitle(QString()); + if (m_pLoadedTrack) { disconnect(m_pLoadedTrack.get(), &Track::changed, From 3a8cd2ddd41ec35e9dd719b528e642e516a8ed38 Mon Sep 17 00:00:00 2001 From: ronso0 Date: Mon, 23 Sep 2024 15:32:12 +0200 Subject: [PATCH 04/11] (fix) Track menu: prevent stuck cursor in "Search related" menu with track nullptr --- src/widget/wtrackmenu.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/widget/wtrackmenu.cpp b/src/widget/wtrackmenu.cpp index eb8b9f17088..29ddf2e8f5c 100644 --- a/src/widget/wtrackmenu.cpp +++ b/src/widget/wtrackmenu.cpp @@ -215,6 +215,10 @@ void WTrackMenu::createMenus() { m_pSearchRelatedMenu->clear(); const auto pTrack = getFirstTrackPointer(); if (pTrack) { + // Ensure it's enabled, else we can't add actions. + VERIFY_OR_DEBUG_ASSERT(m_pSearchRelatedMenu->isEnabled()) { + m_pSearchRelatedMenu->setEnabled(true); + } m_pSearchRelatedMenu->addActionsForTrack(*pTrack); } m_pSearchRelatedMenu->setEnabled( @@ -829,6 +833,19 @@ void WTrackMenu::updateMenus() { // Gray out some stuff if multiple songs were selected. const bool singleTrackSelected = getTrackCount() == 1; + if (featureIsEnabled(Feature::SearchRelated)) { + // Enable only if we have one valid track pointer. + // this prevents the cursor getting stuck on this menu in case it gets + // disabled when encountering a track nullptr in lambda function + // connected to aboutToShow() signal (see createMenus()). + // Note: track nullptr can happen when TrackDAO returns nullptr because + // the selected track references a file referenced by another cached track. + DEBUG_ASSERT(m_pSearchRelatedMenu); + const auto pTrack = getFirstTrackPointer(); + m_pSearchRelatedMenu->setEnabled(pTrack != nullptr); + // TODO Only enable for single track? + } + if (featureIsEnabled(Feature::LoadTo)) { int iNumDecks = static_cast(m_pNumDecks.get()); m_pDeckMenu->clear(); From 5bd4c200e4b18a8c11450ec1d99afae8d8cb74f2 Mon Sep 17 00:00:00 2001 From: ronso0 Date: Mon, 23 Sep 2024 15:33:06 +0200 Subject: [PATCH 05/11] Track menu: add comments and TODOs --- src/widget/wtrackmenu.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/widget/wtrackmenu.cpp b/src/widget/wtrackmenu.cpp index 29ddf2e8f5c..a4b478ce9f7 100644 --- a/src/widget/wtrackmenu.cpp +++ b/src/widget/wtrackmenu.cpp @@ -849,6 +849,7 @@ void WTrackMenu::updateMenus() { if (featureIsEnabled(Feature::LoadTo)) { int iNumDecks = static_cast(m_pNumDecks.get()); m_pDeckMenu->clear(); + // TODO Only enable for single track? if (iNumDecks > 0) { for (int i = 1; i <= iNumDecks; ++i) { // PlayerManager::groupForDeck is 0-indexed. @@ -964,6 +965,7 @@ void WTrackMenu::updateMenus() { bool anyBpmLocked; bool anyBpmNotLocked; std::tie(anyBpmLocked, anyBpmNotLocked) = getTrackBpmLockStates(); + // TODO Disable menu if anyBpmLocked == anyBpmNotLocked ?? if (featureIsEnabled(Feature::Reset)) { m_pClearBeatsAction->setEnabled(!anyBpmLocked); } @@ -2355,6 +2357,10 @@ void WTrackMenu::slotShowDlgTrackInfo() { } }); // Method getFirstTrackPointer() is not applicable here! + // DlgTrackInfo relies on a track model for certain operations, + // for example show/hide the Next/Prev buttons. + // It can be loaded with either an index (must have a model), + // or a TrackPointer (must NOT have a model then). if (m_pTrackModel) { m_pDlgTrackInfo->loadTrack(m_trackIndexList.at(0)); } else { From 7cbc4bd373e6989dd98c0b745ff25f2852539df6 Mon Sep 17 00:00:00 2001 From: ronso0 Date: Mon, 23 Sep 2024 15:33:27 +0200 Subject: [PATCH 06/11] (fix) DlgTagFetcher: fix UI when no track is loaded --- src/library/dlgtagfetcher.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/library/dlgtagfetcher.cpp b/src/library/dlgtagfetcher.cpp index b396962a91d..400bf265662 100644 --- a/src/library/dlgtagfetcher.cpp +++ b/src/library/dlgtagfetcher.cpp @@ -246,30 +246,31 @@ void DlgTagFetcher::slotPrev() { } void DlgTagFetcher::loadTrack(const TrackPointer& pTrack) { + tags->clear(); + m_data = Data(); if (m_pTrack) { - tags->clear(); disconnect(m_pTrack.get(), &Track::changed, this, &DlgTagFetcher::slotTrackChanged); - m_data = Data(); } - tags->clear(); m_pWFetchedCoverArtLabel->setCoverArt(CoverInfo{}, QPixmap{}); m_coverCache.clear(); - m_pTrack = pTrack; - if (!m_pTrack) { - return; - } - btnRetry->setDisabled(true); btnApply->setDisabled(true); checkBoxTags->setDisabled(true); checkBoxCover->setDisabled(true); statusMessage->setVisible(false); + + m_pTrack = pTrack; + if (!m_pTrack) { + loadingProgressBar->setVisible(false); + return; + } + loadingProgressBar->setVisible(true); loadingProgressBar->setValue(kMinimumValueOfQProgressBar); addDivider(tr("Original tags"), tags); From 580a8fc5d97f02891017f58b7d83f76b2ff2f809 Mon Sep 17 00:00:00 2001 From: ronso0 Date: Thu, 26 Sep 2024 12:50:34 +0200 Subject: [PATCH 07/11] Track menu: show 'Load To' menus only for single tracks --- src/widget/wtrackmenu.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/widget/wtrackmenu.cpp b/src/widget/wtrackmenu.cpp index a4b478ce9f7..b648b2ec60d 100644 --- a/src/widget/wtrackmenu.cpp +++ b/src/widget/wtrackmenu.cpp @@ -847,10 +847,11 @@ void WTrackMenu::updateMenus() { } if (featureIsEnabled(Feature::LoadTo)) { + // Enable menus only for single track int iNumDecks = static_cast(m_pNumDecks.get()); m_pDeckMenu->clear(); - // TODO Only enable for single track? - if (iNumDecks > 0) { + m_pDeckMenu->setEnabled(singleTrackSelected); + if (singleTrackSelected && iNumDecks > 0) { for (int i = 1; i <= iNumDecks; ++i) { // PlayerManager::groupForDeck is 0-indexed. QString deckGroup = PlayerManager::groupForDeck(i - 1); @@ -885,8 +886,9 @@ void WTrackMenu::updateMenus() { int iNumSamplers = static_cast(m_pNumSamplers.get()); const int maxSamplersPerMenu = 16; - if (iNumSamplers > 0) { - m_pSamplerMenu->clear(); + m_pSamplerMenu->clear(); + m_pSamplerMenu->setEnabled(singleTrackSelected); + if (singleTrackSelected && iNumSamplers > 0) { QMenu* pMenu = m_pSamplerMenu; int samplersInMenu = 0; for (int i = 1; i <= iNumSamplers; ++i) { @@ -965,7 +967,6 @@ void WTrackMenu::updateMenus() { bool anyBpmLocked; bool anyBpmNotLocked; std::tie(anyBpmLocked, anyBpmNotLocked) = getTrackBpmLockStates(); - // TODO Disable menu if anyBpmLocked == anyBpmNotLocked ?? if (featureIsEnabled(Feature::Reset)) { m_pClearBeatsAction->setEnabled(!anyBpmLocked); } From f6a561874b5325a55a4d5666adcc64861b9aaf0e Mon Sep 17 00:00:00 2001 From: Uwe Klotz Date: Sat, 28 Sep 2024 00:41:02 +0200 Subject: [PATCH 08/11] Fix replay gain analysis --- src/analyzer/analyzerebur128.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/analyzer/analyzerebur128.cpp b/src/analyzer/analyzerebur128.cpp index 307b2f8cd21..6c06fa133b1 100644 --- a/src/analyzer/analyzerebur128.cpp +++ b/src/analyzer/analyzerebur128.cpp @@ -72,8 +72,8 @@ void AnalyzerEbur128::storeResults(TrackPointer pTrack) { if (averageLufs == -HUGE_VAL || averageLufs == HUGE_VAL || // This catches 0 and abnormal values inf and -inf (that may have - // slipped through in libebur for some reason. - util_isnormal(averageLufs)) { + // slipped through in libebur128 for some reason. + !util_isnormal(averageLufs)) { qWarning() << "AnalyzerEbur128::storeResults() averageLufs invalid:" << averageLufs; return; From 7676271bf501753a6ef35f6662476c0d245f8756 Mon Sep 17 00:00:00 2001 From: Uwe Klotz Date: Sat, 28 Sep 2024 00:41:02 +0200 Subject: [PATCH 09/11] Fix replay gain analysis --- src/analyzer/analyzerebur128.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/analyzer/analyzerebur128.cpp b/src/analyzer/analyzerebur128.cpp index 40d1ac00ab8..01572cf7f26 100644 --- a/src/analyzer/analyzerebur128.cpp +++ b/src/analyzer/analyzerebur128.cpp @@ -72,8 +72,8 @@ void AnalyzerEbur128::storeResults(TrackPointer pTrack) { if (averageLufs == -HUGE_VAL || averageLufs == HUGE_VAL || // This catches 0 and abnormal values inf and -inf (that may have - // slipped through in libebur for some reason. - util_isnormal(averageLufs)) { + // slipped through in libebur128 for some reason. + !util_isnormal(averageLufs)) { qWarning() << "AnalyzerEbur128::storeResults() averageLufs invalid:" << averageLufs; return; From cea8aec0c1b811b50e63e76b8509370126aee141 Mon Sep 17 00:00:00 2001 From: ronso0 Date: Fri, 27 Sep 2024 16:06:24 +0200 Subject: [PATCH 10/11] (fix) disable Properties shortcut in Computer feature views --- src/widget/wtracktableview.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/widget/wtracktableview.cpp b/src/widget/wtracktableview.cpp index 74e7cf509fd..e1cf4dfb7ab 100644 --- a/src/widget/wtracktableview.cpp +++ b/src/widget/wtracktableview.cpp @@ -871,6 +871,12 @@ void WTrackTableView::keyPressEvent(QKeyEvent* event) { if (event->modifiers().testFlag(Qt::NoModifier)) { slotMouseDoubleClicked(currentIndex()); } else if ((event->modifiers() & kPropertiesShortcutModifier)) { + TrackModel* pTrackModel = getTrackModel(); + if (!pTrackModel || + !pTrackModel->hasCapabilities( + TrackModel::Capability::EditMetadata)) { + return; + } const QModelIndexList indices = getSelectedRows(); if (indices.length() == 1) { m_pTrackMenu->loadTrackModelIndices(indices); From 0cf80e40a671c64572a6670929f83e9e13326096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Tue, 8 Oct 2024 21:24:05 +0200 Subject: [PATCH 11/11] Continue to play started metronome click even if track is paused. This fixes repeating the same buffer over and over again causing loud noise. --- src/effects/backends/builtin/metronomeeffect.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/effects/backends/builtin/metronomeeffect.cpp b/src/effects/backends/builtin/metronomeeffect.cpp index 118637e35e7..17061e9789c 100644 --- a/src/effects/backends/builtin/metronomeeffect.cpp +++ b/src/effects/backends/builtin/metronomeeffect.cpp @@ -131,7 +131,10 @@ void MetronomeEffect::processChannel( nextClickStart = bufferEnd - beatToBufferEnd; } } else { - // no transport, nothing to do. + // no transport, continue until the current click has been fully played + if (gs->m_framesSinceClickStart < clickSize) { + gs->m_framesSinceClickStart += engineParameters.framesPerBuffer(); + } return; } } else {