Skip to content

Commit

Permalink
Roland DJ-505: Add rudimentary support for the jog wheel LED indicators
Browse files Browse the repository at this point in the history
  • Loading branch information
Holzhaus committed Feb 4, 2020
1 parent 1ce847e commit 876cd47
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions res/controllers/Roland_DJ-505-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,44 @@ DJ505.Deck = function(deckNumbers, offset) {
}
};

/* Platter Spin LED Indicator on Jog Wheels
*
* The Controller features a LED indicator that imitates a spinning
* platter when the deck is playing and also shows to position inside a
* bar.
*
* LED indicator values:
* - 0x00 - 0x1F: Beat 0 (downbeat) to 1
* - 0x20 - 0x3F: Beat 1 to 2
* - 0x40 - 0x5F: Beat 2 to 3
* - 0x60 - 0x7F: Beat 3 (upbeat) to 0 (next downbeat)
*
* TODO: Add proper bar support for the LED indicators
*
* Mixx currently does not support bar detection, so we don't know which
* of the 4 beats in a we are on. This has been worked around by counting
* beats manually, but this is error prone and does not support moving
* backwards in a track, has problems with loops, does not detect hotcue
* jumps and does not indicate the downbeat (obviously).
*
* See Launchpad issue: https://bugs.launchpad.net/mixxx/+bug/419155
*/
this.beatIndex = 0;
this.lastBeatDistance = 0;
engine.makeConnection(this.currentDeck, "beat_distance", function(value) {
// Check if we're already in front of the next beat.
if (value < this.lastBeatDistance) {
this.beatIndex = (this.beatIndex + 1) % 4;
}
this.lastBeatDistance = value;

// Since deck indices start with 1, we use 0xAF + deck for the status
// byte, so that we 0xB0 for the first deck.
var status = 0xAF + script.deckFromGroup(this.currentDeck);

// Send a value between 0x00 and 0x7F to set jog wheel LED indicator
midi.sendShortMsg(status, 0x06, Math.round(0x1f * value + 0x20 * this.beatIndex));
});

// ========================== LOOP SECTION ==============================

Expand Down

0 comments on commit 876cd47

Please sign in to comment.