diff --git a/src/analyzer/constants.h b/src/analyzer/constants.h index 42d84db7217..5e670a37dc0 100644 --- a/src/analyzer/constants.h +++ b/src/analyzer/constants.h @@ -10,7 +10,6 @@ namespace mixxx { // fixed number of channels like the engine does, usually 2 = stereo. constexpr audio::ChannelCount kAnalysisChannels = mixxx::kEngineChannelOutputCount; constexpr audio::ChannelCount kAnalysisMaxChannels = mixxx::kMaxEngineChannelInputCount; -constexpr int kMaxSupportedStems = 4; constexpr SINT kAnalysisFramesPerChunk = 4096; constexpr SINT kAnalysisSamplesPerChunk = kAnalysisFramesPerChunk * kAnalysisMaxChannels; diff --git a/src/skin/legacy/legacyskinparser.cpp b/src/skin/legacy/legacyskinparser.cpp index 4f046ced26a..b0c73676964 100644 --- a/src/skin/legacy/legacyskinparser.cpp +++ b/src/skin/legacy/legacyskinparser.cpp @@ -75,6 +75,7 @@ #include "widget/wstarrating.h" #include "widget/wstatuslight.h" #ifdef __STEM__ +#include "engine/engine.h" #include "widget/wstemcontrol.h" #endif #include "widget/wtime.h" @@ -90,12 +91,6 @@ using mixxx::skin::SkinManifest; -#ifdef __STEM__ -namespace { -constexpr int kMaxSupportedStems = 4; -} // anonymous namespace -#endif - /// This QSet allows to make use of the implicit sharing /// of QString instead of every widget keeping its own copy. QSet LegacySkinParser::s_sharedGroupStrings; @@ -1039,7 +1034,7 @@ QWidget* LegacySkinParser::parseVisual(const QDomElement& node) { setupConnections(child, viewer->stemControlWidget()); QDomElement stem = child.firstChildElement("Stem"); DEBUG_ASSERT(group.endsWith("]")); - for (int stemIdx = 1; stemIdx <= kMaxSupportedStems; stemIdx++) { + for (int stemIdx = 1; stemIdx <= mixxx::kMaxSupportedStems; stemIdx++) { m_pContext->setVariable("StemGroup", QStringLiteral("%1Stem%2]") .arg(group.left(group.size() - 1), @@ -1068,6 +1063,12 @@ QWidget* LegacySkinParser::parseVisual(const QDomElement& node) { &BaseTrackPlayer::loadingTrack, viewer, &WWaveformViewer::slotLoadingTrack); +#ifdef __STEM__ + QObject::connect(pPlayer, + &BaseTrackPlayer::selectedStem, + viewer, + &WWaveformViewer::slotSelectStem); +#endif QObject::connect(pPlayer, &BaseTrackPlayer::trackUnloaded, diff --git a/src/waveform/renderers/allshader/waveformrendererstem.cpp b/src/waveform/renderers/allshader/waveformrendererstem.cpp index 26c074a5824..8e02a71e98a 100644 --- a/src/waveform/renderers/allshader/waveformrendererstem.cpp +++ b/src/waveform/renderers/allshader/waveformrendererstem.cpp @@ -161,7 +161,7 @@ void WaveformRendererStem::paintGL() { if (layerIdx) { max *= m_pStemMute[stemIdx]->toBool() || (selectedStem && - selectedStem != stemIdx + 1) + selectedStem != static_cast(stemIdx) + 1) ? 0.f : static_cast(m_pStemGain[stemIdx]->get()); } diff --git a/src/widget/wstemcontrol.cpp b/src/widget/wstemcontrol.cpp index 0ad36643884..dafdf7b818e 100644 --- a/src/widget/wstemcontrol.cpp +++ b/src/widget/wstemcontrol.cpp @@ -89,6 +89,10 @@ void WStemControlBox::setDisplayed(bool displayed) { emit displayedChanged(m_displayed); } +void WStemControlBox::slotSelectStem(uint stemIdx) { + m_selectedStem = stemIdx; +} + void WStemControlBox::slotTrackLoaded(TrackPointer track) { m_hasStem = false; if (!track) { diff --git a/src/widget/wstemcontrol.h b/src/widget/wstemcontrol.h index 53128960a3b..1a0a08f5059 100644 --- a/src/widget/wstemcontrol.h +++ b/src/widget/wstemcontrol.h @@ -24,7 +24,7 @@ class WStemControlBox : public WWidgetGroup { void addControl(QWidget* control); bool shouldShow() const { - return m_hasStem && m_displayed; + return m_hasStem && m_displayed && m_selectedStem == mixxx::kNoStemSelectedIdx; } bool isDisplayed() const { @@ -34,6 +34,7 @@ class WStemControlBox : public WWidgetGroup { void setDisplayed(bool displayed); public slots: void slotTrackLoaded(TrackPointer track); + void slotSelectStem(uint stemIdx); signals: void displayedChanged(bool); @@ -42,6 +43,7 @@ class WStemControlBox : public WWidgetGroup { std::vector> m_stemControl; QString m_group; bool m_hasStem; + uint m_selectedStem; bool m_displayed; };