Skip to content

Commit

Permalink
Traktor S2 Mk1: fix eq knobs scaling for biquad
Browse files Browse the repository at this point in the history
  • Loading branch information
leifhelm committed Jul 4, 2023
1 parent 9011bf3 commit ffe07c8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion res/controllers/Traktor-Kontrol-S2-MK1-hid-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ class EqualizerParameter {
hidReport.addControl(this.group, name, config, "H", 0xFFFF, false, callback.bind(this));
}
knob(field) {
setKnobParameter(this.group, "parameter" + this.number, field.value, this.calibration);
setKnobParameterEq(this.group, "parameter" + this.number, field.value, this.calibration);
}
}

Expand Down Expand Up @@ -1473,6 +1473,15 @@ const setKnobParameter = function(group, key, value, calibration) {
}
engine.setValue(group, key, calibratedValue);
};
const setKnobParameterEq = function(group, key, value, calibration) {
let calibratedValue;
if (value <= calibration.center) {
calibratedValue = script.absoluteLin(value, 0, 1, calibration.min, calibration.center);
} else {
calibratedValue = script.absoluteLin(value, 1, 2, calibration.center, calibration.max);
}
engine.setValue(group, key, calibratedValue);
};
const setFaderParameter = function(group, key, value, calibration) {
const calibratedValue = script.absoluteLin(value, 0, 1, calibration.min, calibration.max);
engine.setParameter(group, key, calibratedValue);
Expand Down

0 comments on commit ffe07c8

Please sign in to comment.