Skip to content

Commit

Permalink
Merge pull request #3864 from Holzhaus/roland-dj-505-add-explicit-lea…
Browse files Browse the repository at this point in the history
…der-support

Roland DJ-505: Add explicit leader support
  • Loading branch information
uklotzde authored May 15, 2021
2 parents f535572 + ca0d755 commit 080780b
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions res/controllers/Roland_DJ-505-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,12 @@ DJ505.Deck = function(deckNumbers, offset) {
this.sync = new components.Button({
midi: [0x90 + offset, 0x02],
group: "[Channel" + deckNumbers + "]",
outKey: "sync_enabled",
outKey: "sync_mode",
flickerState: false,
output: function(value, _group, _control) {
if (value === 3) {
value = this.flickerState;
}
midi.sendShortMsg(this.midi[0], value ? 0x02 : 0x03, this.on);
},
input: function(channel, control, value, _status, _group) {
Expand All @@ -621,7 +625,15 @@ DJ505.Deck = function(deckNumbers, offset) {
script.triggerControl(this.group, "beatsync", 1);
};
this.onLongPress = function() {
engine.setValue(this.group, "sync_enabled", 1);
if (engine.getValue(this.group, "sync_enabled")) {
// If already explicit leader, reset explicit state
// (setting it to 0 may still make it implicit leader and
// immediately resetting it to 1).
var value = (engine.getValue(this.group, "sync_master") === 2) ? 0 : 2;
engine.setValue(this.group, "sync_master", value);
} else {
engine.setValue(this.group, "sync_enabled", 1);
}
};
},
shift: function() {
Expand All @@ -632,6 +644,20 @@ DJ505.Deck = function(deckNumbers, offset) {
script.toggleControl(this.group, "quantize");
};
},
connect: function() {
components.Button.prototype.connect.call(this); // call parent connect
this.flickerTimer = engine.beginTimer(500, function() {
this.flickerState = !this.flickerState;
this.trigger();
}.bind(this));
},
disconnect: function() {
components.Button.prototype.disconnect.call(this); // call parent disconnect
if (this.flickerTimer) {
engine.stopTimer(this.flickerTimer);
this.flickerTimer = 0;
}
},
});

// =============================== MIXER ====================================
Expand Down

0 comments on commit 080780b

Please sign in to comment.