Skip to content

Commit

Permalink
Use [Channel1_Stem1] pattern for Stem COs. Improve speed a bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
daschuer committed Jan 27, 2025
1 parent 675d427 commit 1121e3a
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion res/qml/EqColumn.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Column {
}

function stemGroup(group, index) {
return `${group.substr(0, group.length-1)}Stem${index + 1}]`
return `${group.substr(0, group.length-1)}_Stem${index + 1}]`
}

Row {
Expand Down
2 changes: 1 addition & 1 deletion res/skins/LateNight/stem_channel.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Template>
<SetVariable name="StemGroup">[Channel<Variable name="ChanNum"/>Stem<Variable name="StemNum"/>]</SetVariable>
<SetVariable name="StemGroup">[Channel<Variable name="ChanNum"/>_Stem<Variable name="StemNum"/>]</SetVariable>

<WidgetGroup>
<ObjectName>StemChannel_ControlContainer</ObjectName>
Expand Down
10 changes: 5 additions & 5 deletions src/engine/channels/enginedeck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
namespace {
QString getGroupForStem(const QString& deckGroup, int stemIdx) {
DEBUG_ASSERT(deckGroup.endsWith("]"));
return QStringLiteral("%1Stem%2]")
.arg(deckGroup.left(deckGroup.size() - 1),
QString::number(stemIdx));
QString groupForStem = deckGroup;
groupForStem[deckGroup.size() - 1] = QChar('_');
return groupForStem + QStringLiteral("Stem") + QString::number(stemIdx + 1) + QChar(']');
}
} // anonymous namespace
#endif
Expand Down Expand Up @@ -77,14 +77,14 @@ EngineDeck::EngineDeck(
m_stemMute.reserve(mixxx::kMaxSupportedStems);
for (int stemIdx = 0; stemIdx < mixxx::kMaxSupportedStems; stemIdx++) {
m_stemGain.emplace_back(std::make_unique<ControlPotmeter>(
ConfigKey(getGroupForStem(getGroup(), stemIdx + 1), QStringLiteral("volume"))));
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);
auto pMuteButton = std::make_unique<ControlPushButton>(
ConfigKey(getGroupForStem(getGroup(), stemIdx + 1), QStringLiteral("mute")));
ConfigKey(getGroupForStem(getGroup(), stemIdx), QStringLiteral("mute")));
pMuteButton->setButtonMode(mixxx::control::ButtonMode::PowerWindow);
m_stemMute.push_back(std::move(pMuteButton));
}
Expand Down
12 changes: 6 additions & 6 deletions src/mixer/playermanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,28 +145,28 @@ class PlayerManager : public QObject, public PlayerManagerInterface {
// Returns the group for the ith sampler where i is zero indexed
static QString groupForSampler(int i) {
DEBUG_ASSERT(i >= 0);
return QStringLiteral("[Sampler") + QString::number(i + 1) + ']';
return QStringLiteral("[Sampler") + QString::number(i + 1) + QChar(']');
}

// Returns the group for the ith deck where i is zero indexed
static QString groupForDeck(int i) {
DEBUG_ASSERT(i >= 0);
return QStringLiteral("[Channel") + QString::number(i + 1) + ']';
return QStringLiteral("[Channel") + QString::number(i + 1) + QChar(']');
}

#ifdef __STEM__
// Returns the group for the ith deck and jth stem where i and j is zero indexed
static QString groupForDeckStem(int i, int j) {
DEBUG_ASSERT(i >= 0);
return QStringLiteral("[Channel") + QString::number(i + 1) +
QStringLiteral("Stem") + QString::number(j + 1) + ']';
QStringLiteral("_Stem") + QString::number(j + 1) + QChar(']');
}
#endif

// Returns the group for the ith PreviewDeck where i is zero indexed
static QString groupForPreviewDeck(int i) {
DEBUG_ASSERT(i >= 0);
return QStringLiteral("[PreviewDeck") + QString::number(i + 1) + ']';
return QStringLiteral("[PreviewDeck") + QString::number(i + 1) + QChar(']');
}

// Returns the group for the ith Microphone where i is zero indexed
Expand All @@ -176,7 +176,7 @@ class PlayerManager : public QObject, public PlayerManagerInterface {
// the group [Microphone]. For backwards compatibility we keep it that
// way.
if (i > 0) {
return QStringLiteral("[Microphone") + QString::number(i + 1) + ']';
return QStringLiteral("[Microphone") + QString::number(i + 1) + QChar(']');
} else {
return QStringLiteral("[Microphone]");
}
Expand All @@ -185,7 +185,7 @@ class PlayerManager : public QObject, public PlayerManagerInterface {
// Returns the group for the ith Auxiliary where i is zero indexed
static QString groupForAuxiliary(int i) {
DEBUG_ASSERT(i >= 0);
return QStringLiteral("[Auxiliary") + QString::number(i + 1) + ']';
return QStringLiteral("[Auxiliary") + QString::number(i + 1) + QChar(']');
}

static QAtomicPointer<ControlProxy> m_pCOPNumDecks;
Expand Down
6 changes: 3 additions & 3 deletions src/test/stemcontrolobjecttest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ 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));
QString groupForStem = deckGroup;
groupForStem[deckGroup.size() - 1] = QChar('_');
return groupForStem + QStringLiteral("Stem") + QString::number(stemIdx) + QChar(']');
}
QString getFxGroupForStem(const QString& deckGroup, int stemIdx) {
return QStringLiteral("[QuickEffectRack1_%1]")
Expand Down
12 changes: 6 additions & 6 deletions src/waveform/renderers/allshader/waveformrendererstem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ void WaveformRendererStem::initializeGL() {
m_shader.init();
m_textureShader.init();
auto group = m_pEQEnabled->getKey().group;
DEBUG_ASSERT(group.endsWith("]"));
group[group.size() - 1] = QChar('_');
for (int stemIdx = 1; stemIdx <= mixxx::kMaxSupportedStems; stemIdx++) {
DEBUG_ASSERT(group.endsWith("]"));
QString stemGroup = QStringLiteral("%1Stem%2]")
.arg(group.left(group.size() - 1),
QString::number(stemIdx));
QString stemGroup = group + QStringLiteral("Stem") + QString::number(stemIdx) + QChar(']');
m_pStemGain.emplace_back(
std::make_unique<ControlProxy>(stemGroup,
QStringLiteral("volume")));
m_pStemMute.emplace_back(std::make_unique<ControlProxy>(
stemGroup, QStringLiteral("mute")));
m_pStemMute.emplace_back(
std::make_unique<ControlProxy>(stemGroup,
QStringLiteral("mute")));
}
}

Expand Down

0 comments on commit 1121e3a

Please sign in to comment.