From 4957f89dfd4bf06d53187675d0e21383910f3469 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Wed, 13 Sep 2023 20:20:40 +0200 Subject: [PATCH 1/7] refactor(waveform/guitick): Rename `guiTick` COs --- res/controllers/Traktor-Kontrol-S3-hid-scripts.js | 2 +- res/controllers/Traktor-Kontrol-S4-MK3.js | 2 +- res/controllers/Yaeltex-MiniMixxx-scripts.js | 2 +- src/control/controlindicatortimer.cpp | 14 ++++++++++---- src/test/co_dumps/co_dump_inital.csv | 4 ++-- src/util/timer.cpp | 2 +- src/waveform/guitick.cpp | 13 +++++++++++-- src/waveform/guitick.h | 5 +++-- src/widget/wtracktableview.cpp | 3 ++- 9 files changed, 32 insertions(+), 15 deletions(-) diff --git a/res/controllers/Traktor-Kontrol-S3-hid-scripts.js b/res/controllers/Traktor-Kontrol-S3-hid-scripts.js index 867e76081a3..30ce1788daf 100644 --- a/res/controllers/Traktor-Kontrol-S3-hid-scripts.js +++ b/res/controllers/Traktor-Kontrol-S3-hid-scripts.js @@ -536,7 +536,7 @@ TraktorS3.Controller = class { this.masterVuMeter.VuMeterR.connection = engine.makeConnection("[Master]", "VuMeterR", TraktorS3.Controller.prototype.masterVuMeterHandler.bind(this)); this.linkChannelOutput("[Master]", "PeakIndicatorL", TraktorS3.Controller.prototype.peakOutput.bind(this)); this.linkChannelOutput("[Master]", "PeakIndicatorR", TraktorS3.Controller.prototype.peakOutput.bind(this)); - this.guiTickConnection = engine.makeConnection("[Master]", "guiTick50ms", TraktorS3.Controller.prototype.guiTickHandler.bind(this)); + this.guiTickConnection = engine.makeConnection("[App]", "gui_tick_50ms_period_s", TraktorS3.Controller.prototype.guiTickHandler.bind(this)); // Sampler callbacks for (let i = 1; i <= 8; ++i) { diff --git a/res/controllers/Traktor-Kontrol-S4-MK3.js b/res/controllers/Traktor-Kontrol-S4-MK3.js index 4d8046b0907..3baa8cb5b13 100644 --- a/res/controllers/Traktor-Kontrol-S4-MK3.js +++ b/res/controllers/Traktor-Kontrol-S4-MK3.js @@ -2885,7 +2885,7 @@ class S4MK3 { const that = this; /* eslint no-unused-vars: "off" */ - const meterConnection = engine.makeConnection("[Master]", "guiTick50ms", function(_value) { + const meterConnection = engine.makeConnection("[App]", "gui_tick_50ms_period_s", function(_value) { const deckMeters = new Uint8Array(78).fill(0); // Each column has 14 segments, but treat the top one specially for the clip indicator. const deckSegments = 13; diff --git a/res/controllers/Yaeltex-MiniMixxx-scripts.js b/res/controllers/Yaeltex-MiniMixxx-scripts.js index f46e5f78108..8590c7040db 100644 --- a/res/controllers/Yaeltex-MiniMixxx-scripts.js +++ b/res/controllers/Yaeltex-MiniMixxx-scripts.js @@ -1426,7 +1426,7 @@ MiniMixxx.Controller = class { this.buttons[name].activeMode.setLights(); } - this.guiTickConnection = engine.makeConnection("[Master]", "guiTick50ms", this.guiTickHandler.bind(this)); + this.guiTickConnection = engine.makeConnection("[App]", "gui_tick_50ms_period_s", this.guiTickHandler.bind(this)); } diff --git a/src/control/controlindicatortimer.cpp b/src/control/controlindicatortimer.cpp index 989a8e3c07e..562d8684d52 100644 --- a/src/control/controlindicatortimer.cpp +++ b/src/control/controlindicatortimer.cpp @@ -4,14 +4,18 @@ #include "moc_controlindicatortimer.cpp" #include "util/math.h" +namespace { +const QString kAppGroup = QStringLiteral("[App]"); +} // namespace + namespace mixxx { ControlIndicatorTimer::ControlIndicatorTimer(QObject* pParent) : QObject(pParent), m_pCOIndicator250millis(std::make_unique( - ConfigKey("[Master]", "indicator_250millis"))), + ConfigKey(kAppGroup, QStringLiteral("indicator_250millis")))), m_pCOIndicator500millis(std::make_unique( - ConfigKey("[Master]", "indicator_500millis"))), + ConfigKey(kAppGroup, QStringLiteral("indicator_500millis")))), m_nextSwitchTime(0.0), m_pCPGuiTick50ms(nullptr) { m_pCOIndicator250millis->setReadOnly(); @@ -43,7 +47,8 @@ void ControlIndicatorTimer::setLegacyVsyncEnabled(bool enabled) { if (enabled) { m_timer.stop(); - m_pCPGuiTick50ms = std::make_unique(ConfigKey("[Master]", "guiTick50ms")); + m_pCPGuiTick50ms = std::make_unique( + ConfigKey(kAppGroup, QStringLiteral("gui_tick_50ms_period_s"))); m_pCPGuiTick50ms->connectValueChanged(this, &ControlIndicatorTimer::slotGuiTick50ms); } else { m_pCPGuiTick50ms->disconnect(this); @@ -58,7 +63,8 @@ void ControlIndicatorTimer::slotGuiTick50ms(double cpuTime) { } constexpr double duration = 0.25; - const double tickTime = ControlObject::get(ConfigKey("[Master]", "guiTickTime")); + const double tickTime = ControlObject::get( + ConfigKey(kAppGroup, QStringLiteral("gui_tick_full_period_s"))); const double toggles = floor(tickTime / duration); m_nextSwitchTime = (toggles + 1) * duration; slotTimeout(); diff --git a/src/test/co_dumps/co_dump_inital.csv b/src/test/co_dumps/co_dump_inital.csv index 2da1357d29a..f8826a9c033 100644 --- a/src/test/co_dumps/co_dump_inital.csv +++ b/src/test/co_dumps/co_dump_inital.csv @@ -6956,7 +6956,7 @@ [EqualizerRack1_[Channel4]],num_effectslots,1 [EffectRack1_EffectUnit3_Effect4],parameter9_down_small,0 [EqualizerRack1_[Master]_Effect1],parameter1_set_zero,0 -[Master],guiTick50ms,18.5993 +[App],gui_tick_50ms_period_s,18.5993 [EffectRack1_EffectUnit1_Effect2],parameter16_minus_toggle,0 [QuickEffectRack1_[Channel1]_Effect1],parameter11_up_small,0 [EqualizerRack1_[Channel2]_Effect1],parameter9_toggle,0 @@ -9007,7 +9007,7 @@ [QuickEffectRack1_[Channel3]_Effect1],button_parameter4_loaded,0 [EqualizerRack1_[Channel4]_Effect1],button_parameter3_loaded,1 [Channel1],stop,0 -[Master],guiTickTime,18.6325 +[App],gui_tick_full_period_s,18.6325 [Sampler2],beatlooproll_2_activate,0 [EffectRack1_EffectUnit4_Effect4],parameter4_link_inverse,0 [EffectRack1_EffectUnit2_Effect4],parameter9_set_default,0 diff --git a/src/util/timer.cpp b/src/util/timer.cpp index 335c9996764..9af8712ca5d 100644 --- a/src/util/timer.cpp +++ b/src/util/timer.cpp @@ -84,7 +84,7 @@ mixxx::Duration SuspendableTimer::elapsed(bool report) { GuiTickTimer::GuiTickTimer(QObject* pParent) : QObject(pParent), m_pGuiTick(make_parented( - "[Master]", "guiTickTime", this)), + QStringLiteral("[App]"), QStringLiteral("gui_tick_full_period_s"), this)), m_bActive(false) { } diff --git a/src/waveform/guitick.cpp b/src/waveform/guitick.cpp index 8ac94ef16dd..4e624fa3adb 100644 --- a/src/waveform/guitick.cpp +++ b/src/waveform/guitick.cpp @@ -3,9 +3,18 @@ #include "waveform/guitick.h" #include "control/controlobject.h" +namespace { +const QString kAppGroup = QStringLiteral("[App]"); +const QString kLegacyGroup = QStringLiteral("[Master]"); +} // namespace + GuiTick::GuiTick() { - m_pCOGuiTickTime = std::make_unique(ConfigKey("[Master]", "guiTickTime")); - m_pCOGuiTick50ms = std::make_unique(ConfigKey("[Master]", "guiTick50ms")); + m_pCOGuiTickTime = std::make_unique( + ConfigKey(kAppGroup, QStringLiteral("gui_tick_full_period_s"))); + m_pCOGuiTickTime->addAlias(ConfigKey(kLegacyGroup, QStringLiteral("guiTickTime"))); + m_pCOGuiTick50ms = std::make_unique( + ConfigKey(kAppGroup, QStringLiteral("gui_tick_50ms_period_s"))); + m_pCOGuiTick50ms->addAlias(ConfigKey(kLegacyGroup, QStringLiteral("guiTick50ms"))); m_cpuTimer.start(); } diff --git a/src/waveform/guitick.h b/src/waveform/guitick.h index 29d4bed6e02..4386b244056 100644 --- a/src/waveform/guitick.h +++ b/src/waveform/guitick.h @@ -7,8 +7,9 @@ #include "util/memory.h" #include "util/performancetimer.h" -// A helper class that manages the "guiTickTime" COs, that drive updates of the -// GUI from the VsyncThread at the user's configured FPS (possibly downsampled). +/// A helper class that manages the `gui_Tick` COs, that drive updates of the +/// GUI from the `VSyncThread` at the user's configured FPS (possibly +/// downsampled). class GuiTick { public: GuiTick(); diff --git a/src/widget/wtracktableview.cpp b/src/widget/wtracktableview.cpp index 3fe112c55e8..4f1afb18266 100644 --- a/src/widget/wtracktableview.cpp +++ b/src/widget/wtracktableview.cpp @@ -59,7 +59,8 @@ WTrackTableView::WTrackTableView(QWidget* parent, // Connect slots and signals to make the world go 'round. connect(this, &WTrackTableView::doubleClicked, this, &WTrackTableView::slotMouseDoubleClicked); - m_pCOTGuiTick = new ControlProxy("[Master]", "guiTick50ms", this); + m_pCOTGuiTick = new ControlProxy( + QStringLiteral("[App]"), QStringLiteral("gui_tick_50ms_period_s"), this); m_pCOTGuiTick->connectValueChanged(this, &WTrackTableView::slotGuiTick50ms); m_pKeyNotation = new ControlProxy(mixxx::library::prefs::kKeyNotationConfigKey, this); From 859bd45a25394d6109d4df17f8adc00a1fcc52ac Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Wed, 13 Sep 2023 20:27:44 +0200 Subject: [PATCH 2/7] refactor(controlindicator): Move `indicator_` COs to `[App]` group --- res/controllers/Roland_DJ-505-scripts.js | 4 ++-- src/control/controlindicator.cpp | 8 ++++++-- src/control/controlindicatortimer.cpp | 9 +++++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/res/controllers/Roland_DJ-505-scripts.js b/res/controllers/Roland_DJ-505-scripts.js index c92ac064ab8..9a12faefc84 100644 --- a/res/controllers/Roland_DJ-505-scripts.js +++ b/res/controllers/Roland_DJ-505-scripts.js @@ -609,7 +609,7 @@ DJ505.Deck = function(deckNumbers, offset) { // indicator for the LED instead. if (value === 3) { if (this.connections[1] === undefined) { - this.connections[1] = engine.makeConnection("[Master]", "indicator_500millis", this.setLed.bind(this)); + this.connections[1] = engine.makeConnection("[App]", "indicator_500ms", this.setLed.bind(this)); } return; } @@ -1638,7 +1638,7 @@ DJ505.SavedLoopMode = function(deck, offset) { output: function(value, _group, _control) { this.stopBlinking(); if (value === 2) { - this.connections[2] = engine.makeConnection("[Master]", "indicator_250millis", function(value, _group, _control) { + this.connections[2] = engine.makeConnection("[App]", "indicator_250ms", function(value, _group, _control) { const colorValue = this.colorMapper.getValueForNearestColor( engine.getValue(this.group, this.colorKey)); if (value) { diff --git a/src/control/controlindicator.cpp b/src/control/controlindicator.cpp index c4734d74f49..8c1dab6f001 100644 --- a/src/control/controlindicator.cpp +++ b/src/control/controlindicator.cpp @@ -4,13 +4,17 @@ #include "moc_controlindicator.cpp" #include "util/math.h" +namespace { +const QString kAppGroup = QStringLiteral("[App]"); +} + ControlIndicator::ControlIndicator(const ConfigKey& key) : ControlObject(key, false), m_blinkValue(OFF), m_pCOIndicator250millis(make_parented( - "[Master]", "indicator_250millis", this)), + kAppGroup, QStringLiteral("indicator_250ms"), this)), m_pCOIndicator500millis(make_parented( - "[Master]", "indicator_500millis", this)) { + kAppGroup, QStringLiteral("indicator_500ms"), this)) { connect(this, &ControlIndicator::blinkValueChanged, this, diff --git a/src/control/controlindicatortimer.cpp b/src/control/controlindicatortimer.cpp index 562d8684d52..775144fc7f4 100644 --- a/src/control/controlindicatortimer.cpp +++ b/src/control/controlindicatortimer.cpp @@ -6,6 +6,7 @@ namespace { const QString kAppGroup = QStringLiteral("[App]"); +const QString kLegacyGroup = QStringLiteral("[Master]"); } // namespace namespace mixxx { @@ -13,13 +14,17 @@ namespace mixxx { ControlIndicatorTimer::ControlIndicatorTimer(QObject* pParent) : QObject(pParent), m_pCOIndicator250millis(std::make_unique( - ConfigKey(kAppGroup, QStringLiteral("indicator_250millis")))), + ConfigKey(kAppGroup, QStringLiteral("indicator_250ms")))), m_pCOIndicator500millis(std::make_unique( - ConfigKey(kAppGroup, QStringLiteral("indicator_500millis")))), + ConfigKey(kAppGroup, QStringLiteral("indicator_500ms")))), m_nextSwitchTime(0.0), m_pCPGuiTick50ms(nullptr) { m_pCOIndicator250millis->setReadOnly(); + m_pCOIndicator250millis->addAlias( + ConfigKey(kLegacyGroup, QStringLiteral("indicator_250millis"))); m_pCOIndicator500millis->setReadOnly(); + m_pCOIndicator500millis->addAlias( + ConfigKey(kLegacyGroup, QStringLiteral("indicator_500millis"))); connect(&m_timer, &QTimer::timeout, this, &ControlIndicatorTimer::slotTimeout); m_timer.start(250); } From cfca585c089a8b8366ab52800d0f30c71b708253 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Wed, 13 Sep 2023 20:45:08 +0200 Subject: [PATCH 3/7] refactor(enginemixer): Move `samplerate` CO to `[App]` group --- res/controllers/Denon-MC6000MK2-scripts.js | 4 ++-- src/controllers/controlpickermenu.cpp | 4 ++++ src/engine/channels/enginechannel.cpp | 2 +- src/engine/controls/ratecontrol.cpp | 3 ++- src/engine/enginebuffer.cpp | 4 +++- src/engine/enginedelay.cpp | 3 ++- src/engine/enginemixer.cpp | 8 +++++++- src/engine/enginetalkoverducking.cpp | 2 +- src/engine/enginevumeter.cpp | 2 +- src/engine/positionscratchcontroller.cpp | 3 ++- src/engine/sidechain/enginerecord.cpp | 12 +++++------- src/engine/sidechain/enginerecord.h | 3 ++- src/engine/sidechain/shoutconnection.cpp | 2 +- src/soundio/sounddevicenetwork.cpp | 4 +++- src/soundio/sounddeviceportaudio.cpp | 3 ++- src/test/co_dumps/co_dump_inital.csv | 2 +- 16 files changed, 39 insertions(+), 22 deletions(-) diff --git a/res/controllers/Denon-MC6000MK2-scripts.js b/res/controllers/Denon-MC6000MK2-scripts.js index b98db276722..68108534512 100644 --- a/res/controllers/Denon-MC6000MK2-scripts.js +++ b/res/controllers/Denon-MC6000MK2-scripts.js @@ -1333,14 +1333,14 @@ DenonMC6000MK2.getJogDeltaValue = function(value) { }; DenonMC6000MK2.initValues = function() { - DenonMC6000MK2.backupSampleRate = engine.getValue(DenonMC6000MK2.group, "samplerate"); + DenonMC6000MK2.backupSampleRate = engine.getValue("[App]", "samplerate"); if (DenonMC6000MK2.backupSampleRate !== DenonMC6000MK2.SAMPLE_RATE) { DenonMC6000MK2.logInfo( "Adjusting sample rate: " + DenonMC6000MK2.backupSampleRate + " -> " + DenonMC6000MK2.SAMPLE_RATE); - DenonMC6000MK2.setValue("samplerate", DenonMC6000MK2.SAMPLE_RATE); + engine.setValue("[App]", "samplerate", DenonMC6000MK2.SAMPLE_RATE); } DenonMC6000MK2.backupNumDecks = DenonMC6000MK2.getValue("num_decks"); if (DenonMC6000MK2.backupNumDecks !== DenonMC6000MK2.DECK_COUNT) { diff --git a/src/controllers/controlpickermenu.cpp b/src/controllers/controlpickermenu.cpp index 8a49e42b49e..1b445015835 100644 --- a/src/controllers/controlpickermenu.cpp +++ b/src/controllers/controlpickermenu.cpp @@ -11,6 +11,10 @@ #include "recording/defs_recording.h" #include "vinylcontrol/defs_vinylcontrol.h" +namespace { +const QString kAppGroup = QStringLiteral("[App]"); +} + ControlPickerMenu::ControlPickerMenu(QWidget* pParent) : QMenu(pParent) { m_effectMainOutputStr = tr("Main Output"); diff --git a/src/engine/channels/enginechannel.cpp b/src/engine/channels/enginechannel.cpp index 7369afb1d86..5602f04a9c4 100644 --- a/src/engine/channels/enginechannel.cpp +++ b/src/engine/channels/enginechannel.cpp @@ -12,7 +12,7 @@ EngineChannel::EngineChannel(const ChannelHandleAndGroup& handleGroup, : m_group(handleGroup), m_pEffectsManager(pEffectsManager), m_vuMeter(getGroup()), - m_sampleRate("[Master]", "samplerate"), + m_sampleRate(QStringLiteral("[App]"), QStringLiteral("samplerate")), m_sampleBuffer(nullptr), m_bIsPrimaryDeck(isPrimaryDeck), m_active(false), diff --git a/src/engine/controls/ratecontrol.cpp b/src/engine/controls/ratecontrol.cpp index dc0c3babd9d..bf76da8841c 100644 --- a/src/engine/controls/ratecontrol.cpp +++ b/src/engine/controls/ratecontrol.cpp @@ -135,7 +135,8 @@ RateControl::RateControl(const QString& group, // We need the sample rate so we can guesstimate something close // what latency is. - m_pSampleRate = ControlObject::getControl(ConfigKey("[Master]","samplerate")); + m_pSampleRate = ControlObject::getControl( + ConfigKey(QStringLiteral("[App]"), QStringLiteral("samplerate"))); // Wheel to control playback position/speed m_pWheel = new ControlTTRotary(ConfigKey(group, "wheel")); diff --git a/src/engine/enginebuffer.cpp b/src/engine/enginebuffer.cpp index b0db5f29df9..909c8192a61 100644 --- a/src/engine/enginebuffer.cpp +++ b/src/engine/enginebuffer.cpp @@ -62,6 +62,8 @@ constexpr SINT kSamplesPerFrame = 2; // Engine buffer uses Stereo frames only // Rate at which the playpos slider is updated constexpr int kPlaypositionUpdateRate = 15; // updates per second +const QString kAppGroup = QStringLiteral("[App]"); + } // anonymous namespace EngineBuffer::EngineBuffer(const QString& group, @@ -174,7 +176,7 @@ EngineBuffer::EngineBuffer(const QString& group, m_pRepeat = new ControlPushButton(ConfigKey(m_group, "repeat")); m_pRepeat->setButtonMode(ControlPushButton::TOGGLE); - m_pSampleRate = new ControlProxy("[Master]", "samplerate", this); + m_pSampleRate = new ControlProxy(kAppGroup, QStringLiteral("samplerate"), this); m_pTrackSamples = new ControlObject(ConfigKey(m_group, "track_samples")); m_pTrackSampleRate = new ControlObject(ConfigKey(m_group, "track_samplerate")); diff --git a/src/engine/enginedelay.cpp b/src/engine/enginedelay.cpp index ff675c4d54a..5e82f0428f7 100644 --- a/src/engine/enginedelay.cpp +++ b/src/engine/enginedelay.cpp @@ -11,6 +11,7 @@ namespace { constexpr double kdMaxDelayPot = 500; const int kiMaxDelay = static_cast((kdMaxDelayPot + 8) / 1000 * mixxx::audio::SampleRate::kValueMax * mixxx::kEngineChannelCount); +const QString kAppGroup = QStringLiteral("[App]"); } // anonymous namespace EngineDelay::EngineDelay(const QString& group, const ConfigKey& delayControl, bool bPersist) @@ -23,7 +24,7 @@ EngineDelay::EngineDelay(const QString& group, const ConfigKey& delayControl, bo connect(m_pDelayPot, &ControlObject::valueChanged, this, &EngineDelay::slotDelayChanged, Qt::DirectConnection); - m_pSampleRate = new ControlProxy(group, "samplerate", this); + m_pSampleRate = new ControlProxy(kAppGroup, QStringLiteral("samplerate"), this); m_pSampleRate->connectValueChanged(this, &EngineDelay::slotDelayChanged, Qt::DirectConnection); } diff --git a/src/engine/enginemixer.cpp b/src/engine/enginemixer.cpp index 27048a8fb1c..b70e97c2e83 100644 --- a/src/engine/enginemixer.cpp +++ b/src/engine/enginemixer.cpp @@ -28,6 +28,10 @@ #include "util/timer.h" #include "util/trace.h" +namespace { +const QString kAppGroup = QStringLiteral("[App]"); +} + EngineMixer::EngineMixer( UserSettingsPointer pConfig, const QString& group, @@ -67,7 +71,9 @@ EngineMixer::EngineMixer( m_pWorkerScheduler->start(QThread::HighPriority); // Main sample rate - m_pMainSampleRate = new ControlObject(ConfigKey(group, "samplerate"), true, true); + m_pMainSampleRate = new ControlObject( + ConfigKey(kAppGroup, QStringLiteral("samplerate")), true, true); + m_pMainSampleRate->addAlias(ConfigKey(group, QStringLiteral("samplerate"))); m_pMainSampleRate->set(44100.); // Latency control diff --git a/src/engine/enginetalkoverducking.cpp b/src/engine/enginetalkoverducking.cpp index cb6d22f55a1..1531b5a569f 100644 --- a/src/engine/enginetalkoverducking.cpp +++ b/src/engine/enginetalkoverducking.cpp @@ -14,7 +14,7 @@ EngineTalkoverDucking::EngineTalkoverDucking( : EngineSideChainCompressor(group), m_pConfig(pConfig), m_group(group) { - m_pSampleRate = new ControlProxy(m_group, "samplerate", this); + m_pSampleRate = new ControlProxy(QStringLiteral("[App]"), QStringLiteral("samplerate"), this); m_pSampleRate->connectValueChanged(this, &EngineTalkoverDucking::slotSampleRateChanged, Qt::DirectConnection); diff --git a/src/engine/enginevumeter.cpp b/src/engine/enginevumeter.cpp index bb8ced9fa43..332bc154bbf 100644 --- a/src/engine/enginevumeter.cpp +++ b/src/engine/enginevumeter.cpp @@ -19,7 +19,7 @@ constexpr CSAMPLE kDecaySmoothing = 0.1f; //.16//.4 } // namespace EngineVuMeter::EngineVuMeter(const QString& group) - : m_sampleRate("[Master]", "samplerate") { + : m_sampleRate(QStringLiteral("[App]"), QStringLiteral("samplerate")) { // The VUmeter widget is controlled via a controlpotmeter, which means // that it should react on the setValue(int) signal. m_ctrlVuMeter = new ControlPotmeter(ConfigKey(group, "VuMeter"), 0., 1.); diff --git a/src/engine/positionscratchcontroller.cpp b/src/engine/positionscratchcontroller.cpp index c3b5ff048be..e83213ec83c 100644 --- a/src/engine/positionscratchcontroller.cpp +++ b/src/engine/positionscratchcontroller.cpp @@ -77,7 +77,8 @@ PositionScratchController::PositionScratchController(const QString& group) m_dMouseSampeTime(0) { m_pScratchEnable = new ControlObject(ConfigKey(group, "scratch_position_enable")); m_pScratchPosition = new ControlObject(ConfigKey(group, "scratch_position")); - m_pMainSampleRate = ControlObject::getControl(ConfigKey("[Master]", "samplerate")); + m_pMainSampleRate = ControlObject::getControl( + ConfigKey(QStringLiteral("[App]"), QStringLiteral("samplerate"))); m_pVelocityController = new VelocityController(); m_pRateIIFilter = new RateIIFilter; } diff --git a/src/engine/sidechain/enginerecord.cpp b/src/engine/sidechain/enginerecord.cpp index 6d44b006753..7858efee3aa 100644 --- a/src/engine/sidechain/enginerecord.cpp +++ b/src/engine/sidechain/enginerecord.cpp @@ -14,22 +14,20 @@ constexpr int kMetaDataLifeTimeout = 16; EngineRecord::EngineRecord(UserSettingsPointer pConfig) : m_pConfig(pConfig), + m_sampleRateControl(QStringLiteral("[App]"), QStringLiteral("samplerate")), m_frames(0), m_recordedDuration(0), m_iMetaDataLife(0), m_cueTrack(0), m_bCueIsEnabled(false) { - m_pRecReady = new ControlProxy(RECORDING_PREF_KEY, "status", this); - m_pSamplerate = new ControlProxy("[Master]", "samplerate", this); - m_sampleRate = static_cast(m_pSamplerate->get()); + m_sampleRate = mixxx::audio::SampleRate::fromDouble(m_sampleRateControl.get()); } EngineRecord::~EngineRecord() { closeCueFile(); closeFile(); delete m_pRecReady; - delete m_pSamplerate; } int EngineRecord::updateFromPreferences() { @@ -39,7 +37,7 @@ int EngineRecord::updateFromPreferences() { m_baAlbum = m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "Album")); m_cueFileName = m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "CuePath")); m_bCueIsEnabled = m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "CueEnabled")).toInt(); - m_sampleRate = static_cast(m_pSamplerate->get()); + m_sampleRate = mixxx::audio::SampleRate::fromDouble(m_sampleRateControl.get()); // Delete m_pEncoder if it has been initialized (with maybe) different bitrate. if (m_pEncoder) { @@ -148,7 +146,7 @@ void EngineRecord::process(const CSAMPLE* pBuffer, const int iBufferSize) { // clean frames counting and get current sample rate. m_frames = 0; - m_sampleRate = static_cast(m_pSamplerate->get()); + m_sampleRate = mixxx::audio::SampleRate::fromDouble(m_sampleRateControl.get()); if (m_bCueIsEnabled) { openCueFile(); @@ -180,7 +178,7 @@ void EngineRecord::process(const CSAMPLE* pBuffer, const int iBufferSize) { // clean frames counting and get current sample rate. m_frames = 0; - m_sampleRate = static_cast(m_pSamplerate->get()); + m_sampleRate = mixxx::audio::SampleRate::fromDouble(m_sampleRateControl.get()); m_recordedDuration = 0; if (m_bCueIsEnabled) { diff --git a/src/engine/sidechain/enginerecord.h b/src/engine/sidechain/enginerecord.h index 18b6a9f90e9..eb9d45fed8a 100644 --- a/src/engine/sidechain/enginerecord.h +++ b/src/engine/sidechain/enginerecord.h @@ -4,6 +4,7 @@ #include #include "audio/types.h" +#include "control/pollingcontrolproxy.h" #include "encoder/encoder.h" #include "encoder/encodercallback.h" #include "engine/sidechain/sidechainworker.h" @@ -72,8 +73,8 @@ class EngineRecord : public QObject, public EncoderCallback, public SideChainWor QFile m_cueFile; QDataStream m_dataStream; + PollingControlProxy m_sampleRateControl; ControlProxy* m_pRecReady; - ControlProxy* m_pSamplerate; quint64 m_frames; mixxx::audio::SampleRate m_sampleRate; quint64 m_recordedDuration; diff --git a/src/engine/sidechain/shoutconnection.cpp b/src/engine/sidechain/shoutconnection.cpp index 8e0eb01e730..b4e0aebeeae 100644 --- a/src/engine/sidechain/shoutconnection.cpp +++ b/src/engine/sidechain/shoutconnection.cpp @@ -58,7 +58,7 @@ ShoutConnection::ShoutConnection(BroadcastProfilePtr profile, m_pConfig(pConfig), m_pProfile(profile), m_encoder(nullptr), - m_mainSamplerate("[Master]", "samplerate"), + m_mainSamplerate(QStringLiteral("[App]"), QStringLiteral("samplerate")), m_broadcastEnabled(BROADCAST_PREF_KEY, "enabled"), m_custom_metadata(false), m_firstCall(false), diff --git a/src/soundio/sounddevicenetwork.cpp b/src/soundio/sounddevicenetwork.cpp index b481e5a0ba1..991539099e6 100644 --- a/src/soundio/sounddevicenetwork.cpp +++ b/src/soundio/sounddevicenetwork.cpp @@ -28,6 +28,8 @@ constexpr int kNetworkLatencyFrames = 8192; // 185 ms @ 44100 Hz // which is 185 @ 44100 ms and twice the maximum of the max mixxx audio buffer const mixxx::Logger kLogger("SoundDeviceNetwork"); + +const QString kAppGroup = QStringLiteral("[App]"); } // namespace SoundDeviceNetwork::SoundDeviceNetwork( @@ -89,7 +91,7 @@ SoundDeviceStatus SoundDeviceNetwork::open(bool isClkRefDevice, int syncBuffers) // waveform view to properly correct for the latency. ControlObject::set(ConfigKey("[Master]", "latency"), requestedBufferTime.toDoubleMillis()); - ControlObject::set(ConfigKey("[Master]", "samplerate"), m_dSampleRate); + ControlObject::set(ConfigKey(kAppGroup, QStringLiteral("samplerate")), m_dSampleRate); // Network stream was just started above so we have to wait until // we can pass one chunk. diff --git a/src/soundio/sounddeviceportaudio.cpp b/src/soundio/sounddeviceportaudio.cpp index 1167764f4e2..a1bed4497bc 100644 --- a/src/soundio/sounddeviceportaudio.cpp +++ b/src/soundio/sounddeviceportaudio.cpp @@ -74,6 +74,7 @@ int paV19CallbackClkRef(const void *inputBuffer, void *outputBuffer, const QRegularExpression kAlsaHwDeviceRegex("(.*) \\((plug)?(hw:(\\d)+(,(\\d)+))?\\)"); +const QString kAppGroup = QStringLiteral("[App]"); } // anonymous namespace SoundDevicePortAudio::SoundDevicePortAudio(UserSettingsPointer config, @@ -385,7 +386,7 @@ SoundDeviceStatus SoundDevicePortAudio::open(bool isClkRefDevice, int syncBuffer // Update the samplerate and latency ControlObjects, which allow the // waveform view to properly correct for the latency. ControlObject::set(ConfigKey("[Master]", "latency"), currentLatencyMSec); - ControlObject::set(ConfigKey("[Master]", "samplerate"), m_dSampleRate); + ControlObject::set(ConfigKey(kAppGroup, QStringLiteral("samplerate")), m_dSampleRate); m_invalidTimeInfoCount = 0; m_clkRefTimer.start(); } diff --git a/src/test/co_dumps/co_dump_inital.csv b/src/test/co_dumps/co_dump_inital.csv index f8826a9c033..83905923c3f 100644 --- a/src/test/co_dumps/co_dump_inital.csv +++ b/src/test/co_dumps/co_dump_inital.csv @@ -1583,7 +1583,7 @@ [EffectRack1_EffectUnit1_Effect2],parameter2_set_one,0 [Microphone],talkover,0 [Sampler4],hotcue_31_position,-1 -[Master],samplerate,44100 +[App],samplerate,44100 [EffectRack1_EffectUnit4_Effect4],parameter10_set_default,0 [EffectRack1_EffectUnit1_Effect3],parameter3_link_inverse,0 [EffectRack1_EffectUnit3_Effect4],parameter8_link_inverse,0 From 375e0bc7a911b869e3cb72c55508211b014a295d Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Wed, 13 Sep 2023 21:53:31 +0200 Subject: [PATCH 4/7] refactor(engine): Move `keylock_engine` CO into `[App]` group --- src/engine/enginebuffer.cpp | 2 +- src/engine/enginemixer.cpp | 2 +- src/preferences/dialog/dlgprefsound.cpp | 4 +- src/test/co_dumps/co_dump_inital.csv | 2 +- src/test/enginebuffertest.cpp | 124 +++++++++++++----------- 5 files changed, 71 insertions(+), 63 deletions(-) diff --git a/src/engine/enginebuffer.cpp b/src/engine/enginebuffer.cpp index 909c8192a61..ab7e5c0f915 100644 --- a/src/engine/enginebuffer.cpp +++ b/src/engine/enginebuffer.cpp @@ -260,7 +260,7 @@ EngineBuffer::EngineBuffer(const QString& group, m_pLoopingControl); m_pReadAheadManager->addRateControl(m_pRateControl); - m_pKeylockEngine = new ControlProxy("[Master]", "keylock_engine", this); + m_pKeylockEngine = new ControlProxy(kAppGroup, QStringLiteral("keylock_engine"), this); m_pKeylockEngine->connectValueChanged(this, &EngineBuffer::slotKeylockEngineChanged, Qt::DirectConnection); diff --git a/src/engine/enginemixer.cpp b/src/engine/enginemixer.cpp index b70e97c2e83..b3485c7caf2 100644 --- a/src/engine/enginemixer.cpp +++ b/src/engine/enginemixer.cpp @@ -177,7 +177,7 @@ EngineMixer::EngineMixer( ConfigKey(EngineXfader::kXfaderConfigKey, "xFaderReverse")); m_pXFaderReverse->setButtonMode(ControlPushButton::TOGGLE); - m_pKeylockEngine = new ControlObject(ConfigKey(group, "keylock_engine"), true, false, true); + m_pKeylockEngine = new ControlObject(ConfigKey(kAppGroup, QStringLiteral("keylock_engine"))); m_pKeylockEngine->set(pConfig->getValue(ConfigKey(group, "keylock_engine"), static_cast(EngineBuffer::defaultKeylockEngine()))); diff --git a/src/preferences/dialog/dlgprefsound.cpp b/src/preferences/dialog/dlgprefsound.cpp index d496e29ab7e..cd2586b3693 100644 --- a/src/preferences/dialog/dlgprefsound.cpp +++ b/src/preferences/dialog/dlgprefsound.cpp @@ -17,6 +17,8 @@ namespace { +const QString kAppGroup = QStringLiteral("[App]"); + bool soundItemAlreadyExists(const AudioPath& output, const QWidget& widget) { for (const QObject* pObj : widget.children()) { const auto* pItem = qobject_cast(pObj); @@ -231,7 +233,7 @@ DlgPrefSound::DlgPrefSound(QWidget* pParent, m_pMainMonoMixdown->connectValueChanged(this, &DlgPrefSound::mainMonoMixdownChanged); m_pKeylockEngine = - new ControlProxy("[Master]", "keylock_engine", this); + new ControlProxy(kAppGroup, QStringLiteral("keylock_engine"), this); #ifdef __LINUX__ qDebug() << "RLimit Cur " << RLimit::getCurRtPrio(); diff --git a/src/test/co_dumps/co_dump_inital.csv b/src/test/co_dumps/co_dump_inital.csv index 83905923c3f..daeef03c903 100644 --- a/src/test/co_dumps/co_dump_inital.csv +++ b/src/test/co_dumps/co_dump_inital.csv @@ -1349,7 +1349,7 @@ [EffectRack1_EffectUnit3_Effect2],parameter2_link_inverse,0 [EqualizerRack1_[Channel1]_Effect1],parameter8_loaded,0 [EffectRack1_EffectUnit4_Effect1],parameter9_link_type,0 -[Master],keylock_engine,0 +[App],keylock_engine,0 [Sampler3],rateSearch_down,0 [Channel3],beatloop_0.125_toggle,0 [Channel2],duration,0 diff --git a/src/test/enginebuffertest.cpp b/src/test/enginebuffertest.cpp index 909e158d632..dbf56f4083d 100644 --- a/src/test/enginebuffertest.cpp +++ b/src/test/enginebuffertest.cpp @@ -1,22 +1,28 @@ // Tests for enginebuffer.cpp -#include #include -#include +#include + +#include #include +#include +#include "control/controlobject.h" +#include "engine/controls/ratecontrol.h" #include "mixer/basetrackplayer.h" #include "preferences/usersettings.h" -#include "control/controlobject.h" -#include "test/mockedenginebackendtest.h" #include "test/mixxxtest.h" +#include "test/mockedenginebackendtest.h" #include "test/signalpathtest.h" -#include "engine/controls/ratecontrol.h" // In case any of the test in this file fail. You can use the audioplot.py tool // in the tools folder to visually compare the results of the enginebuffer // with the golden test data. +namespace { +const QString kAppGroup = QStringLiteral("[App]"); +} + class EngineBufferTest : public MockedEngineBackendTest {}; class EngineBufferE2ETest : public SignalPathTest {}; @@ -102,7 +108,7 @@ TEST_F(EngineBufferTest, SlowRubberBand) { ControlObject::set(ConfigKey(m_sGroup1, "rateSearch"), 0.0072); // With Soundtouch, it should switch the scaler as well - ControlObject::set(ConfigKey("[Master]", "keylock_engine"), + ControlObject::set(ConfigKey(kAppGroup, QStringLiteral("keylock_engine")), static_cast(EngineBuffer::KeylockEngine::SoundTouch)); ProcessBuffer(); EXPECT_EQ(m_pMockScaleVinyl1, m_pChannel1->getEngineBuffer()->m_pScale); @@ -112,7 +118,7 @@ TEST_F(EngineBufferTest, SlowRubberBand) { ProcessBuffer(); // With Rubberband, and transport stopped it should be still keylock - ControlObject::set(ConfigKey("[Master]", "keylock_engine"), + ControlObject::set(ConfigKey(kAppGroup, QStringLiteral("keylock_engine")), static_cast(EngineBuffer::KeylockEngine::RubberBandFaster)); ControlObject::set(ConfigKey(m_sGroup1, "rateSearch"), 0.0); ProcessBuffer(); @@ -204,7 +210,7 @@ TEST_F(EngineBufferTest, ResetPitchAdjustUsesLinear) { TEST_F(EngineBufferE2ETest, SoundTouchCrashTest) { // Soundtouch has a bug where a pitch value of zero causes an infinite loop // and crash. - ControlObject::set(ConfigKey("[Master]", "keylock_engine"), + ControlObject::set(ConfigKey(kAppGroup, QStringLiteral("keylock_engine")), static_cast(EngineBuffer::KeylockEngine::SoundTouch)); ControlObject::set(ConfigKey(m_sGroup1, "pitch"), 1.2); ControlObject::set(ConfigKey(m_sGroup1, "rate"), 0.05); @@ -284,59 +290,59 @@ TEST_F(EngineBufferE2ETest, ReverseTest) { // DISABLED: This test is too dependent on the sound touch library version. TEST_F(EngineBufferE2ETest, DISABLED_SoundTouchToggleTest) { // Test various cases where SoundTouch toggles on and off. - ControlObject::set(ConfigKey("[Master]", "keylock_engine"), - static_cast(EngineBuffer::KeylockEngine::SoundTouch)); - ControlObject::set(ConfigKey(m_sGroup1, "rate"), 0.5); - ControlObject::set(ConfigKey(m_sGroup1, "play"), 1.0); - ProcessBuffer(); - // Test transition from vinyl to keylock - ControlObject::set(ConfigKey(m_sGroup1, "keylock"), 1.0); - ProcessBuffer(); - assertBufferMatchesReference(m_pEngineMixer->getMainBuffer(), - kProcessBufferSize, - "SoundTouchTest"); - // Test transition from keylock to vinyl due to slow speed. - ControlObject::set(ConfigKey(m_sGroup1, "play"), 0.0); - ControlObject::set(ConfigKey(m_sGroup1, "rateSearch"), 0.0072); - ProcessBuffer(); - assertBufferMatchesReference(m_pEngineMixer->getMainBuffer(), - kProcessBufferSize, - "SoundTouchTestSlow"); - // Test transition back to keylock due to regular speed. - ControlObject::set(ConfigKey(m_sGroup1, "rateSearch"), 1.0); - ProcessBuffer(); - assertBufferMatchesReference(m_pEngineMixer->getMainBuffer(), - kProcessBufferSize, - "SoundTouchTestRegular"); + ControlObject::set(ConfigKey(kAppGroup, QStringLiteral("keylock_engine")), + static_cast(EngineBuffer::KeylockEngine::SoundTouch)); + ControlObject::set(ConfigKey(m_sGroup1, "rate"), 0.5); + ControlObject::set(ConfigKey(m_sGroup1, "play"), 1.0); + ProcessBuffer(); + // Test transition from vinyl to keylock + ControlObject::set(ConfigKey(m_sGroup1, "keylock"), 1.0); + ProcessBuffer(); + assertBufferMatchesReference(m_pEngineMixer->getMainBuffer(), + kProcessBufferSize, + "SoundTouchTest"); + // Test transition from keylock to vinyl due to slow speed. + ControlObject::set(ConfigKey(m_sGroup1, "play"), 0.0); + ControlObject::set(ConfigKey(m_sGroup1, "rateSearch"), 0.0072); + ProcessBuffer(); + assertBufferMatchesReference(m_pEngineMixer->getMainBuffer(), + kProcessBufferSize, + "SoundTouchTestSlow"); + // Test transition back to keylock due to regular speed. + ControlObject::set(ConfigKey(m_sGroup1, "rateSearch"), 1.0); + ProcessBuffer(); + assertBufferMatchesReference(m_pEngineMixer->getMainBuffer(), + kProcessBufferSize, + "SoundTouchTestRegular"); } // DISABLED: This test is too dependent on the rubber band library version. TEST_F(EngineBufferE2ETest, DISABLED_RubberbandToggleTest) { // Test various cases where Rubberband toggles on and off. - ControlObject::set(ConfigKey("[Master]", "keylock_engine"), - static_cast(EngineBuffer::KeylockEngine::RubberBandFaster)); - ControlObject::set(ConfigKey(m_sGroup1, "rate"), 0.5); - ControlObject::set(ConfigKey(m_sGroup1, "play"), 1.0); - ProcessBuffer(); - // Test transition from vinyl to keylock - ControlObject::set(ConfigKey(m_sGroup1, "keylock"), 1.0); - ProcessBuffer(); - assertBufferMatchesReference(m_pEngineMixer->getMainBuffer(), - kProcessBufferSize, - "RubberbandTest"); - // Test transition from keylock to vinyl due to slow speed. - ControlObject::set(ConfigKey(m_sGroup1, "play"), 0.0); - ControlObject::set(ConfigKey(m_sGroup1, "rateSearch"), 0.0072); - ProcessBuffer(); - assertBufferMatchesReference(m_pEngineMixer->getMainBuffer(), - kProcessBufferSize, - "RubberbandTestSlow"); - // Test transition back to keylock due to regular speed. - ControlObject::set(ConfigKey(m_sGroup1, "rateSearch"), 1.0); - ProcessBuffer(); - assertBufferMatchesReference(m_pEngineMixer->getMainBuffer(), - kProcessBufferSize, - "RubberbandTestRegular"); + ControlObject::set(ConfigKey(kAppGroup, QStringLiteral("keylock_engine")), + static_cast(EngineBuffer::KeylockEngine::RubberBandFaster)); + ControlObject::set(ConfigKey(m_sGroup1, "rate"), 0.5); + ControlObject::set(ConfigKey(m_sGroup1, "play"), 1.0); + ProcessBuffer(); + // Test transition from vinyl to keylock + ControlObject::set(ConfigKey(m_sGroup1, "keylock"), 1.0); + ProcessBuffer(); + assertBufferMatchesReference(m_pEngineMixer->getMainBuffer(), + kProcessBufferSize, + "RubberbandTest"); + // Test transition from keylock to vinyl due to slow speed. + ControlObject::set(ConfigKey(m_sGroup1, "play"), 0.0); + ControlObject::set(ConfigKey(m_sGroup1, "rateSearch"), 0.0072); + ProcessBuffer(); + assertBufferMatchesReference(m_pEngineMixer->getMainBuffer(), + kProcessBufferSize, + "RubberbandTestSlow"); + // Test transition back to keylock due to regular speed. + ControlObject::set(ConfigKey(m_sGroup1, "rateSearch"), 1.0); + ProcessBuffer(); + assertBufferMatchesReference(m_pEngineMixer->getMainBuffer(), + kProcessBufferSize, + "RubberbandTestRegular"); } // DISABLED: This test is too dependent on the sound touch library version. @@ -347,7 +353,7 @@ TEST_F(EngineBufferE2ETest, DISABLED_RubberbandToggleTest) { TEST_F(EngineBufferE2ETest, DISABLED_KeylockReverseTest) { // Confirm that when toggling reverse while keylock is on, interpolation // is smooth. - ControlObject::set(ConfigKey("[Master]", "keylock_engine"), + ControlObject::set(ConfigKey(kAppGroup, QStringLiteral("keylock_engine")), static_cast(EngineBuffer::KeylockEngine::SoundTouch)); ControlObject::set(ConfigKey(m_sGroup1, "keylockMode"), 0.0); @@ -378,7 +384,7 @@ TEST_F(EngineBufferE2ETest, SeekTest) { TEST_F(EngineBufferE2ETest, SoundTouchReverseTest) { // This test must not crash when changing to reverse while pitch is tweaked // Testing issue #8061 - ControlObject::set(ConfigKey("[Master]", "keylock_engine"), + ControlObject::set(ConfigKey(kAppGroup, QStringLiteral("keylock_engine")), static_cast(EngineBuffer::KeylockEngine::SoundTouch)); ControlObject::set(ConfigKey(m_sGroup1, "pitch"), -1); ControlObject::set(ConfigKey(m_sGroup1, "play"), 1.0); @@ -392,7 +398,7 @@ TEST_F(EngineBufferE2ETest, SoundTouchReverseTest) { TEST_F(EngineBufferE2ETest, RubberbandReverseTest) { // This test must not crash when changing to reverse while pitch is tweaked // Testing issue #8061 - ControlObject::set(ConfigKey("[Master]", "keylock_engine"), + ControlObject::set(ConfigKey(kAppGroup, QStringLiteral("keylock_engine")), static_cast(EngineBuffer::KeylockEngine::RubberBandFaster)); ControlObject::set(ConfigKey(m_sGroup1, "pitch"), -1); ControlObject::set(ConfigKey(m_sGroup1, "play"), 1.0); From f3245425f3ed8473ea1bde606b3c902b5f50dab7 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Wed, 13 Sep 2023 22:54:17 +0200 Subject: [PATCH 5/7] refactor(playermanager): Move player `num_*` COs to `[App]` group --- res/controllers/Denon-DN-SC2000.midi.js | 2 +- res/controllers/Denon-MC6000MK2-scripts.js | 8 +++---- res/controllers/Electrix-Tweaker-scripts.js | 4 ++-- .../Hercules-DJ-Control-AIR-scripts.js | 4 ++-- res/controllers/Hercules-P32-scripts.js | 4 ++-- res/controllers/Korg-nanoKONTROL-2-scripts.js | 4 ++-- .../Novation-Launchpad MK2-scripts.js | 2 +- .../Novation-Launchpad-Mini-scripts.js | 2 +- res/controllers/Novation-Launchpad-scripts.js | 2 +- res/controllers/Reloop Terminal Mix 2-4.js | 16 ++++++------- res/controllers/Reloop-Beatmix-2-4-scripts.js | 2 +- res/controllers/Reloop-Beatpad-scripts.js | 4 ++-- res/controllers/Roland_DJ-505-scripts.js | 4 ++-- res/controllers/Stanton-DJC-4-scripts.js | 4 ++-- res/controllers/Stanton-SCS1d-scripts.js | 4 ++-- res/controllers/Stanton-SCS1m-scripts.js | 4 ++-- res/controllers/Stanton-SCS3d-scripts.js | 6 ++--- res/controllers/Traktor-Kontrol-S4-MK3.js | 4 ++-- res/controllers/Vestax-VCI-300-scripts.js | 6 ++--- res/controllers/Vestax-VCI-400-scripts.js | 2 +- res/controllers/common-hid-packet-parser.js | 2 +- res/qml/LibraryControl.qml | 6 ++--- res/skins/Deere (64 Samplers)/skin.xml | 6 ++--- res/skins/Deere/skin.xml | 6 ++--- res/skins/LateNight (64 Samplers)/skin.xml | 4 ++-- res/skins/LateNight/skin.xml | 4 ++-- res/skins/Shade/skin.xml | 6 ++--- res/skins/Tango (64 Samplers)/skin.xml | 4 ++-- res/skins/Tango/skin.xml | 4 ++-- src/controllers/controlpickermenu.cpp | 20 ++++++++-------- src/library/librarycontrol.cpp | 10 +++++--- src/mixer/playermanager.cpp | 23 ++++++++++++------- src/mixer/samplerbank.cpp | 4 +++- src/preferences/dialog/dlgprefdeck.cpp | 10 ++++---- src/preferences/dialog/dlgprefmixer.cpp | 2 +- src/preferences/dialog/dlgprefvinyl.cpp | 2 +- src/skin/skinloader.cpp | 3 ++- src/test/autodjprocessor_test.cpp | 13 +++++++---- src/test/co_dumps/co_dump_inital.csv | 10 ++++---- src/test/signalpathtest.h | 3 ++- src/vinylcontrol/vinylcontrolmanager.cpp | 2 +- src/widget/wtrackmenu.cpp | 13 ++++++----- 42 files changed, 133 insertions(+), 112 deletions(-) diff --git a/res/controllers/Denon-DN-SC2000.midi.js b/res/controllers/Denon-DN-SC2000.midi.js index 7114b86e23d..f2cef7139f1 100644 --- a/res/controllers/Denon-DN-SC2000.midi.js +++ b/res/controllers/Denon-DN-SC2000.midi.js @@ -8,7 +8,7 @@ DenonDNSC2000.Deck = function (deckNumber, group) { } DenonDNSC2000.init = function (id) { - engine.setValue("[Master]", "num_decks", 4); + engine.setValue("[App]", "num_decks", 4); var leds = [0x11,0x13,0x15,0x17,0x19,0x1B,0x1D,0x20,/* cues */ 0x24,0x40,0x2B,/* loops */ 0x27,0x26,/* play,cue */ diff --git a/res/controllers/Denon-MC6000MK2-scripts.js b/res/controllers/Denon-MC6000MK2-scripts.js index 68108534512..146d061f94f 100644 --- a/res/controllers/Denon-MC6000MK2-scripts.js +++ b/res/controllers/Denon-MC6000MK2-scripts.js @@ -1342,16 +1342,16 @@ DenonMC6000MK2.initValues = function() { DenonMC6000MK2.SAMPLE_RATE); engine.setValue("[App]", "samplerate", DenonMC6000MK2.SAMPLE_RATE); } - DenonMC6000MK2.backupNumDecks = DenonMC6000MK2.getValue("num_decks"); + DenonMC6000MK2.backupNumDecks = engine.getValue("[App]", "num_decks"); if (DenonMC6000MK2.backupNumDecks !== DenonMC6000MK2.DECK_COUNT) { DenonMC6000MK2.logInfo( "Adjusting number of decks: " + DenonMC6000MK2.backupNumDecks + " -> " + DenonMC6000MK2.DECK_COUNT); - DenonMC6000MK2.setValue("num_decks", DenonMC6000MK2.DECK_COUNT); + engine.setValue("[App]", "num_decks", DenonMC6000MK2.DECK_COUNT); } - DenonMC6000MK2.backupNumSamplers = DenonMC6000MK2.getValue("num_samplers"); + DenonMC6000MK2.backupNumSamplers = engine.getValue("[App]", "num_samplers"); var numSamplers = DenonMC6000MK2.SIDE_COUNT * DenonMC6000MK2.SAMPLER_COUNT_PER_SIDE; if (DenonMC6000MK2.backupNumSamplers !== numSamplers) { DenonMC6000MK2.logInfo( @@ -1359,7 +1359,7 @@ DenonMC6000MK2.initValues = function() { DenonMC6000MK2.backupNumSamplers + " -> " + numSamplers); - DenonMC6000MK2.setValue("num_samplers", numSamplers); + engine.setValue("[App]", "num_samplers", numSamplers); } }; diff --git a/res/controllers/Electrix-Tweaker-scripts.js b/res/controllers/Electrix-Tweaker-scripts.js index 8f138a26b94..76576015e9c 100644 --- a/res/controllers/Electrix-Tweaker-scripts.js +++ b/res/controllers/Electrix-Tweaker-scripts.js @@ -193,8 +193,8 @@ ElectrixTweaker.channelRegEx = /\[Channel(\d+)\]/; // ================================================= INITIALIZATION & SHUTDOWN ============================================ ElectrixTweaker.init = function() { - if (engine.getValue("[Master]", "num_samplers") < 8) { - engine.setValue("[Master]", "num_samplers", 8); + if (engine.getValue("[App]", "num_samplers") < 8) { + engine.setValue("[App]", "num_samplers", 8); } for (const group in ElectrixTweaker.encoders) { // loop over each [Channel] // engine.softTakeover('[QuickEffectRack1_'+group+']', 'super1', true) diff --git a/res/controllers/Hercules-DJ-Control-AIR-scripts.js b/res/controllers/Hercules-DJ-Control-AIR-scripts.js index a18e84e90ae..6f454759f57 100644 --- a/res/controllers/Hercules-DJ-Control-AIR-scripts.js +++ b/res/controllers/Hercules-DJ-Control-AIR-scripts.js @@ -32,11 +32,11 @@ HerculesAir.init = function(id) { } // Set soft-takeover for all Sampler volumes - for (var i=engine.getValue("[Master]","num_samplers"); i>=1; i--) { + for (var i=engine.getValue("[App]", "num_samplers"); i>=1; i--) { engine.softTakeover("[Sampler"+i+"]","pregain",true); } // Set soft-takeover for all applicable Deck controls - for (var i=engine.getValue("[Master]","num_decks"); i>=1; i--) { + for (var i=engine.getValue("[App]", "num_decks"); i>=1; i--) { engine.softTakeover("[Channel"+i+"]","volume",true); engine.softTakeover("[Channel"+i+"]","filterHigh",true); engine.softTakeover("[Channel"+i+"]","filterMid",true); diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index 203dd920e60..a93a93205d9 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -47,8 +47,8 @@ P32.init = function() { components.Component.prototype.shiftChannel = true; components.Button.prototype.sendShifted = true; - if (engine.getValue("[Master]", "num_samplers") < 32) { - engine.setValue("[Master]", "num_samplers", 32); + if (engine.getValue("[App]", "num_samplers") < 32) { + engine.setValue("[App]", "num_samplers", 32); } P32.leftDeck = new P32.Deck([1, 3], 1); diff --git a/res/controllers/Korg-nanoKONTROL-2-scripts.js b/res/controllers/Korg-nanoKONTROL-2-scripts.js index a14aca0e664..14c8c6c4ac0 100644 --- a/res/controllers/Korg-nanoKONTROL-2-scripts.js +++ b/res/controllers/Korg-nanoKONTROL-2-scripts.js @@ -61,11 +61,11 @@ NK2.beatloopLengths=new Array(0.03125,0.0625, 0.125, 0.25, 0.5, 1, 2, 4, 8, 16, NK2.init = function init() { // called when the device is opened & set up if (NK2.debug>2){print("##function: "+NK2.getFunctionName())}; - engine.setValue("[Master]", "num_decks", NK2.numDecks); + engine.setValue("[App]", "num_decks", NK2.numDecks); NK2.setup() NK2.updateLEDs(); - print("decks: "+engine.getValue("[Master]", "num_decks")) + print("decks: "+engine.getValue("[App]", "num_decks")) }; NK2.shutdown = function shutdown() { diff --git a/res/controllers/Novation-Launchpad MK2-scripts.js b/res/controllers/Novation-Launchpad MK2-scripts.js index f1e089a7944..cdb70057f4d 100644 --- a/res/controllers/Novation-Launchpad MK2-scripts.js +++ b/res/controllers/Novation-Launchpad MK2-scripts.js @@ -3851,7 +3851,7 @@ var NLMK2 = (function () { type: 'binary' }, num_samplers: { - group: '[Master]', + group: '[App]', name: 'num_samplers', type: 'number' } diff --git a/res/controllers/Novation-Launchpad-Mini-scripts.js b/res/controllers/Novation-Launchpad-Mini-scripts.js index 640c28f5869..bacdb0de531 100644 --- a/res/controllers/Novation-Launchpad-Mini-scripts.js +++ b/res/controllers/Novation-Launchpad-Mini-scripts.js @@ -400,7 +400,7 @@ NLM.init = function() { NLM.page = 0; NLM.shiftstate = false; - NLM.numofdecks = engine.getValue("[Master]", "num_decks"); + NLM.numofdecks = engine.getValue("[App]", "num_decks"); // For testing NLM.numofdecks = 4; //Init hw diff --git a/res/controllers/Novation-Launchpad-scripts.js b/res/controllers/Novation-Launchpad-scripts.js index 6173e376f1a..6d62bdea0db 100644 --- a/res/controllers/Novation-Launchpad-scripts.js +++ b/res/controllers/Novation-Launchpad-scripts.js @@ -3851,7 +3851,7 @@ var NLMK1 = (function () { type: 'binary' }, num_samplers: { - group: '[Master]', + group: '[App]', name: 'num_samplers', type: 'number' } diff --git a/res/controllers/Reloop Terminal Mix 2-4.js b/res/controllers/Reloop Terminal Mix 2-4.js index 21cb2a1432d..cf745315ec8 100644 --- a/res/controllers/Reloop Terminal Mix 2-4.js +++ b/res/controllers/Reloop Terminal Mix 2-4.js @@ -83,14 +83,14 @@ TerminalMix.init = function (id,debug) { TerminalMix.effectUnit24.init(); // Enable four decks in v1.11.x - engine.setValue("[Master]", "num_decks", 4); + engine.setValue("[App]", "num_decks", 4); // Set soft-takeover for all Sampler volumes - for (var i=engine.getValue("[Master]","num_samplers"); i>=1; i--) { + for (var i=engine.getValue("[App]", "num_samplers"); i>=1; i--) { engine.softTakeover("[Sampler"+i+"]","pregain",true); } // Set soft-takeover for all applicable Deck controls - for (var i=engine.getValue("[Master]","num_decks"); i>=1; i--) { + for (var i=engine.getValue("[App]", "num_decks"); i>=1; i--) { engine.softTakeover("[Channel"+i+"]","volume",true); engine.softTakeover("[Channel"+i+"]","filterHigh",true); engine.softTakeover("[Channel"+i+"]","filterMid",true); @@ -167,7 +167,7 @@ TerminalMix.wheelTurn = function (channel, control, value, status, group) { TerminalMix.samplerVolume = function (channel, control, value) { // Link all sampler volume controls to the Sampler Volume knob - for (var i=engine.getValue("[Master]","num_samplers"); i>=1; i--) { + for (var i=engine.getValue("[App]", "num_samplers"); i>=1; i--) { engine.setValue("[Sampler"+i+"]","pregain", script.absoluteNonLin(value, 0.0, 1.0, 4.0)); } @@ -441,7 +441,7 @@ TerminalMix.crossFader = function (channel, control, value, status, group) { // If CF is now full left and decks assigned to R are playing, cue them if (cfValue==-1.0) { - for (var i=engine.getValue("[Master]","num_decks"); i>=1; i--) { + for (var i=engine.getValue("[App]", "num_decks"); i>=1; i--) { group = "[Channel"+i+"]"; if (TerminalMix.faderStart[group] && engine.getValue(group,"orientation")==2 @@ -453,7 +453,7 @@ TerminalMix.crossFader = function (channel, control, value, status, group) { if (cfValue==1.0) { // If CF is now full right and decks assigned to L are playing, cue them - for (var i=engine.getValue("[Master]","num_decks"); i>=1; i--) { + for (var i=engine.getValue("[App]", "num_decks"); i>=1; i--) { group = "[Channel"+i+"]"; if (TerminalMix.faderStart[group] && engine.getValue(group,"orientation")==0 @@ -465,7 +465,7 @@ TerminalMix.crossFader = function (channel, control, value, status, group) { // If the CF is moved from full left, start any decks assigned to R if (TerminalMix.lastFader["crossfader"]==-1.0) { - for (var i=engine.getValue("[Master]","num_decks"); i>=1; i--) { + for (var i=engine.getValue("[App]", "num_decks"); i>=1; i--) { group = "[Channel"+i+"]"; if (TerminalMix.faderStart[group] && engine.getValue(group,"orientation")==2) { @@ -476,7 +476,7 @@ TerminalMix.crossFader = function (channel, control, value, status, group) { if (TerminalMix.lastFader["crossfader"]==1.0) { // If the CF is moved from full right, start any decks assigned to L - for (var i=engine.getValue("[Master]","num_decks"); i>=1; i--) { + for (var i=engine.getValue("[App]", "num_decks"); i>=1; i--) { group = "[Channel"+i+"]"; if (TerminalMix.faderStart[group] && engine.getValue(group,"orientation")==0) { diff --git a/res/controllers/Reloop-Beatmix-2-4-scripts.js b/res/controllers/Reloop-Beatmix-2-4-scripts.js index 96ab2e68f0e..92dd6782f1a 100644 --- a/res/controllers/Reloop-Beatmix-2-4-scripts.js +++ b/res/controllers/Reloop-Beatmix-2-4-scripts.js @@ -376,7 +376,7 @@ ReloopBeatmix24.ShiftSamplerPad = function(channel, control, value, status, }; ReloopBeatmix24.SamplerVol = function(channel, control, value, _status, _group) { - for (let i = 1; i <= engine.getValue("[Master]", "num_samplers"); i++) { + for (let i = 1; i <= engine.getValue("[App]", "num_samplers"); i++) { engine.setValue("[Sampler" + i + "]", "volume", value / 127.0); } }; diff --git a/res/controllers/Reloop-Beatpad-scripts.js b/res/controllers/Reloop-Beatpad-scripts.js index 1073a1af3de..b163a32cf46 100644 --- a/res/controllers/Reloop-Beatpad-scripts.js +++ b/res/controllers/Reloop-Beatpad-scripts.js @@ -1655,11 +1655,11 @@ ReloopBeatpad.init = function(id, debug) { ReloopBeatpad.initobjects(); // Set soft-takeover for all Sampler volumes - for (i = engine.getValue("[Master]", "num_samplers"); i >= 1; i--) { + for (i = engine.getValue("[App]", "num_samplers"); i >= 1; i--) { engine.softTakeover("[Sampler" + i + "]", "pregain", true); } // Set soft-takeover for all applicable Deck controls - for (i = engine.getValue("[Master]", "num_decks"); i >= 1; i--) { + for (i = engine.getValue("[App]", "num_decks"); i >= 1; i--) { engine.softTakeover("[Channel" + i + "]", "volume", true); engine.softTakeover("[Channel" + i + "]", "filterHigh", true); engine.softTakeover("[Channel" + i + "]", "filterMid", true); diff --git a/res/controllers/Roland_DJ-505-scripts.js b/res/controllers/Roland_DJ-505-scripts.js index 9a12faefc84..f2503f4913a 100644 --- a/res/controllers/Roland_DJ-505-scripts.js +++ b/res/controllers/Roland_DJ-505-scripts.js @@ -163,8 +163,8 @@ DJ505.init = function() { engine.makeConnection("[Channel3]", "track_loaded", DJ505.autoShowDecks); engine.makeConnection("[Channel4]", "track_loaded", DJ505.autoShowDecks); - if (engine.getValue("[Master]", "num_samplers") < 16) { - engine.setValue("[Master]", "num_samplers", 16); + if (engine.getValue("[App]", "num_samplers") < 16) { + engine.setValue("[App]", "num_samplers", 16); } // Send Serato SysEx messages to request initial state and unlock pads diff --git a/res/controllers/Stanton-DJC-4-scripts.js b/res/controllers/Stanton-DJC-4-scripts.js index c0c2ebc70cb..acb995f6adf 100644 --- a/res/controllers/Stanton-DJC-4-scripts.js +++ b/res/controllers/Stanton-DJC-4-scripts.js @@ -86,8 +86,8 @@ DJC4.init = function() { engine.makeConnection("[Channel3]", "track_loaded", DJC4.autoShowDecks); engine.makeConnection("[Channel4]", "track_loaded", DJC4.autoShowDecks); - if (engine.getValue("[Master]", "num_samplers") < 8) { - engine.setValue("[Master]", "num_samplers", 8); + if (engine.getValue("[App]", "num_samplers") < 8) { + engine.setValue("[App]", "num_samplers", 8); } DJC4.browseEncoder = new components.Encoder({ diff --git a/res/controllers/Stanton-SCS1d-scripts.js b/res/controllers/Stanton-SCS1d-scripts.js index 7b9a3c81a0c..cf8ac3fcfd2 100644 --- a/res/controllers/Stanton-SCS1d-scripts.js +++ b/res/controllers/Stanton-SCS1d-scripts.js @@ -201,7 +201,7 @@ StantonSCS1d.init2 = function () { // Force change to first deck, initializing the LEDs and connecting signals in the process StantonSCS1d.state["Oldknob"]=1; // Set active deck to last available so the below will switch to #1. - StantonSCS1d.deck = engine.getValue("[Master]","num_decks"); + StantonSCS1d.deck = engine.getValue("[App]", "num_decks"); // Set the default platter mode for this last deck if (!StantonSCS1d.platterMode["[Channel"+StantonSCS1d.deck+"]"]) StantonSCS1d.platterMode["[Channel"+StantonSCS1d.deck+"]"] = StantonSCS1d.platterMode["default"]; @@ -791,7 +791,7 @@ StantonSCS1d.DeckChange = function (channel, control, value, status) { StantonSCS1d.newPlatterMode = StantonSCS1d.platterMode["[Channel"+StantonSCS1d.deck+"]"]; // Supports n-decks - if (StantonSCS1d.deck == engine.getValue("[Master]","num_decks")) StantonSCS1d.deck=1; + if (StantonSCS1d.deck == engine.getValue("[App]", "num_decks")) StantonSCS1d.deck=1; else StantonSCS1d.deck++; if (StantonSCS1d.debug) print("StantonSCS1d: Switching to deck "+StantonSCS1d.deck); diff --git a/res/controllers/Stanton-SCS1m-scripts.js b/res/controllers/Stanton-SCS1m-scripts.js index e3aa8aaead7..6e8b04b16c8 100644 --- a/res/controllers/Stanton-SCS1m-scripts.js +++ b/res/controllers/Stanton-SCS1m-scripts.js @@ -109,7 +109,7 @@ StantonSCS1m.init = function (id) { // called when the MIDI device is opened // Force change to first deck, initializing the LEDs and connecting signals in the process // Set active deck to last available so the below will switch to #1. - StantonSCS1m.hotCueDeck = engine.getValue("[Master]","num_decks"); + StantonSCS1m.hotCueDeck = engine.getValue("[App]", "num_decks"); StantonSCS1m.hotCueDeckChange(StantonSCS1m.channel, 34, 0x7F, 0x90+StantonSCS1m.channel); StantonSCS1m.hotCueDeckChange(StantonSCS1m.channel, 34, 0x00, 0x80+StantonSCS1m.channel); @@ -464,7 +464,7 @@ StantonSCS1m.hotCueDeckChange = function (channel, control, value, status) { if (StantonSCS1m.modifier["hotCueToggleTime"] != 0.0 && ((new Date() - StantonSCS1m.modifier["hotCueToggleTime"])>300)) return; StantonSCS1m.connectPresetSignals(channel,true); // Disconnect previous ones - if (StantonSCS1m.hotCueDeck == engine.getValue("[Master]","num_decks")) StantonSCS1m.hotCueDeck=1; + if (StantonSCS1m.hotCueDeck == engine.getValue("[App]", "num_decks")) StantonSCS1m.hotCueDeck=1; else StantonSCS1m.hotCueDeck++; // Change bank button color if (StantonSCS1m.hotCueDeck % 2 == 0) midi.sendShortMsg(0x90 + channel,34,64); // On diff --git a/res/controllers/Stanton-SCS3d-scripts.js b/res/controllers/Stanton-SCS3d-scripts.js index 414d2f33ace..d9555ee652f 100644 --- a/res/controllers/Stanton-SCS3d-scripts.js +++ b/res/controllers/Stanton-SCS3d-scripts.js @@ -244,7 +244,7 @@ StantonSCS3d.init2 = function () { // Force change to first deck, initializing the control surface & LEDs and connecting signals in the process // Set active deck to the last one so the below will switch to #1. - StantonSCS3d.deck = engine.getValue("[Master]","num_decks"); + StantonSCS3d.deck = engine.getValue("[App]", "num_decks"); if (StantonSCS3d.singleDeck) // Force timer to expire so the deck change happens StantonSCS3d.modifier["deckTime"] = new Date() - StantonSCS3d.deckChangeWait; StantonSCS3d.DeckChangeP1(StantonSCS3d.channel, StantonSCS3d.buttons["deck"], "null", 0x90+StantonSCS3d.channel); @@ -1100,7 +1100,7 @@ StantonSCS3d.deckChangeFlash = function (channel, value, targetSide) { // Finish the deck change StantonSCS3d.deckIndicator(byte1,true); // Deck indicator on if (!StantonSCS3d.state["logoLit"] && StantonSCS3d.deck > 0 && - StantonSCS3d.deck <= engine.getValue("[Master]","num_decks")) { + StantonSCS3d.deck <= engine.getValue("[App]", "num_decks")) { // Re-light the Stanton logo if we're within deck #1-4 and if it had // been extinguished before midi.sendShortMsg(byte1,0x7A,0x01); @@ -1188,7 +1188,7 @@ StantonSCS3d.DeckChangeP1 = function (channel, control, value, status) { StantonSCS3d.mode_store["[Channel"+StantonSCS3d.deck+"]"].substring(0,4) == "loop") for (i=0x48; i<=0x5c; i++) midi.sendShortMsg(byte1,i,0x40); // Set surface LEDs to black StantonSCS3d.deck++; - if (StantonSCS3d.deck > engine.getValue("[Master]","num_decks")) StantonSCS3d.deck = 1; // Wrap around + if (StantonSCS3d.deck > engine.getValue("[App]", "num_decks")) StantonSCS3d.deck = 1; // Wrap around if (StantonSCS3d.debug) print("StantonSCS3d: Switching to deck "+StantonSCS3d.deck); midi.sendShortMsg(byte1,0x71,0x00); // Deck A light off midi.sendShortMsg(byte1,0x72,0x00); // Deck B light off diff --git a/res/controllers/Traktor-Kontrol-S4-MK3.js b/res/controllers/Traktor-Kontrol-S4-MK3.js index 3baa8cb5b13..a4ba9b43d5a 100644 --- a/res/controllers/Traktor-Kontrol-S4-MK3.js +++ b/res/controllers/Traktor-Kontrol-S4-MK3.js @@ -2722,8 +2722,8 @@ class S4Mk3MixerColumn extends ComponentContainer { class S4MK3 { constructor() { - if (engine.getValue("[Master]", "num_samplers") < 16) { - engine.setValue("[Master]", "num_samplers", 16); + if (engine.getValue("[App]", "num_samplers") < 16) { + engine.setValue("[App]", "num_samplers", 16); } this.inReports = []; diff --git a/res/controllers/Vestax-VCI-300-scripts.js b/res/controllers/Vestax-VCI-300-scripts.js index 66f46da06fb..e3abc304ac8 100644 --- a/res/controllers/Vestax-VCI-300-scripts.js +++ b/res/controllers/Vestax-VCI-300-scripts.js @@ -281,13 +281,13 @@ VestaxVCI300.updatePitchValue = function(group, pitchHigh, pitchLow) { VestaxVCI300.initValues = function() { VestaxVCI300.scrollState = false; - VestaxVCI300.numDecksBackup = engine.getValue(VestaxVCI300.group, "num_decks"); - engine.setValue(VestaxVCI300.group, "num_decks", 2); + VestaxVCI300.numDecksBackup = engine.getValue("[App]", "num_decks"); + engine.setValue("[App]", "num_decks", 2); engine.setValue(VestaxVCI300.group, "headMix", 0.0); }; VestaxVCI300.restoreValues = function() { - engine.setValue(VestaxVCI300.group, "num_decks", VestaxVCI300.numDecksBackup); + engine.setValue("[App]", "num_decks", VestaxVCI300.numDecksBackup); }; VestaxVCI300.connectControl = function(group, ctrl, func) { diff --git a/res/controllers/Vestax-VCI-400-scripts.js b/res/controllers/Vestax-VCI-400-scripts.js index 11776ca975a..72967292e37 100644 --- a/res/controllers/Vestax-VCI-400-scripts.js +++ b/res/controllers/Vestax-VCI-400-scripts.js @@ -37,7 +37,7 @@ VestaxVCI400.ModeEnum = { * Called when the MIDI device is opened for set up */ VestaxVCI400.init = function (id) { - engine.setValue("[Master]", "num_decks", 4); + engine.setValue("[App]", "num_decks", 4); //Initialize controls and their default values here VestaxVCI400.Decks.A.init(); VestaxVCI400.Decks.B.init(); diff --git a/res/controllers/common-hid-packet-parser.js b/res/controllers/common-hid-packet-parser.js index ea2016c5eff..97e03cf4f9a 100644 --- a/res/controllers/common-hid-packet-parser.js +++ b/res/controllers/common-hid-packet-parser.js @@ -2085,7 +2085,7 @@ class HIDController { deck = 1; } else { // This is unusable: num_decks has always minimum 4 decks - // var totalDecks = engine.getValue("[Master]","num_decks"); + // var totalDecks = engine.getValue("[App]", "num_decks"); // deck = (this.activeDeck+1) % totalDecks; deck = this.deckSwitchMap[this.activeDeck]; if (deck === undefined) { diff --git a/res/qml/LibraryControl.qml b/res/qml/LibraryControl.qml index 6ae38d70f5c..353e4b8bb21 100644 --- a/res/qml/LibraryControl.qml +++ b/res/qml/LibraryControl.qml @@ -97,7 +97,7 @@ Item { Mixxx.ControlProxy { id: numDecksControl - group: "[Master]" + group: "[App]" key: "num_decks" } @@ -118,7 +118,7 @@ Item { Mixxx.ControlProxy { id: numPreviewDecksControl - group: "[Master]" + group: "[App]" key: "num_preview_decks" } @@ -139,7 +139,7 @@ Item { Mixxx.ControlProxy { id: numSamplersControl - group: "[Master]" + group: "[App]" key: "num_samplers" } diff --git a/res/skins/Deere (64 Samplers)/skin.xml b/res/skins/Deere (64 Samplers)/skin.xml index f81e4b36ed8..67baa70cfa4 100644 --- a/res/skins/Deere (64 Samplers)/skin.xml +++ b/res/skins/Deere (64 Samplers)/skin.xml @@ -9,9 +9,9 @@ Creative Commons Attribution, Share-Alike 3.0 Unported - 4 - 64 - 1 + 4 + 64 + 1 1 0 diff --git a/res/skins/Deere/skin.xml b/res/skins/Deere/skin.xml index 85f4991bb2e..d47e8d6e88c 100644 --- a/res/skins/Deere/skin.xml +++ b/res/skins/Deere/skin.xml @@ -9,9 +9,9 @@ Creative Commons Attribution, Share-Alike 3.0 Unported - 4 - 16 - 1 + 4 + 16 + 1 1 0 diff --git a/res/skins/LateNight (64 Samplers)/skin.xml b/res/skins/LateNight (64 Samplers)/skin.xml index de7ae9a7601..89c47cf5359 100644 --- a/res/skins/LateNight (64 Samplers)/skin.xml +++ b/res/skins/LateNight (64 Samplers)/skin.xml @@ -37,8 +37,8 @@ Creative Commons Attribution, Share-Alike 3.0 Unported - 4 - 64 + 4 + 64 1 0 diff --git a/res/skins/LateNight/skin.xml b/res/skins/LateNight/skin.xml index 4fdd29dc825..52b9a535608 100644 --- a/res/skins/LateNight/skin.xml +++ b/res/skins/LateNight/skin.xml @@ -37,8 +37,8 @@ Creative Commons Attribution, Share-Alike 3.0 Unported - 4 - 16 + 4 + 16 1 0 diff --git a/res/skins/Shade/skin.xml b/res/skins/Shade/skin.xml index f59353831a3..18019c1f0ec 100644 --- a/res/skins/Shade/skin.xml +++ b/res/skins/Shade/skin.xml @@ -58,9 +58,9 @@ en Creative Commons Attribution, Share-Alike 3.0 Unported - 2 - 8 - 1 + 2 + 8 + 1 1 1 diff --git a/res/skins/Tango (64 Samplers)/skin.xml b/res/skins/Tango (64 Samplers)/skin.xml index 33141c43320..e396fcf74ab 100644 --- a/res/skins/Tango (64 Samplers)/skin.xml +++ b/res/skins/Tango (64 Samplers)/skin.xml @@ -37,8 +37,8 @@ --> - 4 - 64 + 4 + 64 1 0 0 diff --git a/res/skins/Tango/skin.xml b/res/skins/Tango/skin.xml index 2bc384d31f7..1714d080b21 100644 --- a/res/skins/Tango/skin.xml +++ b/res/skins/Tango/skin.xml @@ -37,8 +37,8 @@ --> - 4 - 16 + 4 + 16 1 0 0 diff --git a/src/controllers/controlpickermenu.cpp b/src/controllers/controlpickermenu.cpp index 1b445015835..cbf3f08146d 100644 --- a/src/controllers/controlpickermenu.cpp +++ b/src/controllers/controlpickermenu.cpp @@ -120,7 +120,8 @@ ControlPickerMenu::ControlPickerMenu(QWidget* pParent) // EQs QMenu* eqMenu = addSubmenu(tr("Equalizers"), mixerMenu); constexpr int kNumEqRacks = 1; - const int iNumDecks = static_cast(ControlObject::get(ConfigKey("[Master]", "num_decks"))); + const int iNumDecks = static_cast(ControlObject::get( + ConfigKey(kAppGroup, QStringLiteral("num_decks")))); for (int iRackNumber = 0; iRackNumber < kNumEqRacks; ++iRackNumber) { // TODO: Although there is a mode with 4-band EQs, it's not feasible // right now to add support for learning both it and regular 3-band eqs. @@ -925,7 +926,7 @@ ControlPickerMenu::ControlPickerMenu(QWidget* pParent) } const int iNumSamplers = static_cast(ControlObject::get( - ConfigKey("[Master]", "num_samplers"))); + ConfigKey(kAppGroup, QStringLiteral("num_samplers")))); for (int iSamplerNumber = 1; iSamplerNumber <= iNumSamplers; ++iSamplerNumber) { // PlayerManager::groupForSampler is 0-indexed. @@ -941,7 +942,7 @@ ControlPickerMenu::ControlPickerMenu(QWidget* pParent) } const int iNumMicrophones = static_cast(ControlObject::get( - ConfigKey("[Master]", "num_microphones"))); + ConfigKey(kAppGroup, QStringLiteral("num_microphones")))); for (int iMicrophoneNumber = 1; iMicrophoneNumber <= iNumMicrophones; ++iMicrophoneNumber) { QString micGroup = PlayerManager::groupForMicrophone(iMicrophoneNumber - 1); @@ -956,7 +957,7 @@ ControlPickerMenu::ControlPickerMenu(QWidget* pParent) } const int iNumAuxiliaries = static_cast(ControlObject::get( - ConfigKey("[Master]", "num_auxiliaries"))); + ConfigKey(kAppGroup, QStringLiteral("num_auxiliaries")))); for (int iAuxiliaryNumber = 1; iAuxiliaryNumber <= iNumAuxiliaries; ++iAuxiliaryNumber) { QString auxGroup = PlayerManager::groupForAuxiliary(iAuxiliaryNumber - 1); @@ -1396,10 +1397,11 @@ void ControlPickerMenu::addPlayerControl(const QString& control, bool previewdeckControls, bool addReset) { const int iNumSamplers = static_cast( - ControlObject::get(ConfigKey("[Master]", "num_samplers"))); - const int iNumDecks = static_cast(ControlObject::get(ConfigKey("[Master]", "num_decks"))); + ControlObject::get(ConfigKey(kAppGroup, QStringLiteral("num_samplers")))); + const int iNumDecks = static_cast(ControlObject::get( + ConfigKey(kAppGroup, QStringLiteral("num_decks")))); const int iNumPreviewDecks = static_cast( - ControlObject::get(ConfigKey("[Master]", "num_preview_decks"))); + ControlObject::get(ConfigKey(kAppGroup, QStringLiteral("num_preview_decks")))); parented_ptr controlMenu = make_parented(controlTitle, pMenu); pMenu->addMenu(controlMenu); @@ -1522,7 +1524,7 @@ void ControlPickerMenu::addMicrophoneAndAuxControl(const QString& control, if (microphoneControls) { const int kNumMicrophones = static_cast( - ControlObject::get(ConfigKey("[Master]", "num_microphones"))); + ControlObject::get(ConfigKey(kAppGroup, QStringLiteral("num_microphones")))); for (int i = 1; i <= kNumMicrophones; ++i) { QString prefix = m_microphoneStr.arg(i); QString group = PlayerManager::groupForMicrophone(i - 1); @@ -1549,7 +1551,7 @@ void ControlPickerMenu::addMicrophoneAndAuxControl(const QString& control, } const int kNumAuxiliaries = static_cast( - ControlObject::get(ConfigKey("[Master]", "num_auxiliaries"))); + ControlObject::get(ConfigKey(kAppGroup, QStringLiteral("num_auxiliaries")))); if (auxControls) { for (int i = 1; i <= kNumAuxiliaries; ++i) { QString prefix = m_auxStr.arg(i); diff --git a/src/library/librarycontrol.cpp b/src/library/librarycontrol.cpp index 800684a1690..e20d7d4f730 100644 --- a/src/library/librarycontrol.cpp +++ b/src/library/librarycontrol.cpp @@ -19,6 +19,10 @@ #include "widget/wsearchlineedit.h" #include "widget/wtracktableview.h" +namespace { +const QString kAppGroup = QStringLiteral("[App]"); +} + LoadToGroupController::LoadToGroupController(LibraryControl* pParent, const QString& group) : QObject(pParent), m_group(group) { @@ -62,9 +66,9 @@ LibraryControl::LibraryControl(Library* pLibrary) m_pLibraryWidget(nullptr), m_pSidebarWidget(nullptr), m_pSearchbox(nullptr), - m_numDecks("[Master]", "num_decks", this), - m_numSamplers("[Master]", "num_samplers", this), - m_numPreviewDecks("[Master]", "num_preview_decks", this) { + m_numDecks(kAppGroup, QStringLiteral("num_decks"), this), + m_numSamplers(kAppGroup, QStringLiteral("num_samplers"), this), + m_numPreviewDecks(kAppGroup, QStringLiteral("num_preview_decks"), this) { qRegisterMetaType("FocusWidget"); slotNumDecksChanged(m_numDecks.get()); diff --git a/src/mixer/playermanager.cpp b/src/mixer/playermanager.cpp index 06e8ed209ac..db76e22eb3f 100644 --- a/src/mixer/playermanager.cpp +++ b/src/mixer/playermanager.cpp @@ -24,6 +24,8 @@ namespace { const mixxx::Logger kLogger("PlayerManager"); +const QString kAppGroup = QStringLiteral("[App]"); +const QString kLegacyGroup = QStringLiteral("[Master]"); // Utilize half of the available cores for adhoc analysis of tracks const int kNumberOfAnalyzerThreads = math_max(1, QThread::idealThreadCount() / 2); @@ -103,24 +105,29 @@ PlayerManager::PlayerManager(UserSettingsPointer pConfig, // NOTE(XXX) LegacySkinParser relies on these controls being Controls // and not ControlProxies. m_pCONumDecks(new ControlObject( - ConfigKey("[Master]", "num_decks"), true, true)), + ConfigKey(kAppGroup, QStringLiteral("num_decks")), true, true)), m_pCONumSamplers(new ControlObject( - ConfigKey("[Master]", "num_samplers"), true, true)), + ConfigKey(kAppGroup, QStringLiteral("num_samplers")), true, true)), m_pCONumPreviewDecks(new ControlObject( - ConfigKey("[Master]", "num_preview_decks"), true, true)), + ConfigKey(kAppGroup, QStringLiteral("num_preview_decks")), true, true)), m_pCONumMicrophones(new ControlObject( - ConfigKey("[Master]", "num_microphones"), true, true)), + ConfigKey(kAppGroup, QStringLiteral("num_microphones")), true, true)), m_pCONumAuxiliaries(new ControlObject( - ConfigKey("[Master]", "num_auxiliaries"), true, true)), + ConfigKey(kAppGroup, QStringLiteral("num_auxiliaries")), true, true)), m_pTrackAnalysisScheduler(TrackAnalysisScheduler::NullPointer()) { + m_pCONumDecks->addAlias(ConfigKey(kLegacyGroup, QStringLiteral("num_decks"))); m_pCONumDecks->connectValueChangeRequest(this, &PlayerManager::slotChangeNumDecks, Qt::DirectConnection); + m_pCONumSamplers->addAlias(ConfigKey(kLegacyGroup, QStringLiteral("num_samplers"))); m_pCONumSamplers->connectValueChangeRequest(this, &PlayerManager::slotChangeNumSamplers, Qt::DirectConnection); + m_pCONumPreviewDecks->addAlias(ConfigKey(kLegacyGroup, QStringLiteral("num_preview_decks"))); m_pCONumPreviewDecks->connectValueChangeRequest(this, &PlayerManager::slotChangeNumPreviewDecks, Qt::DirectConnection); + m_pCONumMicrophones->addAlias(ConfigKey(kLegacyGroup, QStringLiteral("num_microphones"))); m_pCONumMicrophones->connectValueChangeRequest(this, &PlayerManager::slotChangeNumMicrophones, Qt::DirectConnection); + m_pCONumAuxiliaries->addAlias(ConfigKey(kLegacyGroup, QStringLiteral("num_auxiliaries"))); m_pCONumAuxiliaries->connectValueChangeRequest(this, &PlayerManager::slotChangeNumAuxiliaries, Qt::DirectConnection); @@ -241,7 +248,7 @@ unsigned int PlayerManager::numDecks() { // a hashtable lookup every time they call this. ControlProxy* pCOPNumDecks = atomicLoadRelaxed(m_pCOPNumDecks); if (pCOPNumDecks == nullptr) { - pCOPNumDecks = new ControlProxy(ConfigKey("[Master]", "num_decks")); + pCOPNumDecks = new ControlProxy(ConfigKey(kAppGroup, QStringLiteral("num_decks"))); if (!pCOPNumDecks->valid()) { delete pCOPNumDecks; pCOPNumDecks = nullptr; @@ -259,7 +266,7 @@ unsigned int PlayerManager::numSamplers() { // a hashtable lookup every time they call this. ControlProxy* pCOPNumSamplers = atomicLoadRelaxed(m_pCOPNumSamplers); if (pCOPNumSamplers == nullptr) { - pCOPNumSamplers = new ControlProxy(ConfigKey("[Master]", "num_samplers")); + pCOPNumSamplers = new ControlProxy(ConfigKey(kAppGroup, QStringLiteral("num_samplers"))); if (!pCOPNumSamplers->valid()) { delete pCOPNumSamplers; pCOPNumSamplers = nullptr; @@ -278,7 +285,7 @@ unsigned int PlayerManager::numPreviewDecks() { ControlProxy* pCOPNumPreviewDecks = atomicLoadRelaxed(m_pCOPNumPreviewDecks); if (pCOPNumPreviewDecks == nullptr) { pCOPNumPreviewDecks = new ControlProxy( - ConfigKey("[Master]", "num_preview_decks")); + ConfigKey(kAppGroup, QStringLiteral("num_preview_decks"))); if (!pCOPNumPreviewDecks->valid()) { delete pCOPNumPreviewDecks; pCOPNumPreviewDecks = nullptr; diff --git a/src/mixer/samplerbank.cpp b/src/mixer/samplerbank.cpp index 047a9a171c4..922884f72ab 100644 --- a/src/mixer/samplerbank.cpp +++ b/src/mixer/samplerbank.cpp @@ -41,7 +41,9 @@ SamplerBank::SamplerBank(UserSettingsPointer pConfig, this, &SamplerBank::slotSaveSamplerBank); - m_pCONumSamplers = new ControlProxy(ConfigKey("[Master]", "num_samplers"), this); + m_pCONumSamplers = new ControlProxy( + ConfigKey(QStringLiteral("[App]"), QStringLiteral("num_samplers")), + this); } SamplerBank::~SamplerBank() { diff --git a/src/preferences/dialog/dlgprefdeck.cpp b/src/preferences/dialog/dlgprefdeck.cpp index f94174115a9..a9d4afff477 100644 --- a/src/preferences/dialog/dlgprefdeck.cpp +++ b/src/preferences/dialog/dlgprefdeck.cpp @@ -31,20 +31,20 @@ constexpr double kDefaultPermanentRateChangeFine = 0.05; constexpr int kDefaultRateRampSensitivity = 250; // bool kDefaultCloneDeckOnLoad is defined in header file to make it available // to playermanager.cpp +const QString kAppGroup = QStringLiteral("[App]"); } // namespace -DlgPrefDeck::DlgPrefDeck(QWidget* parent, - UserSettingsPointer pConfig) +DlgPrefDeck::DlgPrefDeck(QWidget* parent, UserSettingsPointer pConfig) : DlgPreferencePage(parent), m_pConfig(pConfig), m_pControlTrackTimeDisplay(std::make_unique( ConfigKey("[Controls]", "ShowDurationRemaining"))), m_pControlTrackTimeFormat(std::make_unique( ConfigKey("[Controls]", "TimeFormat"))), - m_pNumDecks( - make_parented("[Master]", "num_decks", this)), + m_pNumDecks(make_parented( + kAppGroup, QStringLiteral("num_decks"), this)), m_pNumSamplers(make_parented( - "[Master]", "num_samplers", this)), + kAppGroup, QStringLiteral("num_samplers"), this)), m_iNumConfiguredDecks(0), m_iNumConfiguredSamplers(0) { setupUi(this); diff --git a/src/preferences/dialog/dlgprefmixer.cpp b/src/preferences/dialog/dlgprefmixer.cpp index 46f0a94c109..ee94b76abd6 100644 --- a/src/preferences/dialog/dlgprefmixer.cpp +++ b/src/preferences/dialog/dlgprefmixer.cpp @@ -137,7 +137,7 @@ DlgPrefMixer::DlgPrefMixer( // Add drop down lists for current decks and connect num_decks control // to slotNumDecksChanged - m_pNumDecks = new ControlProxy("[Master]", "num_decks", this); + m_pNumDecks = new ControlProxy(QStringLiteral("[App]"), QStringLiteral("num_decks"), this); m_pNumDecks->connectValueChanged(this, &DlgPrefMixer::slotNumDecksChanged); slotNumDecksChanged(m_pNumDecks->get()); diff --git a/src/preferences/dialog/dlgprefvinyl.cpp b/src/preferences/dialog/dlgprefvinyl.cpp index cebb1f4dbcc..06fbc60ae60 100644 --- a/src/preferences/dialog/dlgprefvinyl.cpp +++ b/src/preferences/dialog/dlgprefvinyl.cpp @@ -19,7 +19,7 @@ DlgPrefVinyl::DlgPrefVinyl( : DlgPreferencePage(parent), m_pVCManager(pVCMan), config(config) { - m_pNumDecks = new ControlProxy("[Master]", "num_decks", this); + m_pNumDecks = new ControlProxy(QStringLiteral("[App]"), QStringLiteral("num_decks"), this); m_pNumDecks->connectValueChanged(this, &DlgPrefVinyl::slotNumDecksChanged); setupUi(this); diff --git a/src/skin/skinloader.cpp b/src/skin/skinloader.cpp index 4676da6282b..d193e5d3547 100644 --- a/src/skin/skinloader.cpp +++ b/src/skin/skinloader.cpp @@ -294,7 +294,8 @@ void SkinLoader::setupMicDuckingControls() { m_pShowDuckingControls->setButtonMode(ControlPushButton::TOGGLE); m_pShowDuckingControls->setReadOnly(); - m_pNumMics = make_parented("[Master]", "num_microphones", this); + m_pNumMics = make_parented( + QStringLiteral("[App]"), QStringLiteral("num_microphones"), this); m_pNumMics->connectValueChanged(this, &SkinLoader::slotNumMicsChanged); m_micDuckingControlsCreated = true; diff --git a/src/test/autodjprocessor_test.cpp b/src/test/autodjprocessor_test.cpp index f52db03fc03..ff4c02f8448 100644 --- a/src/test/autodjprocessor_test.cpp +++ b/src/test/autodjprocessor_test.cpp @@ -20,9 +20,12 @@ using ::testing::_; using ::testing::Return; -static int kDefaultTransitionTime = 10; +namespace { +const int kDefaultTransitionTime = 10; const mixxx::audio::ChannelCount kChannelCount = mixxx::kEngineChannelCount; const QString kTrackLocationTest = QStringLiteral("id3-test-data/cover-test-png.mp3"); +const QString kAppGroup = QStringLiteral("[App]"); +} // namespace class FakeMixer { public: @@ -124,10 +127,10 @@ class FakeDeck : public BaseTrackPlayer { class MockPlayerManager : public PlayerManagerInterface { public: MockPlayerManager() - : numDecks(ConfigKey("[Master]", "num_decks"), true), - numSamplers(ConfigKey("[Master]", "num_samplers"), true), - numPreviewDecks(ConfigKey("[Master]", "num_preview_decks"), - true) { + : numDecks(ConfigKey(kAppGroup, QStringLiteral("num_decks")), true), + numSamplers(ConfigKey(kAppGroup, QStringLiteral("num_samplers")), true), + numPreviewDecks(ConfigKey(kAppGroup, QStringLiteral("num_preview_decks")), + true) { } virtual ~MockPlayerManager() { diff --git a/src/test/co_dumps/co_dump_inital.csv b/src/test/co_dumps/co_dump_inital.csv index daeef03c903..ca5f0486b07 100644 --- a/src/test/co_dumps/co_dump_inital.csv +++ b/src/test/co_dumps/co_dump_inital.csv @@ -86,7 +86,7 @@ [PreviewDeck1],playposition_down,0 [QuickEffectRack1_[Channel3]_Effect1],parameter7_up_small,0 [Microphone],VuMeterL_down_small,0 -[Master],num_preview_decks,1 +[App],num_preview_decks,1 [EffectRack1_EffectUnit3_Effect3],parameter3_minus_toggle,0 [EqualizerRack1_[Master]_Effect1],button_parameter15_loaded,0 [EffectRack1_EffectUnit1_Effect1],parameter5_minus_toggle,0 @@ -7012,7 +7012,7 @@ [QuickEffectRack1_[Channel1]_Effect1],parameter15_up_small,0 [EffectRack1_EffectUnit3_Effect4],parameter7_set_minus_one,0 [Sampler1],rate_up_small,0 -[Master],num_auxiliaries,4 +[App],num_auxiliaries,4 [Master],audio_latency_overload_down_small,0 [EffectRack1_EffectUnit3_Effect3],parameter15_set_minus_one,0 [EqualizerRack1_[Channel1]_Effect1],parameter7_down,0 @@ -8568,7 +8568,7 @@ [EffectRack1_EffectUnit1_Effect3],parameter6_up_small,0 [EffectRack1_EffectUnit2_Effect3],parameter9_up_small,0 [Channel2],loop_scale,0 -[Master],num_decks,4 +[App],num_decks,4 [EffectRack1_EffectUnit1_Effect1],parameter13_link_type,0 [EffectRack1_EffectUnit4_Effect4],parameter10_loaded,0 [EffectRack1_EffectUnit3_Effect3],parameter6_link_type,0 @@ -10621,7 +10621,7 @@ [EffectRack1_EffectUnit1_Effect4],parameter16_toggle,0 [EffectRack1_EffectUnit2_Effect4],parameter11_set_minus_one,0 [QuickEffectRack1_[Channel2]_Effect1],parameter4_link_inverse,0 -[Master],num_microphones,4 +[App],num_microphones,4 [EffectRack1_EffectUnit3_Effect2],parameter15_toggle,0 [Sampler3],loop_double,0 [Channel4],LoadSelectedTrackAndPlay,0 @@ -11734,7 +11734,7 @@ [EffectRack1_EffectUnit1_Effect2],parameter11_up_small,0 [EffectRack1_EffectUnit2_Effect2],parameter12_up_small,0 [EffectRack1_EffectUnit3_Effect2],parameter13_up_small,0 -[Master],num_samplers,4 +[App],num_samplers,4 [Sampler2],hotcue_30_gotoandstop,0 [Sampler4],hotcue_28_gotoandstop,0 [EqualizerRack1_[Channel4]_Effect1],parameter4_set_minus_one,0 diff --git a/src/test/signalpathtest.h b/src/test/signalpathtest.h index 3f95c472cf1..e4bc60224e4 100644 --- a/src/test/signalpathtest.h +++ b/src/test/signalpathtest.h @@ -69,7 +69,8 @@ class BaseSignalPathTest : public MixxxTest, SoundSourceProviderRegistration { BaseSignalPathTest() { m_pControlIndicatorTimer = std::make_unique(); m_pChannelHandleFactory = std::make_shared(); - m_pNumDecks = new ControlObject(ConfigKey(m_sMainGroup, "num_decks")); + m_pNumDecks = new ControlObject(ConfigKey( + QStringLiteral("[App]"), QStringLiteral("num_decks"))); m_pEffectsManager = new EffectsManager(config(), m_pChannelHandleFactory); m_pEngineMixer = new TestEngineMixer(m_pConfig, m_sMainGroup, diff --git a/src/vinylcontrol/vinylcontrolmanager.cpp b/src/vinylcontrol/vinylcontrolmanager.cpp index 06c7b6deb9b..d35ae0e1522 100644 --- a/src/vinylcontrol/vinylcontrolmanager.cpp +++ b/src/vinylcontrol/vinylcontrolmanager.cpp @@ -52,7 +52,7 @@ VinylControlManager::~VinylControlManager() { } void VinylControlManager::init() { - m_pNumDecks = new ControlProxy("[Master]", "num_decks", this); + m_pNumDecks = new ControlProxy(QStringLiteral("[App]"), QStringLiteral("num_decks"), this); m_pNumDecks->connectValueChanged(this, &VinylControlManager::slotNumDecksChanged); slotNumDecksChanged(m_pNumDecks->get()); } diff --git a/src/widget/wtrackmenu.cpp b/src/widget/wtrackmenu.cpp index d6b86185539..62ea7eec544 100644 --- a/src/widget/wtrackmenu.cpp +++ b/src/widget/wtrackmenu.cpp @@ -51,6 +51,10 @@ #include "widget/wstarrating.h" #include "widget/wwidget.h" +namespace { +const QString kAppGroup = QStringLiteral("[App]"); +} + WTrackMenu::WTrackMenu( QWidget* parent, UserSettingsPointer pConfig, @@ -65,12 +69,9 @@ WTrackMenu::WTrackMenu( m_bCrateMenuLoaded(false), m_eActiveFeatures(flags), m_eTrackModelFeatures(Feature::TrackModelFeatures) { - m_pNumSamplers = new ControlProxy( - "[Master]", "num_samplers", this); - m_pNumDecks = new ControlProxy( - "[Master]", "num_decks", this); - m_pNumPreviewDecks = new ControlProxy( - "[Master]", "num_preview_decks", this); + m_pNumSamplers = new ControlProxy(kAppGroup, QStringLiteral("num_samplers"), this); + m_pNumDecks = new ControlProxy(kAppGroup, QStringLiteral("num_decks"), this); + m_pNumPreviewDecks = new ControlProxy(kAppGroup, QStringLiteral("num_preview_decks"), this); // Warn if any of the chosen features depend on a TrackModel VERIFY_OR_DEBUG_ASSERT(trackModel || (m_eTrackModelFeatures & flags) == 0) { From a086ce30cc8b8e5aa566b3249c29b52df4680632 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Wed, 13 Sep 2023 23:18:44 +0200 Subject: [PATCH 6/7] refactor(enginemixer): Remove unnecessary `[Master],num_mics_configured` --- src/engine/enginemixer.cpp | 13 ++++++------- src/engine/enginemixer.h | 3 ++- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/engine/enginemixer.cpp b/src/engine/enginemixer.cpp index b3485c7caf2..12fcccd1687 100644 --- a/src/engine/enginemixer.cpp +++ b/src/engine/enginemixer.cpp @@ -46,6 +46,7 @@ EngineMixer::EngineMixer( m_headphoneGainOld(1.0), m_balleftOld(1.0), m_balrightOld(1.0), + m_numMicsConfigured(0), m_mainHandle(registerChannelGroup(group)), m_headphoneHandle(registerChannelGroup("[Headphone]")), m_mainOutputHandle(registerChannelGroup("[MasterOutput]")), @@ -116,7 +117,6 @@ EngineMixer::EngineMixer( m_pBoothDelay = new EngineDelay(group, ConfigKey(group, "boothDelay")); m_pLatencyCompensationDelay = new EngineDelay(group, ConfigKey(group, "microphoneLatencyCompensation")); - m_pNumMicsConfigured = new ControlObject(ConfigKey(group, "num_mics_configured")); // Headphone volume m_pHeadGain = new ControlAudioTaperPot(ConfigKey(group, "headGain"), -14, 14, 0.5); @@ -218,7 +218,6 @@ EngineMixer::~EngineMixer() { delete m_pHeadDelay; delete m_pBoothDelay; delete m_pLatencyCompensationDelay; - delete m_pNumMicsConfigured; delete m_pXFaderReverse; delete m_pXFaderCalibration; @@ -621,7 +620,7 @@ void EngineMixer::process(const int iBufferSize) { } // Mix talkover into main mix - if (m_pNumMicsConfigured->get() > 0) { + if (m_numMicsConfigured > 0) { SampleUtil::add(m_pMain, m_pTalkover, iBufferSize); } @@ -648,7 +647,7 @@ void EngineMixer::process(const int iBufferSize) { } // Mix talkover with main - if (m_pNumMicsConfigured->get() > 0) { + if (m_numMicsConfigured > 0) { SampleUtil::add(m_pMain, m_pTalkover, iBufferSize); } @@ -716,7 +715,7 @@ void EngineMixer::process(const int iBufferSize) { if (sidechainMixRequired()) { SampleUtil::copy(m_pSidechainMix, m_pMain, iBufferSize); - if (m_pNumMicsConfigured->get() > 0) { + if (m_numMicsConfigured > 0) { // The talkover signal Mixxx receives is delayed by the round trip latency. // There is an output latency between the time Mixxx processes the audio // and the user hears it. So if the microphone user plays on beat with @@ -1025,7 +1024,7 @@ void EngineMixer::onOutputDisconnected(const AudioOutput& output) { void EngineMixer::onInputConnected(const AudioInput& input) { switch (input.getType()) { case AudioPathType::Microphone: - m_pNumMicsConfigured->set(m_pNumMicsConfigured->get() + 1); + m_numMicsConfigured++; break; case AudioPathType::Auxiliary: // We don't track enabled auxiliary inputs. @@ -1044,7 +1043,7 @@ void EngineMixer::onInputConnected(const AudioInput& input) { void EngineMixer::onInputDisconnected(const AudioInput& input) { switch (input.getType()) { case AudioPathType::Microphone: - m_pNumMicsConfigured->set(m_pNumMicsConfigured->get() - 1); + m_numMicsConfigured--; break; case AudioPathType::Auxiliary: // We don't track enabled auxiliary inputs. diff --git a/src/engine/enginemixer.h b/src/engine/enginemixer.h index 1d02a5aaec1..feff02e8b24 100644 --- a/src/engine/enginemixer.h +++ b/src/engine/enginemixer.h @@ -2,6 +2,7 @@ #include #include +#include #include "audio/types.h" #include "control/controlobject.h" @@ -305,7 +306,6 @@ class EngineMixer : public QObject, public AudioSource { ControlObject* m_pMainSampleRate; ControlObject* m_pMainLatency; ControlObject* m_pAudioLatencyOverloadCount; - ControlObject* m_pNumMicsConfigured; ControlPotmeter* m_pAudioLatencyUsage; ControlPotmeter* m_pAudioLatencyOverload; EngineTalkoverDucking* m_pTalkoverDucking; @@ -336,6 +336,7 @@ class EngineMixer : public QObject, public AudioSource { CSAMPLE_GAIN m_headphoneGainOld; CSAMPLE_GAIN m_balleftOld; CSAMPLE_GAIN m_balrightOld; + std::atomic m_numMicsConfigured; const ChannelHandleAndGroup m_mainHandle; const ChannelHandleAndGroup m_headphoneHandle; const ChannelHandleAndGroup m_mainOutputHandle; From 08f36964a4650abbf6b9e6b65fab4f735867bcbd Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sat, 16 Sep 2023 14:44:45 +0200 Subject: [PATCH 7/7] test: Add `ControlObjectAliasTest` test to ensure backwards compat --- CMakeLists.txt | 1 + src/test/controlobjectaliastest.cpp | 110 ++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 src/test/controlobjectaliastest.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 452dc21c480..f96a4b49e17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1838,6 +1838,7 @@ add_executable(mixxx-test src/test/controller_mapping_validation_test.cpp src/test/controllerscriptenginelegacy_test.cpp src/test/controlobjecttest.cpp + src/test/controlobjectaliastest.cpp src/test/controlobjectscripttest.cpp src/test/coreservicestest.cpp src/test/coverartcache_test.cpp diff --git a/src/test/controlobjectaliastest.cpp b/src/test/controlobjectaliastest.cpp new file mode 100644 index 00000000000..eac95a3bcf2 --- /dev/null +++ b/src/test/controlobjectaliastest.cpp @@ -0,0 +1,110 @@ +#include + +#include + +#include "control/control.h" +#include "control/controlindicatortimer.h" +#include "control/controlproxy.h" +#include "effects/effectsmanager.h" +#include "engine/channelhandle.h" +#include "engine/enginemixer.h" +#include "mixer/playermanager.h" +#include "soundio/soundmanager.h" +#include "test/mixxxtest.h" +#include "waveform/guitick.h" + +namespace { + +const QString kAppGroup = QStringLiteral("[App]"); +const QString kLegacyGroup = QStringLiteral("[Master]"); + +class ControlObjectAliasTest : public MixxxTest { +}; + +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +TEST_F(ControlObjectAliasTest, GuiTick) { + auto guiTick = GuiTick(); + + auto periodFull = ControlProxy(ConfigKey(kAppGroup, QStringLiteral("gui_tick_full_period_s"))); + auto periodFullLegacy = ControlProxy(ConfigKey(kLegacyGroup, QStringLiteral("guiTickTime"))); + EXPECT_DOUBLE_EQ(periodFull.get(), periodFullLegacy.get()); + + auto period50ms = ControlProxy(ConfigKey(kAppGroup, QStringLiteral("gui_tick_50ms_period_s"))); + auto period50msLegacy = ControlProxy(ConfigKey(kLegacyGroup, QStringLiteral("guiTick50ms"))); + EXPECT_DOUBLE_EQ(period50ms.get(), period50msLegacy.get()); +} +#endif + +TEST_F(ControlObjectAliasTest, ControlIndicatorTimer) { + auto controlIndicatorTimer = mixxx::ControlIndicatorTimer(); + + auto indicator250ms = ControlProxy(ConfigKey(kAppGroup, QStringLiteral("indicator_250ms"))); + auto indicator250msLegacy = ControlProxy( + ConfigKey(kLegacyGroup, QStringLiteral("indicator_250millis"))); + EXPECT_DOUBLE_EQ(indicator250ms.get(), indicator250msLegacy.get()); + + auto indicator500ms = ControlProxy(ConfigKey(kAppGroup, QStringLiteral("indicator_500ms"))); + auto indicator500msLegacy = ControlProxy( + ConfigKey(kLegacyGroup, QStringLiteral("indicator_500millis"))); + EXPECT_DOUBLE_EQ(indicator500ms.get(), indicator500msLegacy.get()); +} + +TEST_F(ControlObjectAliasTest, EngineMixer) { + auto pChannelHandleFactory = std::make_shared(); + auto pEffectsManager = std::make_shared(m_pConfig, pChannelHandleFactory); + auto pEngineMixer = std::make_shared( + m_pConfig, + "[Master]", + pEffectsManager.get(), + pChannelHandleFactory, + true); + + auto sampleRate = ControlProxy(ConfigKey(kAppGroup, QStringLiteral("samplerate"))); + auto sampleRateLegacy = ControlProxy(ConfigKey(kLegacyGroup, QStringLiteral("samplerate"))); + EXPECT_DOUBLE_EQ(sampleRate.get(), sampleRateLegacy.get()); +} + +TEST_F(ControlObjectAliasTest, PlayerManager) { + auto pChannelHandleFactory = std::make_shared(); + auto pEffectsManager = std::make_shared(m_pConfig, pChannelHandleFactory); + auto pEngineMixer = std::make_shared( + m_pConfig, + "[Master]", + pEffectsManager.get(), + pChannelHandleFactory, + true); + auto controlIndicatorTimer = mixxx::ControlIndicatorTimer(); + auto pSoundManager = std::make_shared(m_pConfig, pEngineMixer.get()); + pEngineMixer->registerNonEngineChannelSoundIO(pSoundManager.get()); + auto pPlayerManager = std::make_shared(m_pConfig, + pSoundManager.get(), + pEffectsManager.get(), + pEngineMixer.get()); + pPlayerManager->addConfiguredDecks(); + pPlayerManager->addSampler(); + + auto numAuxiliaries = ControlProxy(ConfigKey(kAppGroup, QStringLiteral("num_auxiliaries"))); + auto numAuxiliariesLegacy = ControlProxy( + ConfigKey(kLegacyGroup, QStringLiteral("num_auxiliaries"))); + EXPECT_DOUBLE_EQ(numAuxiliaries.get(), numAuxiliariesLegacy.get()); + + auto numDecks = ControlProxy(ConfigKey(kAppGroup, QStringLiteral("num_decks"))); + auto numDecksLegacy = ControlProxy(ConfigKey(kLegacyGroup, QStringLiteral("num_decks"))); + EXPECT_DOUBLE_EQ(numDecks.get(), numDecksLegacy.get()); + + auto numMicrophones = ControlProxy(ConfigKey(kAppGroup, QStringLiteral("num_microphones"))); + auto numMicrophonesLegacy = ControlProxy( + ConfigKey(kLegacyGroup, QStringLiteral("num_microphones"))); + EXPECT_DOUBLE_EQ(numMicrophones.get(), numMicrophonesLegacy.get()); + + auto numPreviewDecks = ControlProxy(ConfigKey(kAppGroup, QStringLiteral("num_preview_decks"))); + auto numPreviewDecksLegacy = ControlProxy( + ConfigKey(kLegacyGroup, QStringLiteral("num_preview_decks"))); + EXPECT_DOUBLE_EQ(numPreviewDecks.get(), numPreviewDecksLegacy.get()); + + auto numSamplers = ControlProxy(ConfigKey(kAppGroup, QStringLiteral("num_samplers"))); + auto numSamplersLegacy = ControlProxy(ConfigKey(kLegacyGroup, QStringLiteral("num_samplers"))); + EXPECT_DOUBLE_EQ(numSamplers.get(), numSamplersLegacy.get()); +} + +} // namespace