From e0b9d748f4ac83717f61706b0122970bc5185bfa Mon Sep 17 00:00:00 2001 From: fwcd Date: Thu, 24 Feb 2022 02:48:28 +0100 Subject: [PATCH 1/8] Add optional jog wheel acceleration to MC7000 mapping The acceleration is disabled by default. --- res/controllers/Denon-MC7000-scripts.js | 39 ++++++++++++++++++------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/res/controllers/Denon-MC7000-scripts.js b/res/controllers/Denon-MC7000-scripts.js index 264a3c5c6c3..3e2cfef580e 100644 --- a/res/controllers/Denon-MC7000-scripts.js +++ b/res/controllers/Denon-MC7000-scripts.js @@ -89,13 +89,25 @@ MC7000.scratchParams = { beta: (1.0/10)/32 }; -// Sensitivity factor of the jog wheel (also depends on audio latency) -// 0.5 for half, 2 for double sensitivity - Recommendation: -// set to 0.5 with audio buffer set to 50ms -// set to 1 with audio buffer set to 25ms -// set to 3 with audio buffer set to 5ms -MC7000.jogSensitivity = 1; - +// Jog wheel parameters +MC7000.jogParams = { + // Sensitivity factor of the jog wheel (also depends on audio latency) + // 0.5 for half, 2 for double sensitivity - Recommendation: + // set to 0.5 with audio buffer set to 50ms + // set to 1 with audio buffer set to 25ms + // set to 3 with audio buffer set to 5ms + sensitivity: 1, + // Acceleration settings for the jog wheel in vinyl mode + // (exponent: 0 and coefficient: 1 = no acceleration) + acceleration: { + // Toggles acceleration entirely. + enabled: false, + // Acceleration function exponent + exponent: 0.8, + // Acceleration function scaling factor + coefficient: 1 + } +}; /*///////////////////////////////// // USER VARIABLES END // @@ -705,7 +717,8 @@ MC7000.wheelTurn = function(channel, control, value, status, group) { // A: For a control that centers on 0: const numTicks = (value < 0x64) ? value : (value - 128); - const adjustedSpeed = numTicks * MC7000.jogSensitivity / 10; + const baseSpeed = numTicks * MC7000.jogParams.sensitivity; + const adjustedSpeed = baseSpeed / 10; const deckNumber = script.deckFromGroup(group); const deckIndex = deckNumber - 1; const libraryMaximized = engine.getValue("[Skin]", "show_maximized_library"); @@ -714,8 +727,14 @@ MC7000.wheelTurn = function(channel, control, value, status, group) { } else if (libraryMaximized === 1 && numTicks < 0) { engine.setValue("[Library]", "MoveUp", 1); } else if (engine.isScratching(deckNumber)) { - // Scratch! - engine.scratchTick(deckNumber, numTicks * MC7000.jogSensitivity); + // Scratch! + let scratchSpeed = baseSpeed; + const acceleration = MC7000.jogParams.acceleration; + if (acceleration && acceleration.enabled) { + const accelerationFactor = Math.pow(Math.abs(baseSpeed), acceleration.exponent) * acceleration.coefficient; + scratchSpeed *= accelerationFactor; + } + engine.scratchTick(deckNumber, scratchSpeed); } else { if (MC7000.shift[deckIndex]) { // While Shift Button pressed -> Search through track From 8102940b7089a71150eecc88ef6dc18c5dd2a47c Mon Sep 17 00:00:00 2001 From: fwcd <30873659+fwcd@users.noreply.github.com> Date: Sat, 17 Aug 2024 01:16:45 +0200 Subject: [PATCH 2/8] Add explanatory comment Co-authored-by: JoergAtGithub <64457745+JoergAtGithub@users.noreply.github.com> --- res/controllers/Denon-MC7000-scripts.js | 1 + 1 file changed, 1 insertion(+) diff --git a/res/controllers/Denon-MC7000-scripts.js b/res/controllers/Denon-MC7000-scripts.js index 3e2cfef580e..fa7d349329f 100644 --- a/res/controllers/Denon-MC7000-scripts.js +++ b/res/controllers/Denon-MC7000-scripts.js @@ -98,6 +98,7 @@ MC7000.jogParams = { // set to 3 with audio buffer set to 5ms sensitivity: 1, // Acceleration settings for the jog wheel in vinyl mode + // If enabled, the track speed will accelerate faster than the physical jogheel movement. Be aware, that the absolute track position will drift relative to the jogwheel position in this mode! // (exponent: 0 and coefficient: 1 = no acceleration) acceleration: { // Toggles acceleration entirely. From 71c1d7be1096861c09e2c239c82784ebb5c0c8cc Mon Sep 17 00:00:00 2001 From: fwcd Date: Sat, 17 Aug 2024 03:48:25 +0200 Subject: [PATCH 3/8] MC7000: Add user-configurable jogwheel settings --- res/controllers/Denon-MC7000.midi.xml | 56 +++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/res/controllers/Denon-MC7000.midi.xml b/res/controllers/Denon-MC7000.midi.xml index be6dd02bd88..32dc109da7c 100644 --- a/res/controllers/Denon-MC7000.midi.xml +++ b/res/controllers/Denon-MC7000.midi.xml @@ -8,6 +8,62 @@ https://github.com/mixxxdj/mixxx/wiki/Denon-MC7000 denon_mc7000 + + + + + + + + + + + + From 747a523288ab186333a48f2e65300f2fdd2f6812 Mon Sep 17 00:00:00 2001 From: fwcd Date: Sat, 17 Aug 2024 03:55:10 +0200 Subject: [PATCH 4/8] MC7000: Wire up user-configurable settings --- res/controllers/Denon-MC7000-scripts.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/res/controllers/Denon-MC7000-scripts.js b/res/controllers/Denon-MC7000-scripts.js index fa7d349329f..5ae2aea9179 100644 --- a/res/controllers/Denon-MC7000-scripts.js +++ b/res/controllers/Denon-MC7000-scripts.js @@ -96,17 +96,17 @@ MC7000.jogParams = { // set to 0.5 with audio buffer set to 50ms // set to 1 with audio buffer set to 25ms // set to 3 with audio buffer set to 5ms - sensitivity: 1, + sensitivity: engine.getSetting("jogSensitivity") || 1, // Acceleration settings for the jog wheel in vinyl mode // If enabled, the track speed will accelerate faster than the physical jogheel movement. Be aware, that the absolute track position will drift relative to the jogwheel position in this mode! // (exponent: 0 and coefficient: 1 = no acceleration) acceleration: { // Toggles acceleration entirely. - enabled: false, + enabled: engine.getSetting("jogAccelerationEnabled") || false, // Acceleration function exponent - exponent: 0.8, + exponent: engine.getSetting("jogAccelerationExponent") || 0.8, // Acceleration function scaling factor - coefficient: 1 + coefficient: engine.getSetting("jogAccelerationCoefficient") || 1 } }; From f60d083c14657b9bd2be637c13a0c6411a0c3614 Mon Sep 17 00:00:00 2001 From: fwcd Date: Sat, 17 Aug 2024 03:58:47 +0200 Subject: [PATCH 5/8] MC7000: Update ranges for acceleration parameters --- res/controllers/Denon-MC7000.midi.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/res/controllers/Denon-MC7000.midi.xml b/res/controllers/Denon-MC7000.midi.xml index 32dc109da7c..460ea19dec0 100644 --- a/res/controllers/Denon-MC7000.midi.xml +++ b/res/controllers/Denon-MC7000.midi.xml @@ -43,8 +43,9 @@ variable="jogAccelerationExponent" type="real" min="0" - max="2.0" + max="20.0" default="0.8" + step="0.1" label="Acceleration exponent"> The exponent of the acceleration curve @@ -54,7 +55,8 @@ variable="jogAccelerationCoefficient" type="real" min="0.05" - max="3.0" + max="20.0" + step="0.1" default="1.0" label="Acceleration coefficient"> From b060c68ac0740be0eaf236a36c020b3dd2adfdb7 Mon Sep 17 00:00:00 2001 From: fwcd Date: Sat, 17 Aug 2024 03:59:25 +0200 Subject: [PATCH 6/8] MC7000: Fix small stylistic typo --- res/controllers/Denon-MC7000-scripts.js | 2 +- res/controllers/Denon-MC7000.midi.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/res/controllers/Denon-MC7000-scripts.js b/res/controllers/Denon-MC7000-scripts.js index 5ae2aea9179..5c45d0dfdf0 100644 --- a/res/controllers/Denon-MC7000-scripts.js +++ b/res/controllers/Denon-MC7000-scripts.js @@ -98,7 +98,7 @@ MC7000.jogParams = { // set to 3 with audio buffer set to 5ms sensitivity: engine.getSetting("jogSensitivity") || 1, // Acceleration settings for the jog wheel in vinyl mode - // If enabled, the track speed will accelerate faster than the physical jogheel movement. Be aware, that the absolute track position will drift relative to the jogwheel position in this mode! + // If enabled, the track speed will accelerate faster than the physical jogheel movement. Be aware that the absolute track position will drift relative to the jogwheel position in this mode! // (exponent: 0 and coefficient: 1 = no acceleration) acceleration: { // Toggles acceleration entirely. diff --git a/res/controllers/Denon-MC7000.midi.xml b/res/controllers/Denon-MC7000.midi.xml index 460ea19dec0..8839b321b2c 100644 --- a/res/controllers/Denon-MC7000.midi.xml +++ b/res/controllers/Denon-MC7000.midi.xml @@ -35,7 +35,7 @@ default="false" label="Enable jogwheel acceleration"> - If enabled, the track speed will accelerate faster than the physical jogheel movement. Be aware, that the absolute track position will drift relative to the jogwheel position in this mode! + If enabled, the track speed will accelerate faster than the physical jogheel movement. Be aware that the absolute track position will drift relative to the jogwheel position in this mode! (exponent: 0 and coefficient: 1 = no acceleration) From db5e1512dffb4dc69558e46acf069154c0575580 Mon Sep 17 00:00:00 2001 From: fwcd Date: Sat, 17 Aug 2024 04:03:44 +0200 Subject: [PATCH 7/8] MC7000: Update sensitivity range --- res/controllers/Denon-MC7000.midi.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/res/controllers/Denon-MC7000.midi.xml b/res/controllers/Denon-MC7000.midi.xml index 8839b321b2c..e1465331588 100644 --- a/res/controllers/Denon-MC7000.midi.xml +++ b/res/controllers/Denon-MC7000.midi.xml @@ -14,9 +14,8 @@