Skip to content

Commit

Permalink
Rename stem COs to match quick FX group names
Browse files Browse the repository at this point in the history
  • Loading branch information
acolombier committed Jul 30, 2024
1 parent ffeca7e commit 0a4ba6d
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 18 deletions.
11 changes: 9 additions & 2 deletions src/engine/channels/enginedeck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
#ifdef __STEM__
namespace {
constexpr int kMaxSupportedStems = 4;

QString getGroupForStem(const QString& deckGroup, int stemIdx) {
DEBUG_ASSERT(deckGroup.endsWith("]"));
return QStringLiteral("%1Stem%2]")
.arg(deckGroup.left(deckGroup.size() - 1),
QString::number(stemIdx));
}
} // anonymous namespace
#endif

Expand Down Expand Up @@ -69,14 +76,14 @@ EngineDeck::EngineDeck(
m_stemMute.reserve(kMaxSupportedStems);
for (int stemIdx = 1; stemIdx <= kMaxSupportedStems; stemIdx++) {
m_stemGain.emplace_back(std::make_unique<ControlPotmeter>(
ConfigKey(getGroup(), QString("stem_%1_volume").arg(stemIdx))));
ConfigKey(getGroupForStem(getGroup(), stemIdx), QStringLiteral("volume"))));
// The default value is ignored and override with the medium value by
// ControlPotmeter. This is likely a bug but fixing might have a
// disruptive impact, so setting the default explicitly
m_stemGain.back()->set(1.0);
m_stemGain.back()->setDefaultValue(1.0);
m_stemMute.emplace_back(std::make_unique<ControlPushButton>(
ConfigKey(getGroup(), QString("stem_%1_mute").arg(stemIdx))));
ConfigKey(getGroupForStem(getGroup(), stemIdx), QStringLiteral("mute"))));
}
#endif
}
Expand Down
6 changes: 5 additions & 1 deletion src/mixer/basetrackplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,13 @@ BaseTrackPlayerImpl::BaseTrackPlayerImpl(

#ifdef __STEM__
m_pStemColors.reserve(kMaxSupportedStems);
QString group = getGroup();
for (int stemIdx = 1; stemIdx <= kMaxSupportedStems; stemIdx++) {
QString stemGroup = QStringLiteral("%1Stem%2]")
.arg(group.left(group.size() - 1),
QString::number(stemIdx));
m_pStemColors.emplace_back(std::make_unique<ControlObject>(
ConfigKey(getGroup(), QStringLiteral("stem_%1_color").arg(stemIdx))));
ConfigKey(stemGroup, QStringLiteral("color"))));
m_pStemColors.back()->set(kNoTrackColor);
m_pStemColors.back()->setReadOnly();
}
Expand Down
42 changes: 30 additions & 12 deletions src/test/stemcontrolobjecttest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@

class StemControlTest : public BaseSignalPathTest {
protected:
QString getGroupForStem(const QString& deckGroup, int stemIdx) {
DEBUG_ASSERT(deckGroup.endsWith("]"));
return QStringLiteral("%1Stem%2]")
.arg(deckGroup.left(deckGroup.size() - 1),
QString::number(stemIdx));
}

void SetUp() override {
BaseSignalPathTest::SetUp();

Expand All @@ -20,20 +27,31 @@ class StemControlTest : public BaseSignalPathTest {
loadTrack(m_pMixerDeck3, pStemFile);

m_pPlay = std::make_unique<PollingControlProxy>(m_sGroup1, "play");
m_pStem1Volume = std::make_unique<PollingControlProxy>(m_sGroup1, "stem_1_volume");
m_pStem2Volume = std::make_unique<PollingControlProxy>(m_sGroup1, "stem_2_volume");
m_pStem3Volume = std::make_unique<PollingControlProxy>(m_sGroup1, "stem_3_volume");
m_pStem4Volume = std::make_unique<PollingControlProxy>(m_sGroup1, "stem_4_volume");
m_pStem1Mute = std::make_unique<PollingControlProxy>(m_sGroup1, "stem_1_mute");
m_pStem2Mute = std::make_unique<PollingControlProxy>(m_sGroup1, "stem_2_mute");
m_pStem3Mute = std::make_unique<PollingControlProxy>(m_sGroup1, "stem_3_mute");
m_pStem4Mute = std::make_unique<PollingControlProxy>(m_sGroup1, "stem_4_mute");
m_pStem1Color = std::make_unique<PollingControlProxy>(m_sGroup1, "stem_1_color");
m_pStem2Color = std::make_unique<PollingControlProxy>(m_sGroup1, "stem_2_color");
m_pStem3Color = std::make_unique<PollingControlProxy>(m_sGroup1, "stem_3_color");
m_pStem4Color = std::make_unique<PollingControlProxy>(m_sGroup1, "stem_4_color");

m_pStem1Volume = std::make_unique<PollingControlProxy>(
getGroupForStem(m_sGroup1, 1), "volume");
m_pStem2Volume = std::make_unique<PollingControlProxy>(
getGroupForStem(m_sGroup1, 2), "volume");
m_pStem3Volume = std::make_unique<PollingControlProxy>(
getGroupForStem(m_sGroup1, 3), "volume");
m_pStem4Volume = std::make_unique<PollingControlProxy>(
getGroupForStem(m_sGroup1, 4), "volume");
m_pStem1Mute = std::make_unique<PollingControlProxy>(getGroupForStem(m_sGroup1, 1), "mute");
m_pStem2Mute = std::make_unique<PollingControlProxy>(getGroupForStem(m_sGroup1, 2), "mute");
m_pStem3Mute = std::make_unique<PollingControlProxy>(getGroupForStem(m_sGroup1, 3), "mute");
m_pStem4Mute = std::make_unique<PollingControlProxy>(getGroupForStem(m_sGroup1, 4), "mute");
m_pStem1Color = std::make_unique<PollingControlProxy>(
getGroupForStem(m_sGroup1, 1), "color");
m_pStem2Color = std::make_unique<PollingControlProxy>(
getGroupForStem(m_sGroup1, 2), "color");
m_pStem3Color = std::make_unique<PollingControlProxy>(
getGroupForStem(m_sGroup1, 3), "color");
m_pStem4Color = std::make_unique<PollingControlProxy>(
getGroupForStem(m_sGroup1, 4), "color");

m_pStemCount = std::make_unique<PollingControlProxy>(m_sGroup1, "stem_count");
}

void setCurrentPosition(mixxx::audio::FramePos position) {
m_pChannel1->getEngineBuffer()->queueNewPlaypos(position, EngineBuffer::SEEK_STANDARD);
ProcessBuffer();
Expand Down
10 changes: 7 additions & 3 deletions src/waveform/renderers/allshader/waveformrendererstem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,15 @@ void WaveformRendererStem::initializeGL() {
m_textureShader.init();
auto group = m_pEQEnabled->getKey().group;
for (int stemIdx = 1; stemIdx <= kMaxSupportedStems; stemIdx++) {
DEBUG_ASSERT(group.endsWith("]"));
QString stemGroup = QStringLiteral("%1Stem%2]")
.arg(group.left(group.size() - 1),
QString::number(stemIdx));
m_pStemGain.emplace_back(
std::make_unique<ControlProxy>(group,
QStringLiteral("stem_%1_volume").arg(stemIdx)));
std::make_unique<ControlProxy>(stemGroup,
QStringLiteral("volume").arg(stemIdx)));
m_pStemMute.emplace_back(std::make_unique<ControlProxy>(
group, QStringLiteral("stem_%1_mute").arg(stemIdx)));
stemGroup, QStringLiteral("mute").arg(stemIdx)));
}
}

Expand Down

0 comments on commit 0a4ba6d

Please sign in to comment.