summaryrefslogtreecommitdiffstats
path: root/res/controllers
diff options
context:
space:
mode:
authorBe <be@mixxx.org>2019-08-22 10:45:52 -0500
committerGitHub <noreply@github.com>2019-08-22 10:45:52 -0500
commit559b263df227b0bb36a158ceba5b8006fa51c4b0 (patch)
tree9a96b44c6e4c8c0bbdf30dfa26a8592f36be1155 /res/controllers
parentdc2e9fb282a9b2039b4c57b56cd0d75c41ef5839 (diff)
parent3cf237c7862d17d9872a7e2081daf580b02321f8 (diff)
Merge pull request #2236 from Be-ing/xone_k2
Allen & Heath Xone K2 updates for 2.3
Diffstat (limited to 'res/controllers')
-rw-r--r--res/controllers/Allen-and-Heath-Xone-K2-scripts.js127
1 files changed, 102 insertions, 25 deletions
diff --git a/res/controllers/Allen-and-Heath-Xone-K2-scripts.js b/res/controllers/Allen-and-Heath-Xone-K2-scripts.js
index d824f54cd6..88d458bd0f 100644
--- a/res/controllers/Allen-and-Heath-Xone-K2-scripts.js
+++ b/res/controllers/Allen-and-Heath-Xone-K2-scripts.js
@@ -1,5 +1,8 @@
var XoneK2 = {};
+XoneK2.seekRateFast = 3.0;
+XoneK2.seekRateSlow = 0.5;
+
XoneK2.decksInMiddleMidiChannel = 0xE;
XoneK2.effectsInMiddleMidiChannel = 0xD;
XoneK2.decksOnLeftMidiChannel = 0xC;
@@ -17,8 +20,9 @@ XoneK2.layerButtonColors = {
green: 0x14,
}
XoneK2.deckBottomButtonLayers = [
- { name: 'loop', layerButtonNoteNumber: XoneK2.layerButtonColors.amber },
- { name: 'hotcue', layerButtonNoteNumber: XoneK2.layerButtonColors.red } ];
+ { name: 'intro_outro', layerButtonNoteNumber: XoneK2.layerButtonColors.amber },
+ { name: 'hotcue', layerButtonNoteNumber: XoneK2.layerButtonColors.red },
+ { name: 'loop', layerButtonNoteNumber: XoneK2.layerButtonColors.green }, ];
// Multiple K2s/K1s can be connected via X-Link and plugged in with one USB
// cable. The MIDI messages of the controllers can be distinguished by setting
@@ -218,7 +222,7 @@ components.Component.prototype.send = function (value) {
return;
}
// The LEDs are turned on with a Note On MIDI message (first nybble of first byte 9)
- // and turned off with a Note Offf MIDI message (first nybble of first byte 8).
+ // and turned off with a Note Off MIDI message (first nybble of first byte 8).
if (value > 0) {
midi.sendShortMsg(this.midi[0] + 0x10, this.midi[1] + this.color, value);
} else {
@@ -262,21 +266,21 @@ XoneK2.Deck = function (column, deckNumber, midiChannel) {
unshift: function () {
this.input = function (channel, control, value, status) {
direction = (value === 1) ? 1 : -1;
- engine.setValue(this.group, "jog", direction);
+ var gain = engine.getValue(this.group, "pregain");
+ engine.setValue(this.group, "pregain", gain + 0.025 * direction);
};
},
shift: function () {
this.input = function (channel, control, value, status) {
direction = (value === 1) ? 1 : -1;
- var pitch = engine.getValue(this.group, "pitch");
- engine.setValue(this.group, "pitch", pitch + (.05 * direction));
+ engine.setValue(this.group, "jog", direction);
};
},
supershift: function () {
this.input = function (channel, control, value, status) {
direction = (value === 1) ? 1 : -1;
- var gain = engine.getValue(this.group, "pregain");
- engine.setValue(this.group, "pregain", gain + 0.025 * direction);
+ var pitch = engine.getValue(this.group, "pitch");
+ engine.setValue(this.group, "pitch", pitch + (.05 * direction));
};
},
});
@@ -284,15 +288,15 @@ XoneK2.Deck = function (column, deckNumber, midiChannel) {
this.encoderPress = new components.Button({
outKey: 'sync_enabled',
unshift: function () {
- this.inKey = 'sync_enabled';
- this.type = components.Button.prototype.types.toggle;
+ this.inKey = 'pregain_set_one';
+ this.type = components.Button.prototype.types.push;
},
shift: function () {
- this.inKey = 'reset_key';
- this.type = components.Button.prototype.types.push;
+ this.inKey = 'sync_enabled';
+ this.type = components.Button.prototype.types.toggle;
},
supershift: function () {
- this.inKey = 'pregain_set_one';
+ this.inKey = 'reset_key';
this.type = components.Button.prototype.types.push;
},
});
@@ -412,6 +416,87 @@ XoneK2.Deck = function (column, deckNumber, midiChannel) {
// happen when iterating over the Deck with reconnectComponents.
this.bottomButtonLayers = [];
+ var CueAndSeekButton = function (options) {
+ if (options.cueName === undefined) {
+ print('ERROR! cueName not specified');
+ } else if (options.seekRate === undefined) {
+ print('ERROR! seekRate not specified');
+ }
+
+ this.outKey = options.cueName + '_enabled';
+ components.Button.call(this, options);
+ };
+ CueAndSeekButton.prototype = new components.Button({
+ unshift: function () {
+ this.inKey = this.cueName + '_activate';
+ this.input = components.Button.prototype.input;
+ // Avoid log spam on startup
+ if (this.group !== undefined) {
+ engine.setValue(this.group, 'rateSearch', 0);
+ }
+ },
+ shift: function () {
+ this.input = function (channel, control, value, status) {
+ if (components.Button.prototype.isPress(channel, control, value, status)) {
+ engine.setValue(this.group, 'rateSearch', this.seekRate);
+ } else {
+ engine.setValue(this.group, 'rateSearch', 0);
+ }
+ };
+ },
+ supershift: function () {
+ this.inKey = this.cueName + '_clear';
+ this.input = components.Button.prototype.input;
+ engine.setValue(this.group, 'rateSearch', 0);
+ }
+ });
+
+ this.bottomButtonLayers.intro_outro = new components.ComponentContainer();
+ this.bottomButtonLayers.intro_outro[1] = new CueAndSeekButton({
+ cueName: "intro_start",
+ seekRate: XoneK2.seekRateFast,
+ color: XoneK2.color.amber,
+ });
+ this.bottomButtonLayers.intro_outro[2] = new CueAndSeekButton({
+ cueName: "intro_end",
+ seekRate: -1 * XoneK2.seekRateFast,
+ color: XoneK2.color.amber,
+ });
+ this.bottomButtonLayers.intro_outro[3] = new CueAndSeekButton({
+ cueName: "outro_start",
+ seekRate: XoneK2.seekRateSlow,
+ color: XoneK2.color.amber,
+ });
+ this.bottomButtonLayers.intro_outro[4] = new CueAndSeekButton({
+ cueName: "outro_end",
+ seekRate: -1 * XoneK2.seekRateSlow,
+ color: XoneK2.color.amber,
+ });
+
+
+ this.bottomButtonLayers.hotcue = new components.ComponentContainer();
+ this.bottomButtonLayers.hotcue[1] = new CueAndSeekButton({
+ cueName: "hotcue_1",
+ seekRate: XoneK2.seekRateFast,
+ color: XoneK2.color.red,
+ });
+ this.bottomButtonLayers.hotcue[2] = new CueAndSeekButton({
+ cueName: "hotcue_2",
+ seekRate: -1 * XoneK2.seekRateFast,
+ color: XoneK2.color.red,
+ });
+ this.bottomButtonLayers.hotcue[3] = new CueAndSeekButton({
+ cueName: "hotcue_3",
+ seekRate: XoneK2.seekRateSlow,
+ color: XoneK2.color.red,
+ });
+ this.bottomButtonLayers.hotcue[4] = new CueAndSeekButton({
+ cueName: "hotcue_4",
+ seekRate: -1 * XoneK2.seekRateSlow,
+ color: XoneK2.color.red,
+ });
+
+
this.bottomButtonLayers.loop = new components.ComponentContainer();
this.bottomButtonLayers.loop[1] = new components.Button({
@@ -446,11 +531,11 @@ XoneK2.Deck = function (column, deckNumber, midiChannel) {
this.bottomButtonLayers.loop[3] = new components.Button({
unshift: function () {
- this.inKey = 'beatjump_forward';
+ this.inKey = 'loop_double';
this.input = components.Button.prototype.input;
},
shift: function () {
- this.inKey = 'loop_double';
+ this.inKey = 'beatjump_forward';
this.input = components.Button.prototype.input;
},
supershift: function () {
@@ -469,11 +554,11 @@ XoneK2.Deck = function (column, deckNumber, midiChannel) {
this.bottomButtonLayers.loop[4] = new components.Button({
unshift: function () {
- this.inKey = 'beatjump_backward';
+ this.inKey = 'loop_halve';
this.input = components.Button.prototype.input;
},
shift: function () {
- this.inKey = 'loop_halve';
+ this.inKey = 'beatjump_backward';
this.input = components.Button.prototype.input;
},
supershift: function () {
@@ -490,14 +575,6 @@ XoneK2.Deck = function (column, deckNumber, midiChannel) {
color: XoneK2.color.amber,
});
- this.bottomButtonLayers.hotcue = new components.ComponentContainer();
- for (var n = 1; n <= 4; ++n) {
- this.bottomButtonLayers.hotcue[n] = new components.HotcueButton({
- number: n,
- color: XoneK2.color.red,
- });
- }
-
var setGroup = function (component) {
if (component.group === undefined) {
component.group = theDeck.deckString;