Skip to content

Commit

Permalink
Merge pull request #2582 from Holzhaus/roland-dj-505-pad-fixes
Browse files Browse the repository at this point in the history
Roland DJ-505: Fix Cue Loop and Pitch Play mode
  • Loading branch information
uklotzde authored Mar 22, 2020
2 parents b156deb + da02972 commit 78a8640
Showing 1 changed file with 5 additions and 40 deletions.
45 changes: 5 additions & 40 deletions res/controllers/Roland_DJ-505-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -1328,7 +1328,7 @@ DJ505.CueLoopMode = function(deck, offset) {
this.midi = [0x94 + offset, 0x14 + n];
this.number = n + 1;
this.outKey = "hotcue_" + this.number + "_enabled";
this.colorIdKey = "hotcue_" + this.number + "_color_id";
this.colorKey = "hotcue_" + this.number + "_color";

components.Button.call(this);
};
Expand Down Expand Up @@ -1384,44 +1384,9 @@ DJ505.CueLoopMode = function(deck, offset) {
this.inKey = "hotcue_" + this.number + "_clear";
this.input = components.Button.prototype.input;
},
output: function(value) {
var outval = this.outValueScale(value);
// WARNING: outputColor only handles hotcueColors
// and there is no hotcueColor for turning the LED
// off. So the `send()` function is responsible for turning the
// actual LED off.
if (this.colorIdKey !== undefined && outval !== this.off) {
this.outputColor(engine.getValue(this.group, this.colorIdKey));
} else {
this.send(outval);
}
},
outputColor: function(id) {
var color = this.colors[id];
if (color instanceof Array) {
if (color.length !== 3) {
print("ERROR: invalid color array for id: " + id);
return;
}
if (this.sendRGB === undefined) {
print("ERROR: no function defined for sending RGB colors");
return;
}
this.sendRGB(color);
} else if (typeof color === "number") {
this.send(color);
}
},
connect: function() {
components.Button.prototype.connect.call(this); // call parent connect
if (undefined !== this.group && this.colorIdKey !== undefined) {
this.connections[1] = engine.makeConnection(this.group, this.colorIdKey, function(id) {
if (engine.getValue(this.group, this.outKey)) {
this.outputColor(id);
}
});
}
},
output: components.HotcueButton.prototype.output,
outputColor: components.HotcueButton.prototype.outputColor,
connect: components.HotcueButton.prototype.connect,
});

this.pads = new components.ComponentContainer();
Expand Down Expand Up @@ -1651,7 +1616,7 @@ DJ505.PitchPlayMode = function(deck, offset) {
off: DJ505.PadColor.OFF,
outputColor: function(colorCode) {
// For colored hotcues (shifted only)
var midiColor = this.colorMapper.getNearestValue(colorCode);
var midiColor = this.colorMapper.getValueForNearestColor(colorCode);
this.send((this.mode.cuepoint === this.number) ? midiColor : (midiColor + DJ505.PadColor.DIM_MODIFIER));
},
unshift: function() {
Expand Down

0 comments on commit 78a8640

Please sign in to comment.