From ee52ffe1e62cddd0a4097d4fb75f3bd9f6935d1e Mon Sep 17 00:00:00 2001
From: Robbert van der Helm <mail@robbertvanderhelm.nl>
Date: Mon, 30 Jan 2023 17:23:42 +0100
Subject: [PATCH] Add a jog wheel multiplier constant for the S3

---
 .../Traktor-Kontrol-S3-hid-scripts.js          | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/res/controllers/Traktor-Kontrol-S3-hid-scripts.js b/res/controllers/Traktor-Kontrol-S3-hid-scripts.js
index 75d44cc1047..3b7bedddb07 100644
--- a/res/controllers/Traktor-Kontrol-S3-hid-scripts.js
+++ b/res/controllers/Traktor-Kontrol-S3-hid-scripts.js
@@ -103,7 +103,13 @@ TraktorS3.ChannelColors = {
 TraktorS3.LEDDimValue = 0x00;
 TraktorS3.LEDBrightValue = 0x02;
 
-// Parameters for the scratch smoothing
+// By default the jog wheel's behavior when rotating it matches 33 1/3 rpm
+// vinyl. Changing this value to 2.0 causes a single rotation of the platter to
+// result in twice as much movement, and a value of 0.5 causes the amount of
+// movement to be halved.
+TraktorS3.JogSpeedMultiplier = 1.0;
+
+// Parameters for the jog wheel smoothing while scratching
 TraktorS3.Alpha = 1.0 / 8;
 TraktorS3.Beta = TraktorS3.Alpha / 32;
 
@@ -1263,7 +1269,13 @@ TraktorS3.Deck = class {
         }
 
         if (field.value !== 0) {
-            engine.scratchEnable(this.activeChannelNumber, 768, 33.33334, TraktorS3.Alpha, TraktorS3.Beta);
+            engine.scratchEnable(
+                this.activeChannelNumber,
+                768,
+                33.33334 / TraktorS3.JogSpeedMultiplier,
+                TraktorS3.Alpha,
+                TraktorS3.Beta
+            );
         } else {
             engine.scratchDisable(this.activeChannelNumber);
 
@@ -1302,7 +1314,7 @@ TraktorS3.Deck = class {
             // get the rate ratio.
             const velocity = (tickDelta / timeDelta) / thirtyThree;
 
-            engine.setValue(this.activeChannel, "jog", velocity);
+            engine.setValue(this.activeChannel, "jog", velocity * TraktorS3.JogSpeedMultiplier);
         }
     }