Skip to content

Commit

Permalink
Roland DJ-202: Move shared attributes into prototype object
Browse files Browse the repository at this point in the history
  • Loading branch information
eigengrau committed May 7, 2018
1 parent 76a6270 commit b55f55a
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions res/controllers/Roland_DJ-202-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -796,10 +796,19 @@ DJ202.SyncButton.prototype.shift = function () {

DJ202.HotcueButton = function () {
components.HotcueButton.apply(this, arguments);
this.sendShifted = true;
this.shiftControl = true;
this.shiftOffset = 8;
};

DJ202.HotcueButton.prototype = Object.create(components.HotcueButton.prototype);

DJ202.HotcueButton.prototype.connect = function () {
var deck = script.deckFromGroup(this.group);
this.midi = [0x94 + deck - 1, this.number];
components.HotcueButton.prototype.connect.call(this);
}

DJ202.HotcueButton.prototype.unshift = function () {
this.inKey = 'hotcue_' + this.number + '_activate';
this.input = function (channel, control, value, status, group) {
Expand Down Expand Up @@ -1094,20 +1103,7 @@ DJ202.PadSection = function (deck) {
this.hotcueButton = [];

for (var i = 1; i <= 8; i++) {

this.hotcueButton[i] = new DJ202.HotcueButton({
sendShifted: true,
shiftControl: true,
shiftOffset: 8,
number: i
});

this.hotcueButton[i].connect = function () {
var deck = script.deckFromGroup(this.group);
this.midi = [0x94 + deck - 1, this.number];
components.HotcueButton.prototype.connect.call(this);
};

this.hotcueButton[i] = new DJ202.HotcueButton({number: i});
}

this.loopButton = [];
Expand Down

0 comments on commit b55f55a

Please sign in to comment.