Skip to content

Commit

Permalink
Roland DJ-505: Map buttons for library sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
Holzhaus committed Jun 6, 2019
1 parent defd711 commit 5ea3827
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 8 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 @@ -227,7 +227,7 @@ DJ505.browseEncoder = new components.Encoder({
});

DJ505.backButton = new components.Button({
// TODO: Map the BACK/SONG button
// TODO: Map the BACK button
midi: [0x9F, 0x07],
shiftOffset: 11,
sendShifted: true,
Expand All @@ -236,7 +236,6 @@ DJ505.backButton = new components.Button({
});

DJ505.addPrepareButton = new components.Button({
// TODO: Map the ARTIST button
midi: [0x9F, 0x1B],
shiftOffset: -7,
sendShifted: true,
Expand All @@ -246,6 +245,33 @@ DJ505.addPrepareButton = new components.Button({
type: components.Button.prototype.types.toggle,
});


DJ505.sortLibrary = function (channel, control, value, status, group) {
if (value === 0) {
return;
}

var sortColumn;
switch(control) {
case 0x12: // SONG
sortColumn = 1;
break;
case 0x13: // BPM
sortColumn = 14;
break;
case 0x14: // ARTIST
sortColumn = 0;
break;
case 0x1E: // KEY
sortColumn = 19;
break;
default:
// unknown sort column
return;
}
engine.setValue("[Library]", "sort_column_toggle", sortColumn);
};

DJ505.crossfader = new components.Pot({
midi: [0xBF, 0x08],
group: "[Master]",
Expand Down
12 changes: 6 additions & 6 deletions res/controllers/Roland_DJ-505.midi.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3343,9 +3343,9 @@
<script-binding/>
</options>
</control>
<!--
<control>
<group>[Master]</group>
<group>[Library]</group>
<key>DJ505.sortLibrary</key>
<description>BPM</description>
<status>0x9F</status>
<midino>0x13</midino>
Expand All @@ -3354,15 +3354,15 @@
</options>
</control>
<control>
<group>[Master]</group>
<group>[Library]</group>
<key>DJ505.sortLibrary</key>
<description>KEY</description>
<status>0x9F</status>
<midino>0x1E</midino>
<options>
<script-binding/>
</options>
</control>
-->
<control>
<group>[Library]</group>
<key>DJ505.browseEncoder.input</key>
Expand Down Expand Up @@ -3405,7 +3405,7 @@
</control>
<control>
<group>[Library]</group>
<key>DJ505.backButton.input</key>
<key>DJ505.sortLibrary</key>
<description>SONG</description>
<status>0x9F</status>
<midino>0x12</midino>
Expand All @@ -3425,7 +3425,7 @@
</control>
<control>
<group>[Library]</group>
<key>DJ505.addPrepareButton.input</key>
<key>DJ505.sortLibrary</key>
<description>ARTIST</description>
<status>0x9F</status>
<midino>0x14</midino>
Expand Down

0 comments on commit 5ea3827

Please sign in to comment.