Skip to content

Commit

Permalink
Traktor Kontrol S2MK3: Sampler pregain knob
Browse files Browse the repository at this point in the history
  • Loading branch information
mi01 committed Dec 9, 2019
1 parent 1bdd1e3 commit a7e475b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions res/controllers/Traktor-Kontrol-S2-MK3-hid-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ TraktorS2MK3.registerInputPackets = function () {

this.registerInputScaler(messageLong, "[Master]", "crossfader", 0x05, 0xFFFF, this.parameterHandler);
this.registerInputScaler(messageLong, "[Master]", "gain", 0x15, 0xFFFF, this.parameterHandler);
this.registerInputScaler(messageLong, "[Sampler]", "pregain", 0x17, 0xFFFF, this.samplerPregainHandler);
this.registerInputScaler(messageLong, "[Master]", "headMix", 0x19, 0xFFFF, this.parameterHandler);
this.registerInputScaler(messageLong, "[Master]", "headGain", 0x1B, 0xFFFF, this.parameterHandler);

Expand Down Expand Up @@ -209,6 +210,10 @@ TraktorS2MK3.registerInputPackets = function () {
engine.softTakeover("[Master]", "headMix", true);
engine.softTakeover("[Master]", "headGain", true);

for (var i = 1; i <= 16; ++i) {
engine.softTakeover("[Sampler" + i + "]", "pregain", true);
}

// Dirty hack to set initial values in the packet parser
var data = TraktorS2MK3.toBytes("01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00");
TraktorS2MK3.incomingData(data);
Expand Down Expand Up @@ -518,6 +523,14 @@ TraktorS2MK3.parameterHandler = function (field) {
engine.setParameter(field.group, field.name, field.value / 4095);
};

TraktorS2MK3.samplerPregainHandler = function (field) {
// Map sampler gain knob of all sampler together.
// Dirty hack, but the best we can do for now.
for (var i = 1; i <= 16; ++i) {
engine.setParameter("[Sampler" + i + "]", field.name, field.value / 4095);
}
};

TraktorS2MK3.jogTouchHandler = function (field) {
var deckNumber = TraktorS2MK3.controller.resolveDeck(field.group);
if (field.value > 0) {
Expand Down

0 comments on commit a7e475b

Please sign in to comment.