Skip to content

Commit

Permalink
remove support for relative mode for Pot Components
Browse files Browse the repository at this point in the history
implementing this in JavaScript required making a change in C++
that broke old controller mappings as discussed on GitHub:
mixxxdj#1237 (comment)
  • Loading branch information
Be-ing committed Jun 29, 2017
1 parent 0fc7bf9 commit 3dd4ca2
Showing 1 changed file with 11 additions and 46 deletions.
57 changes: 11 additions & 46 deletions res/controllers/midi-components-0.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,53 +362,18 @@
this.firstValueReceived = false;
};
Pot.prototype = new Component({
relative: false,
shift: function () {
if (this.relative) {
this.input = function (channel, control, value, status, group) {
// Do not manipulate inKey, just store the position of the
// physical potentiometer for calculating how much it moves
// when shift is released.
if (this.MSB !== undefined) {
value = (this.MSB << 7) + value;
}
this.previousValueReceived = value;
}
input: function (channel, control, value, status, group) {
if (this.MSB !== undefined) {
value = (this.MSB << 7) + value;
}
},
unshift: function () {
this.input = function (channel, control, value, status, group) {
if (this.MSB !== undefined) {
value = (this.MSB << 7) + value;
}
if (this.relative) {
if (this.previousValueReceived !== undefined) {
var delta = (value - this.previousValueReceived) / this.max;
if (this.invert) {
delta = -delta;
}
this.inSetParameter(this.inGetParameter() + delta);
} else {
var newValue = value / this.max;
if (this.invert) {
newValue = 1 - newValue;
}
if (this.loadStateOnStartup) {
this.inSetParameter(newValue);
}
}
this.previousValueReceived = value;
} else {
var newValue = this.inValueScale(value);
if (this.invert) {
newValue = 1 - newValue;
}
this.inSetParameter(newValue);
if (!this.firstValueReceived) {
this.firstValueReceived = true;
this.connect();
}
}
var newValue = this.inValueScale(value);
if (this.invert) {
newValue = 1 - newValue;
}
this.inSetParameter(newValue);
if (!this.firstValueReceived) {
this.firstValueReceived = true;
this.connect();
}
},
// Input handlers for 14 bit MIDI
Expand Down

0 comments on commit 3dd4ca2

Please sign in to comment.