Skip to content

Commit

Permalink
chore: Use new mixer controls in C++ code
Browse files Browse the repository at this point in the history
  • Loading branch information
Holzhaus committed Sep 29, 2023
1 parent 912c750 commit ed7c228
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 29 deletions.
41 changes: 21 additions & 20 deletions src/controllers/controlpickermenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace {
const QString kAppGroup = QStringLiteral("[App]");
const QString kMixerGroup = QStringLiteral("[Mixer]");
} // namespace

ControlPickerMenu::ControlPickerMenu(QWidget* pParent)
Expand Down Expand Up @@ -49,8 +50,8 @@ ControlPickerMenu::ControlPickerMenu(QWidget* pParent)
QMenu* mixerMenu = addSubmenu(tr("Mixer"));
// Crossfader / Orientation
QMenu* crossfaderMenu = addSubmenu(tr("Crossfader / Orientation"), mixerMenu);
addControl("[Master]",
"crossfader",
addControl(kMixerGroup,
QStringLiteral("crossfader"),
tr("Crossfader"),
tr("Crossfader"),
crossfaderMenu,
Expand All @@ -73,45 +74,45 @@ ControlPickerMenu::ControlPickerMenu(QWidget* pParent)
crossfaderMenu);
// Main Output
QMenu* mainOutputMenu = addSubmenu(tr("Main Output"), mixerMenu);
addControl("[Master]",
"gain",
addControl(kMixerGroup,
QStringLiteral("main_gain"),
tr("Main Output Gain"),
tr("Main Output gain"),
mainOutputMenu,
true);
addControl("[Master]",
"balance",
addControl(kMixerGroup,
QStringLiteral("balance"),
tr("Main Output Balance"),
tr("Main Output balance"),
mainOutputMenu,
true);
addControl("[Master]",
"delay",
addControl(kMixerGroup,
QStringLiteral("main_delay"),
tr("Main Output Delay"),
tr("Main Output delay"),
mainOutputMenu,
true);
// Headphone
QMenu* headphoneMenu = addSubmenu(tr("Headphone"), mixerMenu);
addControl("[Master]",
"headGain",
addControl(kMixerGroup,
QStringLiteral("headphone_gain"),
tr("Headphone Gain"),
tr("Headphone gain"),
headphoneMenu,
true);
addControl("[Master]",
"headMix",
addControl(kMixerGroup,
QStringLiteral("headphone_mix"),
tr("Headphone Mix"),
tr("Headphone mix (pre/main)"),
headphoneMenu,
true);
addControl("[Master]",
"headSplit",
addControl(kMixerGroup,
QStringLiteral("headphone_split"),
tr("Headphone Split Cue"),
tr("Toggle headphone split cueing"),
headphoneMenu);
addControl("[Master]",
"headDelay",
addControl(kMixerGroup,
QStringLiteral("headphone_delay"),
tr("Headphone Delay"),
tr("Headphone delay"),
headphoneMenu,
Expand Down Expand Up @@ -1114,14 +1115,14 @@ ControlPickerMenu::ControlPickerMenu(QWidget* pParent)
microphoneMenu,
true,
false);
addControl("[Master]",
"duckStrength",
addControl(kMixerGroup,
QStringLiteral("talkover_ducking_strength"),
tr("Microphone Ducking Strength"),
tr("Microphone Ducking Strength"),
microphoneMenu,
true);
addControl("[Master]",
"talkoverDucking",
addControl(kMixerGroup,
QStringLiteral("talkover_ducking_mode"),
tr("Microphone Ducking Mode"),
tr("Toggle microphone ducking mode (OFF, AUTO, MANUAL)"),
microphoneMenu);
Expand Down
2 changes: 1 addition & 1 deletion src/library/autodj/autodjprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ AutoDJProcessor::AutoDJProcessor(
// Auto-DJ needs at least two decks
DEBUG_ASSERT(m_decks.length() > 1);

m_pCOCrossfader = new ControlProxy("[Master]", "crossfader");
m_pCOCrossfader = new ControlProxy(QStringLiteral("[Mixer]"), QStringLiteral("crossfader"));
m_pCOCrossfaderReverse = new ControlProxy("[Mixer Profile]", "xFaderReverse");

QString str_autoDjTransition = m_pConfig->getValueString(
Expand Down
4 changes: 3 additions & 1 deletion src/mixer/playerinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ PlayerInfo* s_pPlayerInfo = nullptr;
} // namespace

PlayerInfo::PlayerInfo()
: m_pCOxfader(new ControlProxy("[Master]","crossfader", this)),
: m_pCOxfader(new ControlProxy(QStringLiteral("[Mixer]"),
QStringLiteral("crossfader"),
this)),
m_currentlyPlayingDeck(-1) {
startTimer(kPlayingDeckUpdateIntervalMillis);
}
Expand Down
2 changes: 1 addition & 1 deletion src/preferences/dialog/dlgprefmixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ DlgPrefMixer::DlgPrefMixer(
m_curve(EngineXfader::kXfaderConfigKey, "xFaderCurve"),
m_calibration(EngineXfader::kXfaderConfigKey, "xFaderCalibration"),
m_reverse(EngineXfader::kXfaderConfigKey, "xFaderReverse"),
m_crossfader("[Master]", "crossfader"),
m_crossfader(QStringLiteral("[Mixer]"), QStringLiteral("crossfader")),
m_xFaderReverse(false),
m_COLoFreq(kConfigGroup, QStringLiteral("LoEQFrequency")),
m_COHiFreq(kConfigGroup, QStringLiteral("HiEQFrequency")),
Expand Down
4 changes: 2 additions & 2 deletions src/preferences/dialog/dlgprefsound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ void DlgPrefSound::slotApply() {
const auto keylockEngine =
keylockComboBox->currentData().value<EngineBuffer::KeylockEngine>();
m_pKeylockEngine->set(static_cast<double>(keylockEngine));
m_pSettings->set(ConfigKey("[Master]", "keylock_engine"),
m_pSettings->set(ConfigKey(kAppGroup, QStringLiteral("keylock_engine")),
ConfigValue(static_cast<int>(keylockEngine)));

status = m_pSoundManager->setConfig(m_config);
Expand Down Expand Up @@ -481,7 +481,7 @@ void DlgPrefSound::loadSettings(const SoundManagerConfig &config) {

// Default keylock engine is Rubberband Faster (v2)
const auto keylockEngine = static_cast<EngineBuffer::KeylockEngine>(
m_pSettings->getValue(ConfigKey("[Master]", "keylock_engine"),
m_pSettings->getValue(ConfigKey(kAppGroup, QStringLiteral("keylock_engine")),
static_cast<int>(EngineBuffer::defaultKeylockEngine())));
const auto keylockEngineVariant = QVariant::fromValue(keylockEngine);
const int index = keylockComboBox->findData(keylockEngineVariant);
Expand Down
5 changes: 4 additions & 1 deletion src/test/autodjprocessor_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ const QString kAppGroup = QStringLiteral("[App]");
class FakeMixer {
public:
FakeMixer()
: crossfader(ConfigKey("[Master]", "crossfader"), -1.0, 1.0),
: crossfader(ConfigKey(QStringLiteral("[Mixer]"),
QStringLiteral("crossfader")),
-1.0,
1.0),
crossfaderReverse(ConfigKey("[Mixer Profile]", "xFaderReverse")) {
crossfaderReverse.setButtonMode(ControlPushButton::TOGGLE);
}
Expand Down
1 change: 0 additions & 1 deletion src/test/signalpathtest.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "test/signalpathtest.h"

const QString BaseSignalPathTest::m_sMainGroup = QStringLiteral("[Master]");
const QString BaseSignalPathTest::m_sInternalClockGroup = QStringLiteral("[InternalClock]");
// these names need to match PlayerManager::groupForDeck and friends
const QString BaseSignalPathTest::m_sGroup1 = QStringLiteral("[Channel1]");
Expand Down
5 changes: 3 additions & 2 deletions src/test/signalpathtest.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ class BaseSignalPathTest : public MixxxTest, SoundSourceProviderRegistration {
addDeck(m_pChannel3);

m_pEngineSync = m_pEngineMixer->getEngineSync();
ControlObject::set(ConfigKey(m_sMainGroup, "enabled"), 1.0);
ControlObject::set(ConfigKey(QStringLiteral("[Mixer]"),
QStringLiteral("main_enabled")),
1.0);

PlayerInfo::create();
}
Expand Down Expand Up @@ -247,7 +249,6 @@ class BaseSignalPathTest : public MixxxTest, SoundSourceProviderRegistration {
EngineDeck *m_pChannel1, *m_pChannel2, *m_pChannel3;
PreviewDeck* m_pPreview1;

static const QString m_sMainGroup;
static const QString m_sInternalClockGroup;
static const QString m_sGroup1;
static const QString m_sGroup2;
Expand Down

0 comments on commit ed7c228

Please sign in to comment.