Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Roland DJ-505: Add explicit leader support #3864

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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