From f2cadf75b63183684cb5662191770dbd570fb3ff Mon Sep 17 00:00:00 2001 From: Antoine C Date: Sat, 6 Apr 2024 11:54:59 +0100 Subject: [PATCH 1/5] feat(S4MK3): optional mapping to the software mixer --- .../Traktor Kontrol S4 MK3.hid.xml | 30 ++++++++++++++ res/controllers/Traktor-Kontrol-S4-MK3.js | 41 +++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/res/controllers/Traktor Kontrol S4 MK3.hid.xml b/res/controllers/Traktor Kontrol S4 MK3.hid.xml index 615dd69b781..cca9c68bb7e 100644 --- a/res/controllers/Traktor Kontrol S4 MK3.hid.xml +++ b/res/controllers/Traktor Kontrol S4 MK3.hid.xml @@ -190,6 +190,9 @@ This option is useful if you don't use samplers and would like to access a set of predefined beatloop rolls. Beat size can be customized individually. + + + + + + diff --git a/res/controllers/Traktor-Kontrol-S4-MK3.js b/res/controllers/Traktor-Kontrol-S4-MK3.js index 7f167085065..38199d74ab9 100644 --- a/res/controllers/Traktor-Kontrol-S4-MK3.js +++ b/res/controllers/Traktor-Kontrol-S4-MK3.js @@ -137,6 +137,11 @@ const TightnessFactor = engine.getSetting("tightnessFactor") || 0.5; // This will also affect how quick the wheel starts spinning when enabling motor mode, or starting a deck with motor mode on const MaxWheelForce = engine.getSetting("maxWheelForce") || 25000; // Traktor seems to cap the max value at 60000, which just sounds insane +// Map the mixer potentiometers to different components of the software mixer in Mixxx, on top of the physical control of the hardware +// mixer embedded in the S4 Mk3. This is useful if you are not using certain S4 Mk3 outputs. +const SoftwareMixerMain = !!engine.getSetting("softwareMixerMain"); +const SoftwareMixerBooth = !!engine.getSetting("softwareMixerBooth"); +const SoftwareMixerHeadphone = !!engine.getSetting("softwareMixerHeadphone"); // The LEDs only support 16 base colors. Adding 1 in addition to @@ -1144,6 +1149,42 @@ class Mixer extends ComponentContainer { }, }); + if (SoftwareMixerMain) { + this.master = new Pot({ + group: "[Master]", + inKey: "gain", + inByte: 22, + bitLength: 12, + inReport: inReports[2] + }); + } + if (SoftwareMixerBooth) { + this.booth = new Pot({ + group: "[Master]", + inKey: "booth_gain", + inByte: 24, + bitLength: 12, + inReport: inReports[2] + }); + } + if (SoftwareMixerHeadphone) { + this.cue = new Pot({ + group: "[Master]", + inKey: "headMix", + inByte: 28, + bitLength: 12, + inReport: inReports[2] + }); + + this.pflGain = new Pot({ + group: "[Master]", + inKey: "headGain", + inByte: 26, + bitLength: 12, + inReport: inReports[2] + }); + } + for (const component of this) { if (component.inReport === undefined) { component.inReport = inReports[1]; From 1c05b8ca398fbeb3a6a24c05dcfb83666f63abbb Mon Sep 17 00:00:00 2001 From: Antoine C Date: Sat, 6 Apr 2024 13:10:15 +0100 Subject: [PATCH 2/5] feat(S4MK3): custom default pad layout --- .../Traktor Kontrol S4 MK3.hid.xml | 12 ++++++++ res/controllers/Traktor-Kontrol-S4-MK3.js | 28 +++++++++++++++++-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/res/controllers/Traktor Kontrol S4 MK3.hid.xml b/res/controllers/Traktor Kontrol S4 MK3.hid.xml index cca9c68bb7e..3cb698f66a6 100644 --- a/res/controllers/Traktor Kontrol S4 MK3.hid.xml +++ b/res/controllers/Traktor Kontrol S4 MK3.hid.xml @@ -190,6 +190,18 @@ This option is useful if you don't use samplers and would like to access a set of predefined beatloop rolls. Beat size can be customized individually. + diff --git a/res/controllers/Traktor-Kontrol-S4-MK3.js b/res/controllers/Traktor-Kontrol-S4-MK3.js index 38199d74ab9..3f3fb65fbc2 100644 --- a/res/controllers/Traktor-Kontrol-S4-MK3.js +++ b/res/controllers/Traktor-Kontrol-S4-MK3.js @@ -38,6 +38,11 @@ const KeyboardColors = [ LedColors.white, ]; +// Constant used to define custom default pad layout +const DefaultPadLayoutHotcue = "hotcue"; +const DefaultPadLayoutSamplerBeatloop = "samplerBeatloop"; +const DefaultPadLayoutKeyboard = "keyboard"; + /* * USER CONFIGURABLE SETTINGS * Change settings in the preferences @@ -143,6 +148,9 @@ const SoftwareMixerMain = !!engine.getSetting("softwareMixerMain"); const SoftwareMixerBooth = !!engine.getSetting("softwareMixerBooth"); const SoftwareMixerHeadphone = !!engine.getSetting("softwareMixerHeadphone"); +// Define custom default layout used by the pads, instead of intro/outro and first 4 hotcues. +const DefaultPadLayout = engine.getSetting("defaultPadLayout"); + // The LEDs only support 16 base colors. Adding 1 in addition to // the normal 2 for Button.prototype.brightnessOn changes the color @@ -2254,8 +2262,24 @@ class S4Mk3Deck extends Deck { samplerPage: 3, keyboard: 5, }; - switchPadLayer(this, defaultPadLayer); - this.currentPadLayer = this.padLayers.defaultLayer; + switch (DefaultPadLayout) { + case DefaultPadLayoutHotcue: + switchPadLayer(this, hotcuePage2); + this.currentPadLayer = this.padLayers.hotcuePage2; + break; + case DefaultPadLayoutSamplerBeatloop: + switchPadLayer(this, samplerOrBeatloopRollPage); + this.currentPadLayer = this.padLayers.samplerPage; + break; + case DefaultPadLayoutKeyboard: + switchPadLayer(this, this.keyboard); + this.currentPadLayer = this.padLayers.keyboard; + break; + default: + switchPadLayer(this, defaultPadLayer); + this.currentPadLayer = this.padLayers.defaultLayer; + break; + } this.hotcuePadModeButton = new Button({ deck: this, From 0afe2dcfa89453d6fef457db243eb68bcde2db4d Mon Sep 17 00:00:00 2001 From: Antoine C Date: Sat, 6 Apr 2024 13:11:07 +0100 Subject: [PATCH 3/5] fix(S4MK3): redundant default value and invalid device matching --- res/controllers/Traktor Kontrol S4 MK3.hid.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/res/controllers/Traktor Kontrol S4 MK3.hid.xml b/res/controllers/Traktor Kontrol S4 MK3.hid.xml index 3cb698f66a6..552d9208936 100644 --- a/res/controllers/Traktor Kontrol S4 MK3.hid.xml +++ b/res/controllers/Traktor Kontrol S4 MK3.hid.xml @@ -6,7 +6,7 @@ HID Mapping for Traktor Kontrol S4 MK3 native_instruments_traktor_kontrol_s4_mk3 - + @@ -56,7 +56,7 @@ label="Deck C"> aqua azalea - blue + blue celeste fuscia green @@ -131,7 +131,7 @@ label="Tempo fader low soft takeover color"> aqua azalea - blue + blue celeste fuscia green From 2280d98a3462b5bee22ce10e309c043deddb6b7b Mon Sep 17 00:00:00 2001 From: Antoine Colombier <7086688+acolombier@users.noreply.github.com> Date: Fri, 12 Apr 2024 20:18:29 +0100 Subject: [PATCH 4/5] Apply suggestions from code review Co-authored-by: Swiftb0y <12380386+Swiftb0y@users.noreply.github.com> --- res/controllers/Traktor Kontrol S4 MK3.hid.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/res/controllers/Traktor Kontrol S4 MK3.hid.xml b/res/controllers/Traktor Kontrol S4 MK3.hid.xml index 552d9208936..c332dd659f9 100644 --- a/res/controllers/Traktor Kontrol S4 MK3.hid.xml +++ b/res/controllers/Traktor Kontrol S4 MK3.hid.xml @@ -220,7 +220,7 @@ default="false" label="Main gain is handled by the Mixxx built-in mixer"> - When enable, the master potentiometer on top right column of the mixer will drive the main gain of the Mixxx internal mixer as well as the hardware built-in mixer in the device. This is useful if you aren't relying on the hardware output, but will create conflict if enabled when using the hardware outputs. + When enabled, the master potentiometer on top right column of the mixer will drive the main gain of the Mixxx internal mixer as well as the hardware built-in mixer in the device. This is useful if you aren't relying on the hardware output, but will create conflict if enabled when using the hardware outputs. From 95509f7c0b05f25a44a325c71eaee903492938e1 Mon Sep 17 00:00:00 2001 From: Antoine Colombier <7086688+acolombier@users.noreply.github.com> Date: Sat, 4 May 2024 10:53:00 +0100 Subject: [PATCH 5/5] Apply suggestions from code review Co-authored-by: Owen Williams --- res/controllers/Traktor Kontrol S4 MK3.hid.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/res/controllers/Traktor Kontrol S4 MK3.hid.xml b/res/controllers/Traktor Kontrol S4 MK3.hid.xml index c332dd659f9..51a34b13de8 100644 --- a/res/controllers/Traktor Kontrol S4 MK3.hid.xml +++ b/res/controllers/Traktor Kontrol S4 MK3.hid.xml @@ -220,7 +220,7 @@ default="false" label="Main gain is handled by the Mixxx built-in mixer"> - When enabled, the master potentiometer on top right column of the mixer will drive the main gain of the Mixxx internal mixer as well as the hardware built-in mixer in the device. This is useful if you aren't relying on the hardware output, but will create conflict if enabled when using the hardware outputs. + When enabled, the master potentiometer on top right column of the mixer will drive both the main gain of the Mixxx internal mixer as well as the hardware built-in mixer in the device. This is useful if you aren't relying on the hardware output, but could result in undesired clipping if enabled when using the hardware audio outputs.