From dd7dfc1157e693447b19e6d0d826a8481654b523 Mon Sep 17 00:00:00 2001 From: be_ Date: Mon, 27 Feb 2017 17:09:00 -0600 Subject: [PATCH 01/34] Hercules P32: fix rate_temp_up button --- res/controllers/Hercules-P32-scripts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index 83973075ab7b..48cb193b616f 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -239,7 +239,7 @@ P32.Deck = function (deckNumbers, channel) { }); this.tempFast = new components.Button({ midi: [0x90 + channel, 0x45], - inKey: 'rate_temp_down', + inKey: 'rate_temp_up', onlyOnPress: false, }); this.alignBeats = new components.Button({ From bececdf4880f18a10d4355d361e65342cd5f3a11 Mon Sep 17 00:00:00 2001 From: be_ Date: Mon, 27 Feb 2017 17:17:03 -0600 Subject: [PATCH 02/34] Hercules P32: fix deck toggling --- res/controllers/Hercules-P32-scripts.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index 48cb193b616f..5f32df73bd42 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -114,9 +114,9 @@ P32.recordButton = new components.Button({ P32.slipButton = new components.Button({ midi: [0x90, 0x03], input: function (channel, control, value, status, group) { - if (P32.leftDeck.isShifted) { + if (P32.leftDeck.isShifted && value === 127) { P32.leftDeck.toggle(); - } else if (P32.rightDeck.isShifted) { + } else if (P32.rightDeck.isShifted && value === 127) { P32.rightDeck.toggle(); } else { for (var i = 1; i <= 4; i++) { From b7c9369e4222fe80e4e50e2b66564df850f25f1c Mon Sep 17 00:00:00 2001 From: be_ Date: Mon, 27 Feb 2017 17:17:53 -0600 Subject: [PATCH 03/34] Hercules P32: use new beatloop_size and beatjump_size COs introduced in PR #1187 --- res/controllers/Hercules-P32-scripts.js | 90 ++++++++++++------------- 1 file changed, 43 insertions(+), 47 deletions(-) diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index 5f32df73bd42..8908b3331361 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -69,6 +69,7 @@ P32.shutdown = function () { midi.sendShortMsg(0x90 + channel, button, 0); } } + // TODO: ask Hercules if it is possible to clear the loop size LEDs }; P32.shiftOffset = 3; @@ -149,8 +150,6 @@ P32.slipButton = new components.Button({ P32.Deck = function (deckNumbers, channel) { components.Deck.call(this, deckNumbers); - var loopSize = defaultLoopSize; - var beatJumpSize = defaultBeatJumpSize; var theDeck = this; this.shiftButton = function (channel, control, value, status, group) { @@ -258,26 +257,23 @@ P32.Deck = function (deckNumbers, channel) { // =================================== ENCODERS ============================================== this.loopSizeEncoder = new components.Encoder({ - midi: [0xB0 + channel, 0x1B], // Note: these are the MIDI bytes for the LED readout, not + midi: [0xB0 + channel, 0x1B], // Note: these are the MIDI bytes for the digit LEDs, not // input from the encoder. input: function (channel, control, value, status, group) { + var loopSize = engine.getValue(this.group, 'beatloop_size'); if (loopEnabledDot) { if (value > 64 && loopSize > 2) { // turn left /** Unfortunately, there is no way to show 1 with a dot on the loop size LED. **/ - loopSize /= 2; - engine.setValue(this.group, 'loop_halve', 1); - engine.setValue(this.group, 'loop_halve', 0); + engine.setValue(this.group, 'beatloop_size', loopSize / 2); } else if (value < 64 && loopSize < 32) { // turn right /** Mixxx supports loops longer than 32 beats, but there is no way to show 64 with a dot on the loop size LED. **/ - loopSize *= 2; - engine.setValue(this.group, 'loop_double', 1); - engine.setValue(this.group, 'loop_double', 0); + engine.setValue(this.group, 'beatloop_size', loopSize * 2); } } else { if (value > 64 && loopSize > 1/32) { // turn left @@ -286,60 +282,52 @@ P32.Deck = function (deckNumbers, channel) { way to set the loop size LED less than 1/32 (even though it should be able to show 1/64) **/ - loopSize /= 2; - engine.setValue(this.group, 'loop_halve', 1); - engine.setValue(this.group, 'loop_halve', 0); + engine.setValue(this.group, 'beatloop_size', loopSize / 2); } else if (value < 64 && loopSize < 64) { // turn right /** Mixxx supports loops longer than 64 beats, but the loop size LED only has 2 digits, so it couldn't show 128 **/ - loopSize *= 2; - engine.setValue(this.group, 'loop_double', 1); - engine.setValue(this.group, 'loop_double', 0); + engine.setValue(this.group, 'beatloop_size', loopSize * 2); } } - this.trigger(); }, - outKey: 'loop_enabled', + connect: function () { + this.connections[0] = engine.connectControl(this.group, 'beatloop_size', this.output); + if (loopEnabledDot) { + this.connections[1] = engine.connectControl(this.group, 'loop_enabled', this.output); + } + }, output: function (value, group, control) { - if (loopEnabledDot && value) { - this.send(5 - Math.log(loopSize) / Math.log(2)); + var loopSize = engine.getValue(this.group, 'beatloop_size'); + var loopSizeLogBase2 = Math.log(loopSize) / Math.log(2); + // test if loopSizeLogBase2 is an integer + if (Math.floor(loopSizeLogBase2) === loopSizeLogBase2) { + if (loopEnabledDot && engine.getValue(this.group, 'loop_enabled') === 1) { + this.send(5 - loopSizeLogBase2); + } else { + this.send(5 + loopSizeLogBase2); + } } else { - this.send(5 + Math.log(loopSize) / Math.log(2)); + this.send(14); // show two dots } } }); this.loopMoveEncoder = function (channel, control, value, status, group) { - var direction = (value > 64) ? -1 : 1; - if (loopSize < 1) { - engine.setValue(this.currentDeck, 'loop_move', loopSize * direction); - } else { - engine.setValue(this.currentDeck, 'loop_move', 1 * direction); + if (value < 64) { // left turn + engine.setValue(this.currentDeck, 'loop_move_backward', 1); + } else { // right turn + engine.setValue(this.currentDeck, 'loop_move_forward', 1); } }; this.loopToggleEncoderPress = function (channel, control, value, status, group) { - if (value) { - if (engine.getValue(this.currentDeck, 'loop_enabled')) { - engine.setValue(this.currentDeck, 'reloop_exit', 1); - } else { - engine.setValue(this.currentDeck, 'beatloop_' + loopSize + '_activate', 1); - } - } else { - if (loopSize <= 1 && engine.getValue(this.currentDeck, 'loop_enabled')) { - engine.setValue(this.currentDeck, 'reloop_exit', 1); - } - } + engine.setValue(this.currentDeck, 'loopauto_toggle', value / 127); }; this.loopEncoderManualLoopPress = function (channel, control, value, status, group) { - if (value) { - engine.setValue(this.currentDeck, 'loop_in', 1); - } else { - engine.setValue(this.currentDeck, 'loop_out', 1); - } + engine.setValue(this.currentDeck, 'loopmanual_toggle', value / 127); }; this.tempoEncoder = function (channel, control, value, status, group) { @@ -354,18 +342,22 @@ P32.Deck = function (deckNumbers, channel) { }; this.beatJumpEncoder = function (channel, control, value, status, group) { - var direction = (value > 64) ? -1 : 1; + var beatJumpSize = engine.getValue(this.currentDeck, 'beatjump_size'); if (this.beatJumpEncoderPressed) { if (value > 64 && beatJumpSize > 1/32) { // turn left - beatJumpSize /= 2; + engine.setValue(this.currentDeck, 'beatjump_size', beatJumpSize / 2); } else if (value < 64 && beatJumpSize < 64) { // turn right - beatJumpSize *= 2; + engine.setValue(this.currentDeck, 'beatjump_size', beatJumpSize * 2); } // The firmware will only change the numeric LED readout when sent messages // on the unshifted channel. midi.sendShortMsg(0xB0 + channel - P32.shiftOffset, 0x1B, 5 + Math.log(beatJumpSize) / Math.log(2)); } else { - engine.setValue(this.currentDeck, 'beatjump', direction * beatJumpSize); + var direction = (value > 64) ? 'backward' : 'forward'; + engine.setValue(this.currentDeck, 'beatjump_' + direction, 1); + engine.beginTimer(200, function () { + engine.setValue(this.currentDeck, 'beatjump_' + direction, 0); + }, true); } }; @@ -374,10 +366,14 @@ P32.Deck = function (deckNumbers, channel) { // on the unshifted channel. if (value === 127) { this.beatJumpEncoderPressed = true; - midi.sendShortMsg(0xB0 + channel - P32.shiftOffset, 0x1B, 5 + Math.log(beatJumpSize) / Math.log(2)); + var beatJumpSize = engine.getValue(this.currentDeck, 'beatjump_size'); + midi.sendShortMsg(0xB0 + channel - P32.shiftOffset, 0x1B, + 5 + Math.log(beatJumpSize) / Math.log(2)); } else { this.beatJumpEncoderPressed = false; - midi.sendShortMsg(0xB0 + channel - P32.shiftOffset, 0x1B, 5 + Math.log(loopSize) / Math.log(2)); + var loopSize = engine.getValue(this.currentDeck, 'beatloop_size'); + midi.sendShortMsg(0xB0 + channel - P32.shiftOffset, 0x1B, + 5 + Math.log(loopSize) / Math.log(2)); } }; From fd9815dd042e1a33b717d49db067271cef458c96 Mon Sep 17 00:00:00 2001 From: be_ Date: Mon, 27 Feb 2017 17:18:03 -0600 Subject: [PATCH 04/34] Hercules P32: code cleanup --- res/controllers/Hercules-P32-scripts.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index 8908b3331361..bf1085799b8d 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -386,7 +386,9 @@ P32.Deck = function (deckNumbers, channel) { this.ejectTrack = function (channel, control, value, status, group) { if (value === 127) { engine.setValue(this.currentDeck, 'eject', 1); - engine.beginTimer(250, 'engine.setValue("'+this.currentDeck+'", "eject", 0)', true); + engine.beginTimer(225, function () { + engine.setValue(this.currentDeck, 'eject', 0); + }, true); } }; From c9d98d8b9f4055fdc7aed62913b3ead7cc9c8b5d Mon Sep 17 00:00:00 2001 From: be_ Date: Wed, 1 Mar 2017 17:27:58 -0600 Subject: [PATCH 05/34] Hercules P32: don't toggle slip mode when releasing slip button for toggling a deck --- res/controllers/Hercules-P32-scripts.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index bf1085799b8d..5c1cc572592f 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -114,14 +114,21 @@ P32.recordButton = new components.Button({ P32.slipButton = new components.Button({ midi: [0x90, 0x03], + pressedToToggleDeck: false, input: function (channel, control, value, status, group) { if (P32.leftDeck.isShifted && value === 127) { P32.leftDeck.toggle(); + this.pressedToToggleDeck = true; } else if (P32.rightDeck.isShifted && value === 127) { P32.rightDeck.toggle(); + this.pressedToToggleDeck = true; } else { - for (var i = 1; i <= 4; i++) { - script.toggleControl('[Channel' + i + ']', 'slip_enabled'); + if (this.pressedToToggleDeck && value === 0) { + this.pressedToToggleDeck = false; + } else { + for (var i = 1; i <= 4; i++) { + script.toggleControl('[Channel' + i + ']', 'slip_enabled'); + } } } }, From 4fa13fa532b016dac86ca3cba4a2bf8f74efcec0 Mon Sep 17 00:00:00 2001 From: be_ Date: Sat, 11 Mar 2017 13:37:26 -0600 Subject: [PATCH 06/34] Hercules P32: remove defaultLoopSize & defaultBeatJumpSize options Now that these are handled by Mixxx. --- res/controllers/Hercules-P32-scripts.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index 5c1cc572592f..91d8957a3b23 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -1,8 +1,4 @@ // USER CONFIGURABLE OPTIONS -// loop size (in beats) when Mixxx starts -var defaultLoopSize = 8; -// beat jump size when Mixxx starts -var defaultBeatJumpSize = 4; // Set to "true" to use the dot on the loop size LED display to indicate // that a loop is active. This restricts loop sizes to 2-32 beats and // may be helpful if you never use loops less than 2 beats long. From e97232f69d3fb095eeb12e2ea2f7253de4ba41fa Mon Sep 17 00:00:00 2001 From: be_ Date: Sat, 11 Mar 2017 13:37:50 -0600 Subject: [PATCH 07/34] Hercules P32: rearrange samplers To match new skin layout --- res/controllers/Hercules P32 DJ.midi.xml | 96 ++++++++++++------------ res/controllers/Hercules-P32-scripts.js | 6 +- 2 files changed, 53 insertions(+), 49 deletions(-) diff --git a/res/controllers/Hercules P32 DJ.midi.xml b/res/controllers/Hercules P32 DJ.midi.xml index d9fd7f4b39e4..41c5ab635d3b 100644 --- a/res/controllers/Hercules P32 DJ.midi.xml +++ b/res/controllers/Hercules P32 DJ.midi.xml @@ -1872,7 +1872,7 @@ [Channel1] - P32.leftDeck.samplerButton[5].input + P32.leftDeck.samplerButton[9].input 0x91 0x2C @@ -1881,7 +1881,7 @@ [Channel1] - P32.leftDeck.samplerButton[6].input + P32.leftDeck.samplerButton[10].input 0x91 0x2D @@ -1890,7 +1890,7 @@ [Channel1] - P32.leftDeck.samplerButton[7].input + P32.leftDeck.samplerButton[11].input 0x91 0x2E @@ -1899,7 +1899,7 @@ [Channel1] - P32.leftDeck.samplerButton[8].input + P32.leftDeck.samplerButton[12].input 0x91 0x2F @@ -1908,7 +1908,7 @@ [Channel1] - P32.leftDeck.samplerButton[9].input + P32.leftDeck.samplerButton[17].input 0x91 0x28 @@ -1917,7 +1917,7 @@ [Channel1] - P32.leftDeck.samplerButton[10].input + P32.leftDeck.samplerButton[18].input 0x91 0x29 @@ -1926,7 +1926,7 @@ [Channel1] - P32.leftDeck.samplerButton[11].input + P32.leftDeck.samplerButton[19].input 0x91 0x2A @@ -1935,7 +1935,7 @@ [Channel1] - P32.leftDeck.samplerButton[12].input + P32.leftDeck.samplerButton[20].input 0x91 0x2B @@ -1944,7 +1944,7 @@ [Channel1] - P32.leftDeck.samplerButton[13].input + P32.leftDeck.samplerButton[25].input 0x91 0x24 @@ -1953,7 +1953,7 @@ [Channel1] - P32.leftDeck.samplerButton[14].input + P32.leftDeck.samplerButton[26].input 0x91 0x25 @@ -1962,7 +1962,7 @@ [Channel1] - P32.leftDeck.samplerButton[15].input + P32.leftDeck.samplerButton[27].input 0x91 0x26 @@ -1971,7 +1971,7 @@ [Channel1] - P32.leftDeck.samplerButton[16].input + P32.leftDeck.samplerButton[28].input 0x91 0x27 @@ -2016,7 +2016,7 @@ [Channel1] - P32.leftDeck.samplerButton[5].input + P32.leftDeck.samplerButton[9].input 0x94 0x2C @@ -2025,7 +2025,7 @@ [Channel1] - P32.leftDeck.samplerButton[6].input + P32.leftDeck.samplerButton[10].input 0x94 0x2D @@ -2034,7 +2034,7 @@ [Channel1] - P32.leftDeck.samplerButton[7].input + P32.leftDeck.samplerButton[11].input 0x94 0x2E @@ -2043,7 +2043,7 @@ [Channel1] - P32.leftDeck.samplerButton[8].input + P32.leftDeck.samplerButton[12].input 0x94 0x2F @@ -2052,7 +2052,7 @@ [Channel1] - P32.leftDeck.samplerButton[9].input + P32.leftDeck.samplerButton[17].input 0x94 0x28 @@ -2061,7 +2061,7 @@ [Channel1] - P32.leftDeck.samplerButton[10].input + P32.leftDeck.samplerButton[18].input 0x94 0x29 @@ -2070,7 +2070,7 @@ [Channel1] - P32.leftDeck.samplerButton[11].input + P32.leftDeck.samplerButton[19].input 0x94 0x2A @@ -2079,7 +2079,7 @@ [Channel1] - P32.leftDeck.samplerButton[12].input + P32.leftDeck.samplerButton[20].input 0x94 0x2B @@ -2088,7 +2088,7 @@ [Channel1] - P32.leftDeck.samplerButton[13].input + P32.leftDeck.samplerButton[25].input 0x94 0x24 @@ -2097,7 +2097,7 @@ [Channel1] - P32.leftDeck.samplerButton[14].input + P32.leftDeck.samplerButton[26].input 0x94 0x25 @@ -2106,7 +2106,7 @@ [Channel1] - P32.leftDeck.samplerButton[15].input + P32.leftDeck.samplerButton[27].input 0x94 0x26 @@ -2115,7 +2115,7 @@ [Channel1] - P32.leftDeck.samplerButton[16].input + P32.leftDeck.samplerButton[28].input 0x94 0x27 @@ -2124,7 +2124,7 @@ [Channel1] - P32.rightDeck.samplerButton[17].input + P32.rightDeck.samplerButton[5].input 0x92 0x30 @@ -2133,7 +2133,7 @@ [Channel1] - P32.rightDeck.samplerButton[18].input + P32.rightDeck.samplerButton[6].input 0x92 0x31 @@ -2142,7 +2142,7 @@ [Channel1] - P32.rightDeck.samplerButton[19].input + P32.rightDeck.samplerButton[7].input 0x92 0x32 @@ -2151,7 +2151,7 @@ [Channel1] - P32.rightDeck.samplerButton[20].input + P32.rightDeck.samplerButton[8].input 0x92 0x33 @@ -2160,7 +2160,7 @@ [Channel1] - P32.rightDeck.samplerButton[21].input + P32.rightDeck.samplerButton[13].input 0x92 0x2C @@ -2169,7 +2169,7 @@ [Channel1] - P32.rightDeck.samplerButton[22].input + P32.rightDeck.samplerButton[14].input 0x92 0x2D @@ -2178,7 +2178,7 @@ [Channel1] - P32.rightDeck.samplerButton[23].input + P32.rightDeck.samplerButton[15].input 0x92 0x2E @@ -2187,7 +2187,7 @@ [Channel1] - P32.rightDeck.samplerButton[24].input + P32.rightDeck.samplerButton[16].input 0x92 0x2F @@ -2196,7 +2196,7 @@ [Channel1] - P32.rightDeck.samplerButton[25].input + P32.rightDeck.samplerButton[21].input 0x92 0x28 @@ -2205,7 +2205,7 @@ [Channel1] - P32.rightDeck.samplerButton[26].input + P32.rightDeck.samplerButton[22].input 0x92 0x29 @@ -2214,7 +2214,7 @@ [Channel1] - P32.rightDeck.samplerButton[27].input + P32.rightDeck.samplerButton[23].input 0x92 0x2A @@ -2223,7 +2223,7 @@ [Channel1] - P32.rightDeck.samplerButton[28].input + P32.rightDeck.samplerButton[24].input 0x92 0x2B @@ -2268,7 +2268,7 @@ [Channel1] - P32.rightDeck.samplerButton[17].input + P32.rightDeck.samplerButton[5].input 0x95 0x30 @@ -2277,7 +2277,7 @@ [Channel1] - P32.rightDeck.samplerButton[18].input + P32.rightDeck.samplerButton[6].input 0x95 0x31 @@ -2286,7 +2286,7 @@ [Channel1] - P32.rightDeck.samplerButton[19].input + P32.rightDeck.samplerButton[7].input 0x95 0x32 @@ -2295,7 +2295,7 @@ [Channel1] - P32.rightDeck.samplerButton[20].input + P32.rightDeck.samplerButton[8].input 0x95 0x33 @@ -2304,7 +2304,7 @@ [Channel1] - P32.rightDeck.samplerButton[21].input + P32.rightDeck.samplerButton[13].input 0x95 0x2C @@ -2313,7 +2313,7 @@ [Channel1] - P32.rightDeck.samplerButton[22].input + P32.rightDeck.samplerButton[14].input 0x95 0x2D @@ -2322,7 +2322,7 @@ [Channel1] - P32.rightDeck.samplerButton[23].input + P32.rightDeck.samplerButton[15].input 0x95 0x2E @@ -2331,7 +2331,7 @@ [Channel1] - P32.rightDeck.samplerButton[24].input + P32.rightDeck.samplerButton[16].input 0x95 0x2F @@ -2340,7 +2340,7 @@ [Channel1] - P32.rightDeck.samplerButton[25].input + P32.rightDeck.samplerButton[21].input 0x95 0x28 @@ -2349,7 +2349,7 @@ [Channel1] - P32.rightDeck.samplerButton[26].input + P32.rightDeck.samplerButton[22].input 0x95 0x29 @@ -2358,7 +2358,7 @@ [Channel1] - P32.rightDeck.samplerButton[27].input + P32.rightDeck.samplerButton[23].input 0x95 0x2A @@ -2367,7 +2367,7 @@ [Channel1] - P32.rightDeck.samplerButton[28].input + P32.rightDeck.samplerButton[24].input 0x95 0x2B diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index 91d8957a3b23..6594eabc8339 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -202,7 +202,11 @@ P32.Deck = function (deckNumbers, channel) { number: i, on: P32.padColors.red }); - var samplerNumber = i + (channel - 1) * 16; + var row = Math.ceil(i/4); + var column = ((i-1) % 4) + 1; + var padGrid = channel - 1; + var samplerNumber = (8 * (row-1)) + (column) + (padGrid * 4); + // Math.ceil(i/4) + (i + (channel - 1) * 4 this.samplerButton[samplerNumber] = new components.SamplerButton({ midi: [0x90 + channel, P32.PadNumToMIDIControl(i, 0)], number: samplerNumber, From 06f4d0395b5bc1da8f92641778e2c7ea858db19d Mon Sep 17 00:00:00 2001 From: be_ Date: Mon, 13 Mar 2017 18:22:10 -0500 Subject: [PATCH 08/34] Components: support alternate color for looping SamplerButton --- res/controllers/midi-components-0.0.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/res/controllers/midi-components-0.0.js b/res/controllers/midi-components-0.0.js index 0194c1fbbb13..15fed12193c5 100644 --- a/res/controllers/midi-components-0.0.js +++ b/res/controllers/midi-components-0.0.js @@ -284,23 +284,35 @@ engine.setValue(this.group, 'play', 0); } else { engine.setValue(this.group, 'eject', 1); + engine.beginTimer(225, function () { + engine.setValue(this.group, 'eject', 0); + }, true); } } }; }, output: function (value, group, control) { if (engine.getValue(this.group, 'track_loaded') === 1) { - if (this.playing === undefined) { + if (this.loaded === undefined) { this.send(this.on); } else { if (engine.getValue(this.group, 'play') === 1) { - this.send(this.on); + if (this.looping !== undefined && + engine.getValue(this.group, 'repeat') === 1) { + this.send(this.looping); + } else { + this.send(this.playing); + } } else { - this.send(this.playing); + this.send(this.loaded); } } } else { - this.send(this.off); + if (this.empty === undefined) { + this.send(this.off); + } else { + this.send(this.empty); + } } }, connect: function() { @@ -308,6 +320,9 @@ if (this.playing !== undefined) { this.connections[1] = engine.connectControl(this.group, 'play', this.output); } + if (this.looping !== undefined) { + this.connections[2] = engine.connectControl(this.group, 'repeat', this.output); + } }, outKey: null, // hack to get Component constructor to call connect() }); From ddcd4a997182eaec39a0d490cca8465c01a71417 Mon Sep 17 00:00:00 2001 From: be_ Date: Mon, 13 Mar 2017 18:22:36 -0500 Subject: [PATCH 09/34] Hercules P32: make looping sampler pads purple --- res/controllers/Hercules-P32-scripts.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index 6594eabc8339..b3e6e868cec6 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -210,9 +210,10 @@ P32.Deck = function (deckNumbers, channel) { this.samplerButton[samplerNumber] = new components.SamplerButton({ midi: [0x90 + channel, P32.PadNumToMIDIControl(i, 0)], number: samplerNumber, - on: P32.padColors.red, - off: P32.padColors.off, - playing: P32.padColors.blue + empty: P32.padColors.off, + loaded: P32.padColors.red, + playing: P32.padColors.blue, + looping: P32.padColors.purple, }); if (samplerCrossfaderAssign) { engine.setValue('[Sampler' + samplerNumber + ']', From 589bfcc10ca930d12a82d5f85b20220502853cd5 Mon Sep 17 00:00:00 2001 From: be_ Date: Fri, 17 Mar 2017 12:18:01 -0500 Subject: [PATCH 10/34] Hercules P32: rearrange effect unit assignment buttons following the redesign of Deere, effect unit assignment buttons are associated with decks --- res/controllers/Hercules P32 DJ.midi.xml | 384 +++++++---------------- res/controllers/Hercules-P32-scripts.js | 57 +++- 2 files changed, 161 insertions(+), 280 deletions(-) diff --git a/res/controllers/Hercules P32 DJ.midi.xml b/res/controllers/Hercules P32 DJ.midi.xml index 41c5ab635d3b..0fe5fa6842a8 100644 --- a/res/controllers/Hercules P32 DJ.midi.xml +++ b/res/controllers/Hercules P32 DJ.midi.xml @@ -530,270 +530,198 @@ [Channel1] - P32.leftDeck.effectUnit.enableOnChannelButtons.Channel1.input - 0x91 - 0x40 + P32.leftDeck.loopMoveEncoder + 0xB4 + 0x0A [Channel1] - P32.leftDeck.effectUnit.enableOnChannelButtons.Channel1.input - 0x94 - 0x40 + P32.leftDeck.play.input + 0x91 + 0x0A [Channel1] - P32.leftDeck.effectUnit.enableOnChannelButtons.Channel2.input + P32.leftDeck.cue.input 0x91 - 0x41 + 0x09 [Channel1] - P32.leftDeck.effectUnit.enableOnChannelButtons.Channel2.input + P32.leftDeck.cue.input 0x94 - 0x41 - - - - - - [Channel1] - P32.leftDeck.effectUnit.enableOnChannelButtons.Channel3.input - 0x91 - 0x42 + 0x09 [Channel1] - P32.leftDeck.effectUnit.enableOnChannelButtons.Channel3.input + P32.leftDeck.play.input 0x94 - 0x42 + 0x0A [Channel1] - P32.leftDeck.effectUnit.enableOnChannelButtons.Channel4.input + P32.leftDeck.sync.input 0x91 - 0x43 + 0x08 [Channel1] - P32.leftDeck.effectUnit.enableOnChannelButtons.Channel4.input + P32.leftDeck.sync.input 0x94 - 0x43 - - - - - - [Channel1] - P32.leftDeck.effectUnit.enableOnChannelButtons.Headphone.input - 0x91 - 0x34 + 0x08 [Channel1] - P32.leftDeck.effectUnit.enableOnChannelButtons.Master.input + P32.leftDeck.tempSlow.input 0x91 - 0x35 + 0x44 [Channel1] - P32.leftDeck.effectUnit.enableOnChannelButtons.Microphone.input - 0x91 - 0x36 + P32.leftDeck.tempSlow.input + 0x94 + 0x44 [Channel1] - P32.leftDeck.effectUnit.enableOnChannelButtons.Auxiliary1.input + P32.leftDeck.tempFast.input 0x91 - 0x37 - - - - - - [Channel1] - P32.leftDeck.effectUnit.enableOnChannelButtons.Headphone.input - 0x94 - 0x34 + 0x45 [Channel1] - P32.leftDeck.effectUnit.enableOnChannelButtons.Master.input + P32.leftDeck.tempFast.input 0x94 - 0x35 + 0x45 [Channel1] - P32.leftDeck.effectUnit.enableOnChannelButtons.Microphone.input - 0x94 - 0x36 + P32.leftDeck.alignBeats.input + 0x91 + 0x46 [Channel1] - P32.leftDeck.effectUnit.enableOnChannelButtons.Auxiliary1.input + P32.leftDeck.alignBeats.input 0x94 - 0x37 - - - - - - [Channel1] - P32.leftDeck.loopMoveEncoder - 0xB4 - 0x0A + 0x46 [Channel1] - P32.leftDeck.play.input + P32.leftDeck.quantize.input 0x91 - 0x0A + 0x47 [Channel1] - P32.leftDeck.cue.input + P32.leftDeck.enableEffectUnitButtons[1].input 0x91 - 0x09 - - - - - - [Channel1] - P32.leftDeck.cue.input - 0x94 - 0x09 + 0x40 [Channel1] - P32.leftDeck.play.input + P32.leftDeck.enableEffectUnitButtons[1].input 0x94 - 0x0A + 0x40 [Channel1] - P32.leftDeck.sync.input + P32.leftDeck.enableEffectUnitButtons[2].input 0x91 - 0x08 + 0x41 [Channel1] - P32.leftDeck.sync.input + P32.leftDeck.enableEffectUnitButtons[2].input 0x94 - 0x08 - - - - - - [Channel1] - P32.leftDeck.tempSlow.input - 0x91 - 0x44 + 0x41 [Channel1] - P32.leftDeck.tempSlow.input + P32.leftDeck.enableEffectUnitButtons[3].input 0x94 - 0x44 + 0x42 [Channel1] - P32.leftDeck.tempFast.input + P32.leftDeck.enableEffectUnitButtons[3].input 0x91 - 0x45 - - - - - - [Channel1] - P32.leftDeck.tempFast.input - 0x94 - 0x45 + 0x42 [Channel1] - P32.leftDeck.alignBeats.input + P32.leftDeck.enableEffectUnitButtons[4].input 0x91 - 0x46 + 0x43 [Channel1] - P32.leftDeck.alignBeats.input + P32.leftDeck.enableEffectUnitButtons[4].input 0x94 - 0x46 - - - - - - [Channel1] - P32.leftDeck.quantize.input - 0x91 - 0x47 + 0x43 @@ -1690,150 +1618,6 @@ - - [Channel1] - P32.rightDeck.effectUnit.enableOnChannelButtons.Headphone.input - 0x92 - 0x34 - - - - - - [Channel1] - P32.rightDeck.effectUnit.enableOnChannelButtons.Master.input - 0x92 - 0x35 - - - - - - [Channel1] - P32.rightDeck.effectUnit.enableOnChannelButtons.Microphone.input - 0x92 - 0x36 - - - - - - [Channel1] - P32.rightDeck.effectUnit.enableOnChannelButtons.Auxiliary1.input - 0x92 - 0x37 - - - - - - [Channel1] - P32.rightDeck.effectUnit.enableOnChannelButtons.Headphone.input - 0x95 - 0x34 - - - - - - [Channel1] - P32.rightDeck.effectUnit.enableOnChannelButtons.Master.input - 0x95 - 0x35 - - - - - - [Channel1] - P32.rightDeck.effectUnit.enableOnChannelButtons.Microphone.input - 0x95 - 0x36 - - - - - - [Channel1] - P32.rightDeck.effectUnit.enableOnChannelButtons.Auxiliary1.input - 0x95 - 0x37 - - - - - - [Channel1] - P32.rightDeck.effectUnit.enableOnChannelButtons.Channel1.input - 0x92 - 0x40 - - - - - - [Channel1] - P32.rightDeck.effectUnit.enableOnChannelButtons.Channel1.input - 0x95 - 0x40 - - - - - - [Channel1] - P32.rightDeck.effectUnit.enableOnChannelButtons.Channel2.input - 0x92 - 0x41 - - - - - - [Channel1] - P32.rightDeck.effectUnit.enableOnChannelButtons.Channel2.input - 0x95 - 0x41 - - - - - - [Channel1] - P32.rightDeck.effectUnit.enableOnChannelButtons.Channel3.input - 0x92 - 0x42 - - - - - - [Channel1] - P32.rightDeck.effectUnit.enableOnChannelButtons.Channel3.input - 0x95 - 0x42 - - - - - - [Channel1] - P32.rightDeck.effectUnit.enableOnChannelButtons.Channel4.input - 0x92 - 0x43 - - - - - - [Channel1] - P32.rightDeck.effectUnit.enableOnChannelButtons.Channel4.input - 0x95 - 0x43 - - - - [Channel1] P32.leftDeck.samplerButton[1].input @@ -2536,6 +2320,78 @@ + + [Channel1] + P32.rightDeck.enableEffectUnitButtons[1].input + 0x92 + 0x40 + + + + + + [Channel1] + P32.rightDeck.enableEffectUnitButtons[1].input + 0x95 + 0x40 + + + + + + [Channel1] + P32.rightDeck.enableEffectUnitButtons[2].input + 0x92 + 0x41 + + + + + + [Channel1] + P32.rightDeck.enableEffectUnitButtons[2].input + 0x95 + 0x41 + + + + + + [Channel1] + P32.rightDeck.enableEffectUnitButtons[3].input + 0x92 + 0x42 + + + + + + [Channel1] + P32.rightDeck.enableEffectUnitButtons[3].input + 0x95 + 0x42 + + + + + + [Channel1] + P32.rightDeck.enableEffectUnitButtons[4].input + 0x92 + 0x43 + + + + + + [Channel1] + P32.rightDeck.enableEffectUnitButtons[4].input + 0x95 + 0x43 + + + + diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index b3e6e868cec6..6741a8736e11 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -7,6 +7,8 @@ var loopEnabledDot = false; // Assign samplers on left side of the controller to left side of the crossfader // and samplers on right side of the controller to the right side of the crossfader var samplerCrossfaderAssign = true; +// Toggle the effect units to control effect units 3/4 when toggling decks +var toggleEffectUnits = false; /** * Hercules P32 DJ controller script for Mixxx 2.1 @@ -113,10 +115,20 @@ P32.slipButton = new components.Button({ pressedToToggleDeck: false, input: function (channel, control, value, status, group) { if (P32.leftDeck.isShifted && value === 127) { + // PFL button is controlling effect unit assignment to headphones while + // shift is pressed, so switch it back to controlling PFL so + // reconnecting the output works. + P32.leftDeck.pfl.unshift(); P32.leftDeck.toggle(); + P32.leftDeck.effectUnit.toggle(); this.pressedToToggleDeck = true; } else if (P32.rightDeck.isShifted && value === 127) { + // PFL button is controlling effect unit assignment to headphones while + // shift is pressed, so switch it back to controlling PFL so + // reconnecting the output works. + P32.rightDeck.pfl.unshift(); P32.rightDeck.toggle(); + P32.rightDeck.effectUnit.toggle(); this.pressedToToggleDeck = true; } else { if (this.pressedToToggleDeck && value === 0) { @@ -180,8 +192,16 @@ P32.Deck = function (deckNumbers, channel) { this.pfl = new components.Button({ midi: [0x90 + channel, 0x10], - key: 'pfl', sendShifted: false, + unshift: function () { + this.group = theDeck.currentDeck; + this.inKey = 'pfl'; + }, + outKey: 'pfl', + shift: function () { + this.group = '[EffectRack1_EffectUnit' + theDeck.effectUnit.currentUnitNumber + ']'; + this.inKey = 'group_[Headphones]_enable'; + }, }); this.volume = new components.Pot({ @@ -202,11 +222,11 @@ P32.Deck = function (deckNumbers, channel) { number: i, on: P32.padColors.red }); + var row = Math.ceil(i/4); var column = ((i-1) % 4) + 1; var padGrid = channel - 1; var samplerNumber = (8 * (row-1)) + (column) + (padGrid * 4); - // Math.ceil(i/4) + (i + (channel - 1) * 4 this.samplerButton[samplerNumber] = new components.SamplerButton({ midi: [0x90 + channel, P32.PadNumToMIDIControl(i, 0)], number: samplerNumber, @@ -263,6 +283,17 @@ P32.Deck = function (deckNumbers, channel) { this.tempFast.send(P32.padColors.purple); this.alignBeats.send(P32.padColors.blue); + this.enableEffectUnitButtons = new components.ComponentContainer(); //fii + for (var u = 1; u <= 4; u++) { + this.enableEffectUnitButtons[u] = new components.EffectAssignmentButton({ + midi: [0x90 + channel, 0x40 - 1 + u], + effectUnit: u, + group: this.currentDeck, + on: P32.padColors.red, + off: P32.padColors.blue, + }); + } + // =================================== ENCODERS ============================================== this.loopSizeEncoder = new components.Encoder({ midi: [0xB0 + channel, 0x1B], // Note: these are the MIDI bytes for the digit LEDs, not @@ -406,8 +437,14 @@ P32.Deck = function (deckNumbers, channel) { } }); - // ==================================== EFFECTS ============================================== - this.effectUnit = new components.EffectUnit(deckNumbers[0]); + // ================================= EFFECTS ===================================== + var unitNumbers; + if (toggleEffectUnits) { + unitNumbers = deckNumbers; + } else { + unitNumbers = deckNumbers[0]; + } + this.effectUnit = new components.EffectUnit(unitNumbers); this.effectUnit.knobs[1].midi = [0xB0 + channel, 0x06]; this.effectUnit.knobs[2].midi = [0xB0 + channel, 0x07]; this.effectUnit.knobs[3].midi = [0xB0 + channel, 0x08]; @@ -416,18 +453,6 @@ P32.Deck = function (deckNumbers, channel) { this.effectUnit.enableButtons[2].midi = [0x90 + channel, 0x04]; this.effectUnit.enableButtons[3].midi = [0x90 + channel, 0x05]; this.effectUnit.showParametersButton.midi = [0x90 + channel, 0x06]; - this.effectUnit.enableOnChannelButtons.Channel1.midi = [0x90 + channel, 0x40]; - this.effectUnit.enableOnChannelButtons.Channel2.midi = [0x90 + channel, 0x41]; - this.effectUnit.enableOnChannelButtons.Channel3.midi = [0x90 + channel, 0x42]; - this.effectUnit.enableOnChannelButtons.Channel4.midi = [0x90 + channel, 0x43]; - this.effectUnit.enableOnChannelButtons.Headphone.midi = [0x90 + channel, 0x34]; - this.effectUnit.enableOnChannelButtons.Master.midi = [0x90 + channel, 0x35]; - this.effectUnit.enableOnChannelButtons.Microphone.midi = [0x90 + channel, 0x36]; - this.effectUnit.enableOnChannelButtons.Auxiliary1.midi = [0x90 + channel, 0x37]; - this.effectUnit.enableOnChannelButtons.forEachComponent(function (button) { - button.on = P32.padColors.red; - button.off = P32.padColors.blue; - }); this.effectUnit.init(); }; P32.Deck.prototype = new components.Deck(); From b4291ca6c39a556be6baab3f2d7967c0a0ce6f25 Mon Sep 17 00:00:00 2001 From: be_ Date: Fri, 17 Mar 2017 18:23:26 -0500 Subject: [PATCH 11/34] Hercules P32: use new Components EffectUnit API --- res/controllers/Hercules P32 DJ.midi.xml | 8 ++++---- res/controllers/Hercules-P32-scripts.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/res/controllers/Hercules P32 DJ.midi.xml b/res/controllers/Hercules P32 DJ.midi.xml index 0fe5fa6842a8..12114142e9f8 100644 --- a/res/controllers/Hercules P32 DJ.midi.xml +++ b/res/controllers/Hercules P32 DJ.midi.xml @@ -485,7 +485,7 @@ [Channel1] - P32.leftDeck.effectUnit.showParametersButton.input + P32.leftDeck.effectUnit.effectFocusButton.input 0x91 0x06 @@ -521,7 +521,7 @@ [Channel1] - P32.leftDeck.effectUnit.showParametersButton.input + P32.leftDeck.effectUnit.effectFocusButton.input 0x94 0x06 @@ -1575,7 +1575,7 @@ [Channel1] - P32.rightDeck.effectUnit.showParametersButton.input + P32.rightDeck.effectUnit.effectFocusButton.input 0x92 0x06 @@ -1611,7 +1611,7 @@ [Channel1] - P32.rightDeck.effectUnit.showParametersButton.input + P32.rightDeck.effectUnit.effectFocusButton.input 0x95 0x06 diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index 6741a8736e11..884d91ca7910 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -452,7 +452,7 @@ P32.Deck = function (deckNumbers, channel) { this.effectUnit.enableButtons[1].midi = [0x90 + channel, 0x03]; this.effectUnit.enableButtons[2].midi = [0x90 + channel, 0x04]; this.effectUnit.enableButtons[3].midi = [0x90 + channel, 0x05]; - this.effectUnit.showParametersButton.midi = [0x90 + channel, 0x06]; + this.effectUnit.effectFocusButton.midi = [0x90 + channel, 0x06]; this.effectUnit.init(); }; P32.Deck.prototype = new components.Deck(); From 59e5bd08cc5a8eb6f7af3ef2e635dff39bc5304c Mon Sep 17 00:00:00 2001 From: be_ Date: Sat, 18 Mar 2017 20:51:44 -0500 Subject: [PATCH 12/34] Hercules P32: remove option to toggle effect units with decks now that Components supports shift + effectFocusButton to toggle EffectUnits --- res/controllers/Hercules P32 DJ.midi.xml | 16 ++++---- res/controllers/Hercules-P32-scripts.js | 49 ++++++++++++++---------- 2 files changed, 37 insertions(+), 28 deletions(-) diff --git a/res/controllers/Hercules P32 DJ.midi.xml b/res/controllers/Hercules P32 DJ.midi.xml index 12114142e9f8..56002f17cb21 100644 --- a/res/controllers/Hercules P32 DJ.midi.xml +++ b/res/controllers/Hercules P32 DJ.midi.xml @@ -694,7 +694,7 @@ [Channel1] P32.leftDeck.enableEffectUnitButtons[3].input 0x94 - 0x42 + 0x3C @@ -703,7 +703,7 @@ [Channel1] P32.leftDeck.enableEffectUnitButtons[3].input 0x91 - 0x42 + 0x3C @@ -712,7 +712,7 @@ [Channel1] P32.leftDeck.enableEffectUnitButtons[4].input 0x91 - 0x43 + 0x3D @@ -721,7 +721,7 @@ [Channel1] P32.leftDeck.enableEffectUnitButtons[4].input 0x94 - 0x43 + 0x3D @@ -2360,7 +2360,7 @@ [Channel1] P32.rightDeck.enableEffectUnitButtons[3].input 0x92 - 0x42 + 0x3C @@ -2369,7 +2369,7 @@ [Channel1] P32.rightDeck.enableEffectUnitButtons[3].input 0x95 - 0x42 + 0x3C @@ -2378,7 +2378,7 @@ [Channel1] P32.rightDeck.enableEffectUnitButtons[4].input 0x92 - 0x43 + 0x3D @@ -2387,7 +2387,7 @@ [Channel1] P32.rightDeck.enableEffectUnitButtons[4].input 0x95 - 0x43 + 0x3D diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index 884d91ca7910..0a772c1f7efc 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -7,8 +7,6 @@ var loopEnabledDot = false; // Assign samplers on left side of the controller to left side of the crossfader // and samplers on right side of the controller to the right side of the crossfader var samplerCrossfaderAssign = true; -// Toggle the effect units to control effect units 3/4 when toggling decks -var toggleEffectUnits = false; /** * Hercules P32 DJ controller script for Mixxx 2.1 @@ -120,7 +118,6 @@ P32.slipButton = new components.Button({ // reconnecting the output works. P32.leftDeck.pfl.unshift(); P32.leftDeck.toggle(); - P32.leftDeck.effectUnit.toggle(); this.pressedToToggleDeck = true; } else if (P32.rightDeck.isShifted && value === 127) { // PFL button is controlling effect unit assignment to headphones while @@ -128,7 +125,6 @@ P32.slipButton = new components.Button({ // reconnecting the output works. P32.rightDeck.pfl.unshift(); P32.rightDeck.toggle(); - P32.rightDeck.effectUnit.toggle(); this.pressedToToggleDeck = true; } else { if (this.pressedToToggleDeck && value === 0) { @@ -284,15 +280,34 @@ P32.Deck = function (deckNumbers, channel) { this.alignBeats.send(P32.padColors.blue); this.enableEffectUnitButtons = new components.ComponentContainer(); //fii - for (var u = 1; u <= 4; u++) { - this.enableEffectUnitButtons[u] = new components.EffectAssignmentButton({ - midi: [0x90 + channel, 0x40 - 1 + u], - effectUnit: u, - group: this.currentDeck, - on: P32.padColors.red, - off: P32.padColors.blue, - }); - } + this.enableEffectUnitButtons[1] = new components.EffectAssignmentButton({ + midi: [0x90 + channel, 0x40], + effectUnit: 1, + group: this.currentDeck, + on: P32.padColors.blue, + off: P32.padColors.red, + }); + this.enableEffectUnitButtons[2] = new components.EffectAssignmentButton({ + midi: [0x90 + channel, 0x41], + effectUnit: 2, + group: this.currentDeck, + on: P32.padColors.blue, + off: P32.padColors.red, + }); + this.enableEffectUnitButtons[3] = new components.EffectAssignmentButton({ + midi: [0x90 + channel, 0x3C], + effectUnit: 3, + group: this.currentDeck, + on: P32.padColors.blue, + off: P32.padColors.red, + }); + this.enableEffectUnitButtons[4] = new components.EffectAssignmentButton({ + midi: [0x90 + channel, 0x3D], + effectUnit: 4, + group: this.currentDeck, + on: P32.padColors.blue, + off: P32.padColors.red, + }); // =================================== ENCODERS ============================================== this.loopSizeEncoder = new components.Encoder({ @@ -438,13 +453,7 @@ P32.Deck = function (deckNumbers, channel) { }); // ================================= EFFECTS ===================================== - var unitNumbers; - if (toggleEffectUnits) { - unitNumbers = deckNumbers; - } else { - unitNumbers = deckNumbers[0]; - } - this.effectUnit = new components.EffectUnit(unitNumbers); + this.effectUnit = new components.EffectUnit(deckNumbers); this.effectUnit.knobs[1].midi = [0xB0 + channel, 0x06]; this.effectUnit.knobs[2].midi = [0xB0 + channel, 0x07]; this.effectUnit.knobs[3].midi = [0xB0 + channel, 0x08]; From 35803608362ab569394951a581300f4fc57073b1 Mon Sep 17 00:00:00 2001 From: be_ Date: Sun, 19 Mar 2017 19:37:32 -0500 Subject: [PATCH 13/34] Hercules P32: revert to using loop_halve and loop_double Now that they do not adjust beatloop_size out of sync with the actual loop size --- res/controllers/Hercules-P32-scripts.js | 40 +++++++++++-------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index 0a772c1f7efc..85f5ade944fe 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -317,32 +317,28 @@ P32.Deck = function (deckNumbers, channel) { var loopSize = engine.getValue(this.group, 'beatloop_size'); if (loopEnabledDot) { if (value > 64 && loopSize > 2) { // turn left - /** - Unfortunately, there is no way to show 1 with a dot on the - loop size LED. - **/ - engine.setValue(this.group, 'beatloop_size', loopSize / 2); + // Unfortunately, there is no way to show 1 with a dot on the + // loop size LED. + engine.setValue(this.group, 'loop_halve', 1); + engine.setValue(this.group, 'loop_halve', 0); } else if (value < 64 && loopSize < 32) { // turn right - /** - Mixxx supports loops longer than 32 beats, but there is no way - to show 64 with a dot on the loop size LED. - **/ - engine.setValue(this.group, 'beatloop_size', loopSize * 2); + // Mixxx supports loops longer than 32 beats, but there is no way + // to show 64 with a dot on the loop size LED. + engine.setValue(this.group, 'loop_double', 1); + engine.setValue(this.group, 'loop_double', 0); } } else { if (value > 64 && loopSize > 1/32) { // turn left - /** - Mixxx supports loops shorter than 1/32 beats, but there is no - way to set the loop size LED less than 1/32 (even though it - should be able to show 1/64) - **/ - engine.setValue(this.group, 'beatloop_size', loopSize / 2); - } else if (value < 64 && loopSize < 64) { // turn right - /** - Mixxx supports loops longer than 64 beats, but the loop size LED - only has 2 digits, so it couldn't show 128 - **/ - engine.setValue(this.group, 'beatloop_size', loopSize * 2); + // Mixxx supports loops shorter than 1/32 beats, but there is no + // way to set the loop size LED less than 1/32 (even though it + // should be able to show 1/64). + engine.setValue(this.group, 'loop_halve', 1); + engine.setValue(this.group, 'loop_halve', 0); + } else if (value < 64) { // turn right + // Mixxx supports loops longer than 64 beats, but the loop size LED + // only has 2 digits, so it couldn't show 128 + engine.setValue(this.group, 'loop_double', 1); + engine.setValue(this.group, 'loop_double', 0); } } }, From 254d1ac170b774fd9a6c565733d924e04e56c33b Mon Sep 17 00:00:00 2001 From: be_ Date: Sun, 19 Mar 2017 19:38:21 -0500 Subject: [PATCH 14/34] Hercules P32: swap encoder mappings for right side I got confused many times because the encoders are labelled symmetrically but nothing else on the controller is. So make the entire deck asymmetrical. --- res/controllers/Hercules P32 DJ.midi.xml | 14 +++++++------- res/controllers/Hercules-P32-scripts.js | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/res/controllers/Hercules P32 DJ.midi.xml b/res/controllers/Hercules P32 DJ.midi.xml index 56002f17cb21..3215b481fd67 100644 --- a/res/controllers/Hercules P32 DJ.midi.xml +++ b/res/controllers/Hercules P32 DJ.midi.xml @@ -946,7 +946,7 @@ [Channel1] P32.rightDeck.loopMoveEncoder 0xB5 - 0x0A + 0x05 @@ -1018,7 +1018,7 @@ [Channel1] P32.rightDeck.tempoEncoder 0xB2 - 0x05 + 0x0A @@ -1036,7 +1036,7 @@ [Channel1] P32.rightDeck.beatJumpEncoder 0xB5 - 0x05 + 0x0A @@ -1126,7 +1126,7 @@ [Channel1] P32.rightDeck.tempoEncoderPress 0x92 - 0x02 + 0x01 @@ -1153,7 +1153,7 @@ [Channel1] P32.rightDeck.loopToggleEncoderPress 0x92 - 0x01 + 0x02 @@ -1162,7 +1162,7 @@ [Channel1] P32.rightDeck.beatJumpEncoderPress 0x95 - 0x02 + 0x01 @@ -1180,7 +1180,7 @@ [Channel1] P32.rightDeck.loopSizeEncoder.input 0xB2 - 0x0A + 0x05 diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index 85f5ade944fe..d33a34def6a1 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -365,7 +365,7 @@ P32.Deck = function (deckNumbers, channel) { }); this.loopMoveEncoder = function (channel, control, value, status, group) { - if (value < 64) { // left turn + if (value > 64) { // left turn engine.setValue(this.currentDeck, 'loop_move_backward', 1); } else { // right turn engine.setValue(this.currentDeck, 'loop_move_forward', 1); From c51046258bfcbe7596c4673e62dda5f968d34d11 Mon Sep 17 00:00:00 2001 From: be_ Date: Fri, 24 Mar 2017 13:57:41 -0500 Subject: [PATCH 15/34] Hercules P32: rework loop pad mode and pressing loop encoder --- res/controllers/Hercules P32 DJ.midi.xml | 20 ++++----- res/controllers/Hercules-P32-scripts.js | 54 ++++++++++++++++++------ 2 files changed, 50 insertions(+), 24 deletions(-) diff --git a/res/controllers/Hercules P32 DJ.midi.xml b/res/controllers/Hercules P32 DJ.midi.xml index 3215b481fd67..b05dbaa61e34 100644 --- a/res/controllers/Hercules P32 DJ.midi.xml +++ b/res/controllers/Hercules P32 DJ.midi.xml @@ -61,7 +61,7 @@ [Channel1] - P32.leftDeck.loopTogglePad.input + P32.leftDeck.reloop.input 0x91 0x52 @@ -88,7 +88,7 @@ [Channel1] - P32.leftDeck.loopTogglePad.input + P32.leftDeck.reloop.input 0x94 0x52 @@ -649,7 +649,7 @@ [Channel1] P32.leftDeck.quantize.input 0x91 - 0x47 + 0x4B @@ -730,7 +730,7 @@ [Channel1] P32.leftDeck.quantize.input 0x94 - 0x47 + 0x4B @@ -926,7 +926,7 @@ [Channel1] - P32.leftDeck.loopEncoderManualLoopPress + P32.leftDeck.loopEncoderShiftPress 0x94 0x01 @@ -1169,7 +1169,7 @@ [Channel1] - P32.rightDeck.loopEncoderManualLoopPress + P32.rightDeck.loopEncoderShiftPress 0x95 0x01 @@ -2214,7 +2214,7 @@ [Channel1] - P32.rightDeck.loopTogglePad.input + P32.rightDeck.reloop.input 0x92 0x52 @@ -2241,7 +2241,7 @@ [Channel1] - P32.rightDeck.loopTogglePad.input + P32.rightDeck.reloop.input 0x95 0x52 @@ -2306,7 +2306,7 @@ [Channel1] P32.rightDeck.quantize.input 0x92 - 0x47 + 0x4B @@ -2315,7 +2315,7 @@ [Channel1] P32.rightDeck.quantize.input 0x95 - 0x47 + 0x4B diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index d33a34def6a1..b9757356c7f3 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -241,43 +241,59 @@ P32.Deck = function (deckNumbers, channel) { this.loopIn = new components.Button({ midi: [0x90 + channel, 0x50], - inKey: 'loop_in', + key: 'loop_in', + onlyOnPress: false, + on: P32.padColors.red, + off: P32.padColors.purple, }); this.loopOut = new components.Button({ midi: [0x90 + channel, 0x51], - inKey: 'loop_out', + key: 'loop_out', + onlyOnPress: false, + on: P32.padColors.red, + off: P32.padColors.purple, }); - this.loopTogglePad = new components.LoopToggleButton({ + this.reloop = new components.Button({ midi: [0x90 + channel, 0x52], + unshift: function () { + this.inKey = 'reloop_toggle'; + }, + shift: function () { + this.inKey = 'reloop_cue'; + }, + onlyOnPress: false, on: P32.padColors.red, off: P32.padColors.blue, + outKey: 'loop_enabled', }); - this.loopIn.send(P32.padColors.purple); - this.loopOut.send(P32.padColors.purple); this.tempSlow = new components.Button({ midi: [0x90 + channel, 0x44], - inKey: 'rate_temp_down', + key: 'rate_temp_down', onlyOnPress: false, + on: P32.padColors.red, + off: P32.padColors.purple, }); this.tempFast = new components.Button({ midi: [0x90 + channel, 0x45], - inKey: 'rate_temp_up', + key: 'rate_temp_up', onlyOnPress: false, + on: P32.padColors.red, + off: P32.padColors.purple, }); this.alignBeats = new components.Button({ midi: [0x90 + channel, 0x46], - inKey: 'beats_translate_curpos', + key: 'beats_translate_curpos', + onlyOnPress: false, + on: P32.padColors.red, + off: P32.padColors.blue, }); this.quantize = new components.Button({ - midi: [0x90 + channel, 0x47], + midi: [0x90 + channel, 0x4B], key: 'quantize', on: P32.padColors.red, off: P32.padColors.blue, }); - this.tempSlow.send(P32.padColors.purple); - this.tempFast.send(P32.padColors.purple); - this.alignBeats.send(P32.padColors.blue); this.enableEffectUnitButtons = new components.ComponentContainer(); //fii this.enableEffectUnitButtons[1] = new components.EffectAssignmentButton({ @@ -367,8 +383,14 @@ P32.Deck = function (deckNumbers, channel) { this.loopMoveEncoder = function (channel, control, value, status, group) { if (value > 64) { // left turn engine.setValue(this.currentDeck, 'loop_move_backward', 1); + engine.beginTimer(200, function () { + engine.setValue(this.currentDeck, 'loop_move_backward', 0); + }, true); } else { // right turn engine.setValue(this.currentDeck, 'loop_move_forward', 1); + engine.beginTimer(200, function () { + engine.setValue(this.currentDeck, 'loop_move_forward', 0); + }, true); } }; @@ -376,8 +398,12 @@ P32.Deck = function (deckNumbers, channel) { engine.setValue(this.currentDeck, 'loopauto_toggle', value / 127); }; - this.loopEncoderManualLoopPress = function (channel, control, value, status, group) { - engine.setValue(this.currentDeck, 'loopmanual_toggle', value / 127); + this.loopEncoderShiftPress = function (channel, control, value, status, group) { + if (engine.getValue(this.currentDeck, 'loop_enabled') === 1) { + engine.setValue(this.currentDeck, 'reloop_cue', value / 127); + } else { + engine.setValue(this.currentDeck, 'reloop_toggle', value / 127); + } }; this.tempoEncoder = function (channel, control, value, status, group) { From 6e94057b91637c2f8b61e09122130e740cb5106e Mon Sep 17 00:00:00 2001 From: be_ Date: Sat, 25 Mar 2017 18:33:05 -0500 Subject: [PATCH 16/34] Hercules P32: use new reloop CO for shift + loop encoder press --- res/controllers/Hercules-P32-scripts.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index b9757356c7f3..210bce336ae0 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -399,11 +399,7 @@ P32.Deck = function (deckNumbers, channel) { }; this.loopEncoderShiftPress = function (channel, control, value, status, group) { - if (engine.getValue(this.currentDeck, 'loop_enabled') === 1) { - engine.setValue(this.currentDeck, 'reloop_cue', value / 127); - } else { - engine.setValue(this.currentDeck, 'reloop_toggle', value / 127); - } + engine.setValue(this.currentDeck, 'reloop', value / 127); }; this.tempoEncoder = function (channel, control, value, status, group) { From d631d2a54c79d7f5f3c1190a1b13ab3f3a2ee53d Mon Sep 17 00:00:00 2001 From: be_ Date: Mon, 3 Apr 2017 00:05:47 -0500 Subject: [PATCH 17/34] Hercules P32: fix display of beatjump_size on controller --- res/controllers/Hercules-P32-scripts.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index 210bce336ae0..42af5745ffaf 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -417,10 +417,11 @@ P32.Deck = function (deckNumbers, channel) { var beatJumpSize = engine.getValue(this.currentDeck, 'beatjump_size'); if (this.beatJumpEncoderPressed) { if (value > 64 && beatJumpSize > 1/32) { // turn left - engine.setValue(this.currentDeck, 'beatjump_size', beatJumpSize / 2); + beatJumpSize /= 2; } else if (value < 64 && beatJumpSize < 64) { // turn right - engine.setValue(this.currentDeck, 'beatjump_size', beatJumpSize * 2); + beatJumpSize *= 2; } + engine.setValue(this.currentDeck, 'beatjump_size', beatJumpSize); // The firmware will only change the numeric LED readout when sent messages // on the unshifted channel. midi.sendShortMsg(0xB0 + channel - P32.shiftOffset, 0x1B, 5 + Math.log(beatJumpSize) / Math.log(2)); From 900dfc18df04a5e8137fd26923bec381c6bbb94d Mon Sep 17 00:00:00 2001 From: be_ Date: Fri, 7 Apr 2017 11:40:25 -0500 Subject: [PATCH 18/34] Hercules P32: replace loopauto_toggle with beatloop_toggle --- res/controllers/Hercules-P32-scripts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index 42af5745ffaf..cc79a8327be1 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -395,7 +395,7 @@ P32.Deck = function (deckNumbers, channel) { }; this.loopToggleEncoderPress = function (channel, control, value, status, group) { - engine.setValue(this.currentDeck, 'loopauto_toggle', value / 127); + engine.setValue(this.currentDeck, 'beatloop_toggle', value / 127); }; this.loopEncoderShiftPress = function (channel, control, value, status, group) { From 71b206c38630a6fb7c4918b1ba5c6b33aa08abfc Mon Sep 17 00:00:00 2001 From: be_ Date: Wed, 12 Apr 2017 19:20:46 -0500 Subject: [PATCH 19/34] Hercules P32: use new beatloop_halve/double COs and remove reloop CO which was removed from PR #1187 --- res/controllers/Hercules P32 DJ.midi.xml | 2 +- res/controllers/Hercules-P32-scripts.js | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/res/controllers/Hercules P32 DJ.midi.xml b/res/controllers/Hercules P32 DJ.midi.xml index b05dbaa61e34..093f80a44b25 100644 --- a/res/controllers/Hercules P32 DJ.midi.xml +++ b/res/controllers/Hercules P32 DJ.midi.xml @@ -1171,7 +1171,7 @@ [Channel1] P32.rightDeck.loopEncoderShiftPress 0x95 - 0x01 + 0x02 diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index cc79a8327be1..e622d67537f9 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -335,26 +335,26 @@ P32.Deck = function (deckNumbers, channel) { if (value > 64 && loopSize > 2) { // turn left // Unfortunately, there is no way to show 1 with a dot on the // loop size LED. - engine.setValue(this.group, 'loop_halve', 1); - engine.setValue(this.group, 'loop_halve', 0); + engine.setValue(this.group, 'beatloop_halve', 1); + engine.setValue(this.group, 'beatloop_halve', 0); } else if (value < 64 && loopSize < 32) { // turn right // Mixxx supports loops longer than 32 beats, but there is no way // to show 64 with a dot on the loop size LED. - engine.setValue(this.group, 'loop_double', 1); - engine.setValue(this.group, 'loop_double', 0); + engine.setValue(this.group, 'beatloop_double', 1); + engine.setValue(this.group, 'beatloop_double', 0); } } else { if (value > 64 && loopSize > 1/32) { // turn left // Mixxx supports loops shorter than 1/32 beats, but there is no // way to set the loop size LED less than 1/32 (even though it // should be able to show 1/64). - engine.setValue(this.group, 'loop_halve', 1); - engine.setValue(this.group, 'loop_halve', 0); + engine.setValue(this.group, 'beatloop_halve', 1); + engine.setValue(this.group, 'beatloop_halve', 0); } else if (value < 64) { // turn right // Mixxx supports loops longer than 64 beats, but the loop size LED // only has 2 digits, so it couldn't show 128 - engine.setValue(this.group, 'loop_double', 1); - engine.setValue(this.group, 'loop_double', 0); + engine.setValue(this.group, 'beatloop_double', 1); + engine.setValue(this.group, 'beatloop_double', 0); } } }, @@ -399,7 +399,11 @@ P32.Deck = function (deckNumbers, channel) { }; this.loopEncoderShiftPress = function (channel, control, value, status, group) { - engine.setValue(this.currentDeck, 'reloop', value / 127); + if (engine.getValue(this.currentDeck, 'loop_enabled') === 1) { + engine.setValue(this.currentDeck, 'reloop_andstop', value / 127); + } else { + engine.setValue(this.currentDeck, 'reloop_toggle', value / 127); + } }; this.tempoEncoder = function (channel, control, value, status, group) { From 707484da0e76f7cbe7a04acf8968b7ca69cafea9 Mon Sep 17 00:00:00 2001 From: be_ Date: Sun, 7 May 2017 18:18:28 -0500 Subject: [PATCH 20/34] Hercules P32: use standard Components SyncButton functionality --- res/controllers/Hercules-P32-scripts.js | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index e622d67537f9..2812d93cddf2 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -36,18 +36,6 @@ P32.init = function () { components.Component.prototype.shiftChannel = true; components.Button.prototype.sendShifted = true; - /** - The P32 has encoders for changing tempo, so the actual tempo getting out of sync with a hardware - fader and dealing with soft takeover in that situation is not an issue. So, make toggling master - sync the default unshifted behavior and momentary sync the shifted behavior. - **/ - components.SyncButton.prototype.unshift = function () { - this.inKey = 'sync_enabled'; - }; - components.SyncButton.prototype.shift = function () { - this.inKey = 'beatsync'; - }; - if (engine.getValue('[Master]', 'num_samplers') < 32) { engine.setValue('[Master]', 'num_samplers', 32); } From 8a7cd71f9bca1116e1353ac4810d68f84f072eb5 Mon Sep 17 00:00:00 2001 From: be_ Date: Tue, 9 May 2017 22:08:48 -0500 Subject: [PATCH 21/34] Hercules P32: fix assignment of effect units to headphones --- res/controllers/Hercules-P32-scripts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index 2812d93cddf2..68042b01b2c2 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -184,7 +184,7 @@ P32.Deck = function (deckNumbers, channel) { outKey: 'pfl', shift: function () { this.group = '[EffectRack1_EffectUnit' + theDeck.effectUnit.currentUnitNumber + ']'; - this.inKey = 'group_[Headphones]_enable'; + this.inKey = 'group_[Headphone]_enable'; }, }); From 07b173d5d8554c75328a59faf3ffeaa558e1e323 Mon Sep 17 00:00:00 2001 From: be_ Date: Tue, 9 May 2017 22:09:05 -0500 Subject: [PATCH 22/34] Hercules P32: once again revert to loop_halve/double --- res/controllers/Hercules-P32-scripts.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index 68042b01b2c2..634e5b026abe 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -323,26 +323,26 @@ P32.Deck = function (deckNumbers, channel) { if (value > 64 && loopSize > 2) { // turn left // Unfortunately, there is no way to show 1 with a dot on the // loop size LED. - engine.setValue(this.group, 'beatloop_halve', 1); - engine.setValue(this.group, 'beatloop_halve', 0); + engine.setValue(this.group, 'loop_halve', 1); + engine.setValue(this.group, 'loop_halve', 0); } else if (value < 64 && loopSize < 32) { // turn right // Mixxx supports loops longer than 32 beats, but there is no way // to show 64 with a dot on the loop size LED. - engine.setValue(this.group, 'beatloop_double', 1); - engine.setValue(this.group, 'beatloop_double', 0); + engine.setValue(this.group, 'loop_double', 1); + engine.setValue(this.group, 'loop_double', 0); } } else { if (value > 64 && loopSize > 1/32) { // turn left // Mixxx supports loops shorter than 1/32 beats, but there is no // way to set the loop size LED less than 1/32 (even though it // should be able to show 1/64). - engine.setValue(this.group, 'beatloop_halve', 1); - engine.setValue(this.group, 'beatloop_halve', 0); + engine.setValue(this.group, 'loop_halve', 1); + engine.setValue(this.group, 'loop_halve', 0); } else if (value < 64) { // turn right // Mixxx supports loops longer than 64 beats, but the loop size LED // only has 2 digits, so it couldn't show 128 - engine.setValue(this.group, 'beatloop_double', 1); - engine.setValue(this.group, 'beatloop_double', 0); + engine.setValue(this.group, 'loop_double', 1); + engine.setValue(this.group, 'loop_double', 0); } } }, From ab2055f4343dcfd1fd9820483557bcaadc70df16 Mon Sep 17 00:00:00 2001 From: be_ Date: Sun, 14 May 2017 10:01:38 -0500 Subject: [PATCH 23/34] Hercules P32: use reloop_toggle on loop encoder press when looping beatloop_toggle no longer deactivates loops --- res/controllers/Hercules-P32-scripts.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index 634e5b026abe..95e34d30a97d 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -383,7 +383,15 @@ P32.Deck = function (deckNumbers, channel) { }; this.loopToggleEncoderPress = function (channel, control, value, status, group) { - engine.setValue(this.currentDeck, 'beatloop_toggle', value / 127); + if (value > 0) { + if (engine.getValue(this.currentDeck, 'loop_enabled') === 1) { + engine.setValue(this.currentDeck, 'reloop_toggle', 1); + engine.setValue(this.currentDeck, 'reloop_toggle', 0); + } else { + engine.setValue(this.currentDeck, 'beatloop_toggle', 1); + engine.setValue(this.currentDeck, 'beatloop_toggle', 0); + } + } }; this.loopEncoderShiftPress = function (channel, control, value, status, group) { From 3436353e387314287a083c438f53b176c7184c31 Mon Sep 17 00:00:00 2001 From: be_ Date: Sat, 20 May 2017 19:49:46 -0500 Subject: [PATCH 24/34] Hercules P32: use renamed beatloop_activate ControlObject --- res/controllers/Hercules-P32-scripts.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index 95e34d30a97d..948a72deb1a9 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -388,8 +388,8 @@ P32.Deck = function (deckNumbers, channel) { engine.setValue(this.currentDeck, 'reloop_toggle', 1); engine.setValue(this.currentDeck, 'reloop_toggle', 0); } else { - engine.setValue(this.currentDeck, 'beatloop_toggle', 1); - engine.setValue(this.currentDeck, 'beatloop_toggle', 0); + engine.setValue(this.currentDeck, 'beatloop_activate', 1); + engine.setValue(this.currentDeck, 'beatloop_activate', 0); } } }; From 7890d90e2b38f565f7f7989baee1968bd91f71f2 Mon Sep 17 00:00:00 2001 From: be_ Date: Mon, 22 May 2017 14:43:39 -0500 Subject: [PATCH 25/34] Hercules P32: use beatjump_1_forward/backward now that loop_move_forward/backward have been removed --- res/controllers/Hercules-P32-scripts.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index 948a72deb1a9..385999b3f34a 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -370,14 +370,14 @@ P32.Deck = function (deckNumbers, channel) { this.loopMoveEncoder = function (channel, control, value, status, group) { if (value > 64) { // left turn - engine.setValue(this.currentDeck, 'loop_move_backward', 1); + engine.setValue(this.currentDeck, 'beatjump_1_backward', 1); engine.beginTimer(200, function () { - engine.setValue(this.currentDeck, 'loop_move_backward', 0); + engine.setValue(this.currentDeck, 'beatjump_1_backward', 0); }, true); } else { // right turn - engine.setValue(this.currentDeck, 'loop_move_forward', 1); + engine.setValue(this.currentDeck, 'beatjump_1_forward', 1); engine.beginTimer(200, function () { - engine.setValue(this.currentDeck, 'loop_move_forward', 0); + engine.setValue(this.currentDeck, 'beatjump_1_forward', 0); }, true); } }; From 59b641608b5282ee7ef4d64c4b2c09b279670aed Mon Sep 17 00:00:00 2001 From: be_ Date: Sun, 28 May 2017 19:55:57 -0500 Subject: [PATCH 26/34] Hercules P32: refactor for new Components button types --- res/controllers/Hercules-P32-scripts.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index 385999b3f34a..6d23f39c090c 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -91,7 +91,6 @@ P32.recordButton = new components.Button({ midi: [0x90, 0x02], group: '[Recording]', inKey: 'toggle_recording', - onlyOnPress: false, outKey: 'status', sendShifted: false, }); @@ -177,6 +176,7 @@ P32.Deck = function (deckNumbers, channel) { this.pfl = new components.Button({ midi: [0x90 + channel, 0x10], sendShifted: false, + type: components.Button.prototype.types.toggle, unshift: function () { this.group = theDeck.currentDeck; this.inKey = 'pfl'; @@ -230,14 +230,12 @@ P32.Deck = function (deckNumbers, channel) { this.loopIn = new components.Button({ midi: [0x90 + channel, 0x50], key: 'loop_in', - onlyOnPress: false, on: P32.padColors.red, off: P32.padColors.purple, }); this.loopOut = new components.Button({ midi: [0x90 + channel, 0x51], key: 'loop_out', - onlyOnPress: false, on: P32.padColors.red, off: P32.padColors.purple, }); @@ -247,9 +245,8 @@ P32.Deck = function (deckNumbers, channel) { this.inKey = 'reloop_toggle'; }, shift: function () { - this.inKey = 'reloop_cue'; + this.inKey = 'reloop_andstop'; }, - onlyOnPress: false, on: P32.padColors.red, off: P32.padColors.blue, outKey: 'loop_enabled', @@ -258,27 +255,25 @@ P32.Deck = function (deckNumbers, channel) { this.tempSlow = new components.Button({ midi: [0x90 + channel, 0x44], key: 'rate_temp_down', - onlyOnPress: false, on: P32.padColors.red, off: P32.padColors.purple, }); this.tempFast = new components.Button({ midi: [0x90 + channel, 0x45], key: 'rate_temp_up', - onlyOnPress: false, on: P32.padColors.red, off: P32.padColors.purple, }); this.alignBeats = new components.Button({ midi: [0x90 + channel, 0x46], key: 'beats_translate_curpos', - onlyOnPress: false, on: P32.padColors.red, off: P32.padColors.blue, }); this.quantize = new components.Button({ midi: [0x90 + channel, 0x4B], key: 'quantize', + type: components.Button.prototype.types.toggle, on: P32.padColors.red, off: P32.padColors.blue, }); From b248c7805fb80fb86cf73248f2c9eecb607d98d7 Mon Sep 17 00:00:00 2001 From: be_ Date: Tue, 30 May 2017 13:46:51 -0500 Subject: [PATCH 27/34] Hercules P32: remove dedicated quantize button now that shift + sync toggles quantize --- res/controllers/Hercules P32 DJ.midi.xml | 36 ------------------------ res/controllers/Hercules-P32-scripts.js | 7 ----- 2 files changed, 43 deletions(-) diff --git a/res/controllers/Hercules P32 DJ.midi.xml b/res/controllers/Hercules P32 DJ.midi.xml index 093f80a44b25..c7ec270389ba 100644 --- a/res/controllers/Hercules P32 DJ.midi.xml +++ b/res/controllers/Hercules P32 DJ.midi.xml @@ -645,15 +645,6 @@ - - [Channel1] - P32.leftDeck.quantize.input - 0x91 - 0x4B - - - - [Channel1] P32.leftDeck.enableEffectUnitButtons[1].input @@ -726,15 +717,6 @@ - - [Channel1] - P32.leftDeck.quantize.input - 0x94 - 0x4B - - - - [Channel1] P32.leftDeck.shiftButton @@ -2302,24 +2284,6 @@ - - [Channel1] - P32.rightDeck.quantize.input - 0x92 - 0x4B - - - - - - [Channel1] - P32.rightDeck.quantize.input - 0x95 - 0x4B - - - - [Channel1] P32.rightDeck.enableEffectUnitButtons[1].input diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index 6d23f39c090c..7226b6b126b9 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -270,13 +270,6 @@ P32.Deck = function (deckNumbers, channel) { on: P32.padColors.red, off: P32.padColors.blue, }); - this.quantize = new components.Button({ - midi: [0x90 + channel, 0x4B], - key: 'quantize', - type: components.Button.prototype.types.toggle, - on: P32.padColors.red, - off: P32.padColors.blue, - }); this.enableEffectUnitButtons = new components.ComponentContainer(); //fii this.enableEffectUnitButtons[1] = new components.EffectAssignmentButton({ From e7e0577beb78fbbfcbea0750dc56783341fa607d Mon Sep 17 00:00:00 2001 From: be_ Date: Tue, 27 Jun 2017 19:54:25 -0500 Subject: [PATCH 28/34] add script.triggerControl to common-controller-scripts.js --- res/controllers/common-controller-scripts.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/res/controllers/common-controller-scripts.js b/res/controllers/common-controller-scripts.js index cce9e53641aa..816ebb9bc9ed 100644 --- a/res/controllers/common-controller-scripts.js +++ b/res/controllers/common-controller-scripts.js @@ -126,6 +126,25 @@ script.toggleControl = function (group, control) { engine.setValue(group, control, !(engine.getValue(group, control))); } +/* -------- ------------------------------------------------------ + script.toggleControl + Purpose: Triggers an engine value and resets it back to 0 after a delay + This is helpful for mapping encoder turns to controls that are + represented by buttons in skins so the skin button lights up + briefly but does not stay lit. + Input: Group and control names, delay in milliseconds (optional) + Output: none + -------- ------------------------------------------------------ */ +script.triggerControl = function (group, control, delay) { + if (typeof delay !== 'number') { + delay = 200; + } + engine.setValue(group, control, 1); + engine.beginTimer(delay, function () { + engine.setValue(group, control, 0); + }, true); +} + /* -------- ------------------------------------------------------ script.absoluteLin Purpose: Maps an absolute linear control value to a linear Mixxx control From c86c0e2b22d6da7f0a40c7c3dd4d3d952a625348 Mon Sep 17 00:00:00 2001 From: be_ Date: Tue, 27 Jun 2017 20:01:49 -0500 Subject: [PATCH 29/34] Hercules P32: use new script.triggerControl function --- res/controllers/Hercules-P32-scripts.js | 29 ++++++------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index 7226b6b126b9..7dccc10f4fce 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -311,26 +311,22 @@ P32.Deck = function (deckNumbers, channel) { if (value > 64 && loopSize > 2) { // turn left // Unfortunately, there is no way to show 1 with a dot on the // loop size LED. - engine.setValue(this.group, 'loop_halve', 1); - engine.setValue(this.group, 'loop_halve', 0); + script.triggerControl(this.group, 'loop_halve'); } else if (value < 64 && loopSize < 32) { // turn right // Mixxx supports loops longer than 32 beats, but there is no way // to show 64 with a dot on the loop size LED. - engine.setValue(this.group, 'loop_double', 1); - engine.setValue(this.group, 'loop_double', 0); + script.triggerControl(this.group, 'loop_double'); } } else { if (value > 64 && loopSize > 1/32) { // turn left // Mixxx supports loops shorter than 1/32 beats, but there is no // way to set the loop size LED less than 1/32 (even though it // should be able to show 1/64). - engine.setValue(this.group, 'loop_halve', 1); - engine.setValue(this.group, 'loop_halve', 0); + script.triggerControl(this.group, 'loop_halve'); } else if (value < 64) { // turn right // Mixxx supports loops longer than 64 beats, but the loop size LED // only has 2 digits, so it couldn't show 128 - engine.setValue(this.group, 'loop_double', 1); - engine.setValue(this.group, 'loop_double', 0); + script.triggerControl(this.group, 'loop_double'); } } }, @@ -358,15 +354,9 @@ P32.Deck = function (deckNumbers, channel) { this.loopMoveEncoder = function (channel, control, value, status, group) { if (value > 64) { // left turn - engine.setValue(this.currentDeck, 'beatjump_1_backward', 1); - engine.beginTimer(200, function () { - engine.setValue(this.currentDeck, 'beatjump_1_backward', 0); - }, true); + script.triggerControl(this.currentDeck, 'beatjump_1_backward'); } else { // right turn - engine.setValue(this.currentDeck, 'beatjump_1_forward', 1); - engine.beginTimer(200, function () { - engine.setValue(this.currentDeck, 'beatjump_1_forward', 0); - }, true); + script.triggerControl(this.currentDeck, 'beatjump_1_forward'); } }; @@ -445,12 +435,7 @@ P32.Deck = function (deckNumbers, channel) { }; this.ejectTrack = function (channel, control, value, status, group) { - if (value === 127) { - engine.setValue(this.currentDeck, 'eject', 1); - engine.beginTimer(225, function () { - engine.setValue(this.currentDeck, 'eject', 0); - }, true); - } + engine.setValue(this.currentDeck, 'eject', value / 127); }; this.reconnectComponents(function (component) { From 04f7a5d6ede671303302df1beb183d18b8631d7d Mon Sep 17 00:00:00 2001 From: be_ Date: Tue, 27 Jun 2017 20:02:29 -0500 Subject: [PATCH 30/34] Hercules P32: code cleanup --- res/controllers/Hercules P32 DJ.midi.xml | 32 +++++++++---------- res/controllers/Hercules-P32-scripts.js | 40 +++++++----------------- 2 files changed, 27 insertions(+), 45 deletions(-) diff --git a/res/controllers/Hercules P32 DJ.midi.xml b/res/controllers/Hercules P32 DJ.midi.xml index c7ec270389ba..5fae15e5015f 100644 --- a/res/controllers/Hercules P32 DJ.midi.xml +++ b/res/controllers/Hercules P32 DJ.midi.xml @@ -647,7 +647,7 @@ [Channel1] - P32.leftDeck.enableEffectUnitButtons[1].input + P32.leftDeck.enableEffectUnitButtons[0].input 0x91 0x40 @@ -656,7 +656,7 @@ [Channel1] - P32.leftDeck.enableEffectUnitButtons[1].input + P32.leftDeck.enableEffectUnitButtons[0].input 0x94 0x40 @@ -665,7 +665,7 @@ [Channel1] - P32.leftDeck.enableEffectUnitButtons[2].input + P32.leftDeck.enableEffectUnitButtons[1].input 0x91 0x41 @@ -674,7 +674,7 @@ [Channel1] - P32.leftDeck.enableEffectUnitButtons[2].input + P32.leftDeck.enableEffectUnitButtons[1].input 0x94 0x41 @@ -683,7 +683,7 @@ [Channel1] - P32.leftDeck.enableEffectUnitButtons[3].input + P32.leftDeck.enableEffectUnitButtons[2].input 0x94 0x3C @@ -692,7 +692,7 @@ [Channel1] - P32.leftDeck.enableEffectUnitButtons[3].input + P32.leftDeck.enableEffectUnitButtons[2].input 0x91 0x3C @@ -701,7 +701,7 @@ [Channel1] - P32.leftDeck.enableEffectUnitButtons[4].input + P32.leftDeck.enableEffectUnitButtons[3].input 0x91 0x3D @@ -710,7 +710,7 @@ [Channel1] - P32.leftDeck.enableEffectUnitButtons[4].input + P32.leftDeck.enableEffectUnitButtons[3].input 0x94 0x3D @@ -2286,7 +2286,7 @@ [Channel1] - P32.rightDeck.enableEffectUnitButtons[1].input + P32.rightDeck.enableEffectUnitButtons[0].input 0x92 0x40 @@ -2295,7 +2295,7 @@ [Channel1] - P32.rightDeck.enableEffectUnitButtons[1].input + P32.rightDeck.enableEffectUnitButtons[0].input 0x95 0x40 @@ -2304,7 +2304,7 @@ [Channel1] - P32.rightDeck.enableEffectUnitButtons[2].input + P32.rightDeck.enableEffectUnitButtons[1].input 0x92 0x41 @@ -2313,7 +2313,7 @@ [Channel1] - P32.rightDeck.enableEffectUnitButtons[2].input + P32.rightDeck.enableEffectUnitButtons[1].input 0x95 0x41 @@ -2322,7 +2322,7 @@ [Channel1] - P32.rightDeck.enableEffectUnitButtons[3].input + P32.rightDeck.enableEffectUnitButtons[2].input 0x92 0x3C @@ -2331,7 +2331,7 @@ [Channel1] - P32.rightDeck.enableEffectUnitButtons[3].input + P32.rightDeck.enableEffectUnitButtons[2].input 0x95 0x3C @@ -2340,7 +2340,7 @@ [Channel1] - P32.rightDeck.enableEffectUnitButtons[4].input + P32.rightDeck.enableEffectUnitButtons[3].input 0x92 0x3D @@ -2349,7 +2349,7 @@ [Channel1] - P32.rightDeck.enableEffectUnitButtons[4].input + P32.rightDeck.enableEffectUnitButtons[3].input 0x95 0x3D diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index 7dccc10f4fce..8558a01689a6 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -271,35 +271,17 @@ P32.Deck = function (deckNumbers, channel) { off: P32.padColors.blue, }); - this.enableEffectUnitButtons = new components.ComponentContainer(); //fii - this.enableEffectUnitButtons[1] = new components.EffectAssignmentButton({ - midi: [0x90 + channel, 0x40], - effectUnit: 1, - group: this.currentDeck, - on: P32.padColors.blue, - off: P32.padColors.red, - }); - this.enableEffectUnitButtons[2] = new components.EffectAssignmentButton({ - midi: [0x90 + channel, 0x41], - effectUnit: 2, - group: this.currentDeck, - on: P32.padColors.blue, - off: P32.padColors.red, - }); - this.enableEffectUnitButtons[3] = new components.EffectAssignmentButton({ - midi: [0x90 + channel, 0x3C], - effectUnit: 3, - group: this.currentDeck, - on: P32.padColors.blue, - off: P32.padColors.red, - }); - this.enableEffectUnitButtons[4] = new components.EffectAssignmentButton({ - midi: [0x90 + channel, 0x3D], - effectUnit: 4, - group: this.currentDeck, - on: P32.padColors.blue, - off: P32.padColors.red, - }); + this.enableEffectUnitButtons = [0x40, 0x41, 0x3C, 0x3D].map( + function (midiByte, index) { + return new components.EffectAssignmentButton({ + midi: [0x90 + channel, midiByte], + effectUnit: index + 1, + group: this.currentDeck, + on: P32.padColors.blue, + off: P32.padColors.red, + }); + } + , this); // =================================== ENCODERS ============================================== this.loopSizeEncoder = new components.Encoder({ From be461e6a6c3d82fa7a7bcd368e37256b646bd405 Mon Sep 17 00:00:00 2001 From: be_ Date: Mon, 3 Jul 2017 17:59:29 -0500 Subject: [PATCH 31/34] Hercules P32: refactor to use Components for everything also rearrange the code from top to bottom in order of how the controller is arranged --- res/controllers/Hercules P32 DJ.midi.xml | 250 +++++++-------- res/controllers/Hercules-P32-scripts.js | 378 ++++++++++++----------- 2 files changed, 331 insertions(+), 297 deletions(-) diff --git a/res/controllers/Hercules P32 DJ.midi.xml b/res/controllers/Hercules P32 DJ.midi.xml index 5fae15e5015f..a93ba4265ece 100644 --- a/res/controllers/Hercules P32 DJ.midi.xml +++ b/res/controllers/Hercules P32 DJ.midi.xml @@ -41,6 +41,78 @@ + + [Channel1] + P32.leftDeck.loopEncoder.input + 0xB1 + 0x0A + + + + + + [Channel1] + P32.leftDeck.loopEncoder.input + 0xB4 + 0x0A + + + + + + [Channel1] + P32.leftDeck.loopEncoderPress.input + 0x91 + 0x01 + + + + + + [Channel1] + P32.leftDeck.loopEncoderPress.input + 0x94 + 0x01 + + + + + + [Channel1] + P32.leftDeck.rightEncoder.input + 0xB1 + 0x05 + + + + + + [Channel1] + P32.leftDeck.rightEncoder.input + 0xB4 + 0x05 + + + + + + [Channel1] + P32.leftDeck.rightEncoderPress.input + 0x91 + 0x02 + + + + + + [Channel1] + P32.leftDeck.rightEncoderPress.input + 0x94 + 0x02 + + + + [Channel1] P32.leftDeck.loopIn.input @@ -528,15 +600,6 @@ - - [Channel1] - P32.leftDeck.loopMoveEncoder - 0xB4 - 0x0A - - - - [Channel1] P32.leftDeck.play.input @@ -726,15 +789,6 @@ - - [Channel1] - P32.leftDeck.tempoEncoder - 0xB1 - 0x05 - - - - [Channel1] P32.leftDeck.eqKnob[3].input @@ -762,15 +816,6 @@ - - [Channel1] - P32.leftDeck.beatJumpEncoder - 0xB4 - 0x05 - - - - [Playlist] P32.browseEncoder @@ -818,13 +863,22 @@ [Channel1] - P32.leftDeck.loadTrack + P32.leftDeck.loadTrack.input 0x91 0x0F + + [Channel1] + P32.leftDeck.loadTrack.input + 0x94 + 0x0F + + + + [Channel1] P32.leftDeck.volume.input @@ -853,63 +907,63 @@ - [Recording] - P32.slipButton.input - 0x90 - 0x03 + [Channel1] + P32.rightDeck.loopEncoder.input + 0xB2 + 0x05 [Channel1] - P32.leftDeck.tempoEncoderPress - 0x91 - 0x02 + P32.rightDeck.loopEncoder.input + 0xB5 + 0x05 [Channel1] - P32.leftDeck.ejectTrack - 0x94 - 0x0F + P32.rightDeck.loopEncoderPress.input + 0x92 + 0x02 [Channel1] - P32.leftDeck.volume.input - 0xB4 - 0x01 + P32.rightDeck.loopEncoderPress.input + 0x95 + 0x02 [Channel1] - P32.leftDeck.loopToggleEncoderPress - 0x91 - 0x01 + P32.rightDeck.rightEncoder.input + 0xB2 + 0x0A [Channel1] - P32.leftDeck.beatJumpEncoderPress - 0x94 - 0x02 + P32.rightDeck.rightEncoder.input + 0xB5 + 0x0A [Channel1] - P32.leftDeck.loopEncoderShiftPress - 0x94 + P32.rightDeck.rightEncoderPress.input + 0x92 0x01 @@ -917,18 +971,27 @@ [Channel1] - P32.leftDeck.loopSizeEncoder.input - 0xB1 - 0x0A + P32.rightDeck.rightEncoderPress.input + 0x95 + 0x01 + + + + + + [Recording] + P32.slipButton.input + 0x90 + 0x03 [Channel1] - P32.rightDeck.loopMoveEncoder - 0xB5 - 0x05 + P32.leftDeck.volume.input + 0xB4 + 0x01 @@ -996,15 +1059,6 @@ - - [Channel1] - P32.rightDeck.tempoEncoder - 0xB2 - 0x0A - - - - [Channel1] P32.rightDeck.eqKnob[3].input @@ -1014,15 +1068,6 @@ - - [Channel1] - P32.rightDeck.beatJumpEncoder - 0xB5 - 0x0A - - - - [Channel1] P32.rightDeck.eqKnob[2].input @@ -1079,7 +1124,7 @@ [Channel1] - P32.rightDeck.loadTrack + P32.rightDeck.loadTrack.input 0x92 0x0F @@ -1088,34 +1133,7 @@ [Channel1] - P32.rightDeck.volume.input - 0xB2 - 0x01 - - - - - - [Channel1] - P32.rightDeck.eqKnob[1].input - 0xB5 - 0x02 - - - - - - [Channel1] - P32.rightDeck.tempoEncoderPress - 0x92 - 0x01 - - - - - - [Channel1] - P32.rightDeck.ejectTrack + P32.rightDeck.loadTrack.input 0x95 0x0F @@ -1125,7 +1143,7 @@ [Channel1] P32.rightDeck.volume.input - 0xB5 + 0xB2 0x01 @@ -1133,8 +1151,8 @@ [Channel1] - P32.rightDeck.loopToggleEncoderPress - 0x92 + P32.rightDeck.eqKnob[1].input + 0xB5 0x02 @@ -1142,31 +1160,13 @@ [Channel1] - P32.rightDeck.beatJumpEncoderPress - 0x95 + P32.rightDeck.volume.input + 0xB5 0x01 - - [Channel1] - P32.rightDeck.loopEncoderShiftPress - 0x95 - 0x02 - - - - - - [Channel1] - P32.rightDeck.loopSizeEncoder.input - 0xB2 - 0x05 - - - - [Channel1] P32.rightDeck.hotcueButton[1].input diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index 8558a01689a6..3ed1b823482d 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -158,45 +158,191 @@ P32.Deck = function (deckNumbers, channel) { } }; - // ===================================== TRANSPORT ========================================= - this.sync = new components.SyncButton([0x90 + channel, 0x08]); - this.cue = new components.CueButton([0x90 + channel, 0x09]); - this.play = new components.PlayButton([0x90 + channel, 0x0A]); + this.loadTrack = new components.Button({ + midi: [0x90 + channel, 0x0F], + unshift: function () { + this.inKey = 'LoadSelectedTrack'; + }, + shift: function () { + this.inKey = 'eject'; + }, + }); - // ===================================== MIXER ============================================== - this.eqKnob = []; - for (var k = 1; k <= 3; k++) { - this.eqKnob[k] = new components.Pot({ - midi: [0xB0 + channel, 0x02 + k], - group: '[EqualizerRack1_' + this.currentDeck + '_Effect1]', - inKey: 'parameter' + k, - }); - } + // =============================== ENCODERS ========================================= + this.loopEncoder = new components.Encoder({ + // NOTE: these are the MIDI bytes for the digit LEDs, not input from the encoder. + midi: [0xB0 + channel, 0x1B], + unshift: function () { + this.input = function (channel, control, value, status, group) { + var loopSize = engine.getValue(this.group, 'beatloop_size'); + if (loopEnabledDot) { + if (value > 64 && loopSize > 2) { // turn left + // Unfortunately, there is no way to show 1 with a dot on the + // loop size LED. + script.triggerControl(this.group, 'loop_halve'); + } else if (value < 64 && loopSize < 32) { // turn right + // Mixxx supports loops longer than 32 beats, but there is no way + // to show 64 with a dot on the loop size LED. + script.triggerControl(this.group, 'loop_double'); + } + } else { + if (value > 64 && loopSize > 1/32) { // turn left + script.triggerControl(this.group, 'loop_halve'); + } else if (value < 64) { // turn right + script.triggerControl(this.group, 'loop_double'); + } + } + }; + }, + shift: function () { + this.input = function (channel, control, value, status, group) { + var direction = (value > 64) ? 'backward' : 'forward'; + script.triggerControl(this.group, 'beatjump_1_' + direction); + }; + }, + connect: function () { + this.connections[0] = engine.connectControl(this.group, 'beatloop_size', this.output); + if (loopEnabledDot) { + this.connections[1] = engine.connectControl(this.group, 'loop_enabled', this.output); + } + }, + output: function (value, group, control) { + var loopSize = engine.getValue(this.group, 'beatloop_size'); + var loopSizeLogBase2 = Math.log(loopSize) / Math.log(2); + // test if loopSizeLogBase2 is an integer + if (Math.floor(loopSizeLogBase2) === loopSizeLogBase2) { + if (loopEnabledDot && engine.getValue(this.group, 'loop_enabled') === 1) { + this.send(5 - loopSizeLogBase2); + } else { + this.send(5 + loopSizeLogBase2); + } + } else { + this.send(14); // show two dots + } + } + }); - this.pfl = new components.Button({ - midi: [0x90 + channel, 0x10], - sendShifted: false, - type: components.Button.prototype.types.toggle, + this.loopEncoderPress = new components.Button({ unshift: function () { - this.group = theDeck.currentDeck; - this.inKey = 'pfl'; + // Make sure the shifted Controls don't get stuck with a value of 1 + // if the shift button is released before the encoder button. + if (engine.getValue(this.group, 'reloop_andstop') !== 0) { + engine.setValue(this.group, 'reloop_andstop', 0); + } + if (engine.getValue(this.group, 'reloop_toggle') !== 0) { + engine.setValue(this.group, 'reloop_toggle', 0); + } + + this.input = function (channel, control, value, status, group) { + if (value) { + if (engine.getValue(this.group, 'loop_enabled') === 1) { + engine.setValue(this.group, 'reloop_toggle', 1); + } else { + engine.setValue(this.group, 'beatloop_activate', 1); + } + } else { + if (engine.getValue(this.group, 'reloop_toggle') !== 1) { + engine.setValue(this.group, 'reloop_toggle', 0); + } else if (engine.getValue(this.group, 'beatloop_activate') !== 0) { + engine.setValue(this.group, 'beatloop_activate', 0); + } + } + }; }, - outKey: 'pfl', shift: function () { - this.group = '[EffectRack1_EffectUnit' + theDeck.effectUnit.currentUnitNumber + ']'; - this.inKey = 'group_[Headphone]_enable'; + // Make sure the unshifted Controls don't get stuck with a value of 1 + // if the shift button is pressed before releasing the encoder button. + if (engine.getValue(this.group, 'reloop_toggle') !== 0) { + engine.setValue(this.group, 'reloop_toggle', 0); + } + if (engine.getValue(this.group, 'beatloop_activate') !== 0) { + engine.setValue(this.group, 'beatloop_activate', 0); + } + + this.input = function (channel, control, value, status, group) { + if (engine.getValue(this.group, 'loop_enabled') === 1) { + engine.setValue(this.group, 'reloop_andstop', value / 127); + } else { + engine.setValue(this.group, 'reloop_toggle', value / 127); + } + }; }, }); - this.volume = new components.Pot({ - midi: [0xB0 + channel, 0x01], - inKey: 'volume', + this.showBeatjumpSize = function () { + var beatjumpSize = engine.getValue(this.currentDeck, 'beatjump_size'); + var beatjumpSizeLogBase2 = Math.log(beatjumpSize) / Math.log(2); + // test if beatjumpSizeLogBase2 is an integer + if (Math.floor(beatjumpSizeLogBase2) === beatjumpSizeLogBase2) { + midi.sendShortMsg(0xB0 + channel, 0x1B, + 5 + Math.log(beatjumpSize) / Math.log(2)); + } else { + midi.sendShortMsg(0xB0 + channel, 0x1B, 14); // show two dots + } + }; + + this.rightEncoder = new components.Encoder({ + unshift: function () { + this.input = function (channel, control, value, status, group) { + var direction = (value > 64) ? -1 : 1; + engine.setValue(this.group, 'rate', + engine.getValue(this.group, 'rate') + (0.01 * direction)); + }; + }, + shift: function () { + this.input = function (channel, control, value, status, group) { + var beatJumpSize = engine.getValue(this.group, 'beatjump_size'); + if (theDeck.beatJumpEncoderPressed) { + if (value > 64 && beatJumpSize > 1/32) { // turn left + beatJumpSize /= 2; + } else if (value < 64) { // turn right + beatJumpSize *= 2; + } + engine.setValue(this.group, 'beatjump_size', beatJumpSize); + theDeck.showBeatjumpSize(); + } else { + var direction = (value > 64) ? 'backward' : 'forward'; + script.triggerControl(this.group, 'beatjump_' + direction); + } + }; + }, + }); + + this.rightEncoderPress = new components.Button({ + unshift: function () { + theDeck.loopEncoder.trigger(); + this.input = function (channel, control, value, status, group) { + if (value === 127) { + engine.setValue(this.group, 'rate', 0); + } + }; + }, + shift: function () { + this.input = function (channel, control, value, status, group) { + if (value === 127) { + theDeck.beatJumpEncoderPressed = true; + theDeck.showBeatjumpSize(); + } else { + theDeck.beatJumpEncoderPressed = false; + theDeck.loopEncoder.trigger(); + } + }; + }, }); - // ==================================== PAD GRID ============================================ - // The slicer layer is handled by this.effectUnit.enableOnChannelButtons, set up under the - // EFFECTS section. + // ================================= EFFECTS ===================================== + this.effectUnit = new components.EffectUnit(deckNumbers); + this.effectUnit.knobs[1].midi = [0xB0 + channel, 0x06]; + this.effectUnit.knobs[2].midi = [0xB0 + channel, 0x07]; + this.effectUnit.knobs[3].midi = [0xB0 + channel, 0x08]; + this.effectUnit.dryWetKnob.midi = [0xB0 + channel, 0x09]; + this.effectUnit.enableButtons[1].midi = [0x90 + channel, 0x03]; + this.effectUnit.enableButtons[2].midi = [0x90 + channel, 0x04]; + this.effectUnit.enableButtons[3].midi = [0x90 + channel, 0x05]; + this.effectUnit.effectFocusButton.midi = [0x90 + channel, 0x06]; + this.effectUnit.init(); + // ================================ PAD GRID ==================================== this.hotcueButton = []; this.samplerButton = []; for (var i = 1; i <= 16; i++) { @@ -227,6 +373,7 @@ P32.Deck = function (deckNumbers, channel) { } } + // LOOP layer this.loopIn = new components.Button({ midi: [0x90 + channel, 0x50], key: 'loop_in', @@ -271,6 +418,7 @@ P32.Deck = function (deckNumbers, channel) { off: P32.padColors.blue, }); + // SLICER layer this.enableEffectUnitButtons = [0x40, 0x41, 0x3C, 0x3D].map( function (midiByte, index) { return new components.EffectAssignmentButton({ @@ -283,159 +431,45 @@ P32.Deck = function (deckNumbers, channel) { } , this); - // =================================== ENCODERS ============================================== - this.loopSizeEncoder = new components.Encoder({ - midi: [0xB0 + channel, 0x1B], // Note: these are the MIDI bytes for the digit LEDs, not - // input from the encoder. - input: function (channel, control, value, status, group) { - var loopSize = engine.getValue(this.group, 'beatloop_size'); - if (loopEnabledDot) { - if (value > 64 && loopSize > 2) { // turn left - // Unfortunately, there is no way to show 1 with a dot on the - // loop size LED. - script.triggerControl(this.group, 'loop_halve'); - } else if (value < 64 && loopSize < 32) { // turn right - // Mixxx supports loops longer than 32 beats, but there is no way - // to show 64 with a dot on the loop size LED. - script.triggerControl(this.group, 'loop_double'); - } - } else { - if (value > 64 && loopSize > 1/32) { // turn left - // Mixxx supports loops shorter than 1/32 beats, but there is no - // way to set the loop size LED less than 1/32 (even though it - // should be able to show 1/64). - script.triggerControl(this.group, 'loop_halve'); - } else if (value < 64) { // turn right - // Mixxx supports loops longer than 64 beats, but the loop size LED - // only has 2 digits, so it couldn't show 128 - script.triggerControl(this.group, 'loop_double'); - } - } + // ============================= TRANSPORT ================================== + this.sync = new components.SyncButton([0x90 + channel, 0x08]); + this.cue = new components.CueButton([0x90 + channel, 0x09]); + this.play = new components.PlayButton([0x90 + channel, 0x0A]); + + // =============================== MIXER ==================================== + this.eqKnob = []; + for (var k = 1; k <= 3; k++) { + this.eqKnob[k] = new components.Pot({ + midi: [0xB0 + channel, 0x02 + k], + group: '[EqualizerRack1_' + this.currentDeck + '_Effect1]', + inKey: 'parameter' + k, + }); + } + + this.pfl = new components.Button({ + midi: [0x90 + channel, 0x10], + sendShifted: false, + type: components.Button.prototype.types.toggle, + unshift: function () { + this.group = theDeck.currentDeck; + this.inKey = 'pfl'; }, - connect: function () { - this.connections[0] = engine.connectControl(this.group, 'beatloop_size', this.output); - if (loopEnabledDot) { - this.connections[1] = engine.connectControl(this.group, 'loop_enabled', this.output); - } + outKey: 'pfl', + shift: function () { + this.group = '[EffectRack1_EffectUnit' + theDeck.effectUnit.currentUnitNumber + ']'; + this.inKey = 'group_[Headphone]_enable'; }, - output: function (value, group, control) { - var loopSize = engine.getValue(this.group, 'beatloop_size'); - var loopSizeLogBase2 = Math.log(loopSize) / Math.log(2); - // test if loopSizeLogBase2 is an integer - if (Math.floor(loopSizeLogBase2) === loopSizeLogBase2) { - if (loopEnabledDot && engine.getValue(this.group, 'loop_enabled') === 1) { - this.send(5 - loopSizeLogBase2); - } else { - this.send(5 + loopSizeLogBase2); - } - } else { - this.send(14); // show two dots - } - } }); - this.loopMoveEncoder = function (channel, control, value, status, group) { - if (value > 64) { // left turn - script.triggerControl(this.currentDeck, 'beatjump_1_backward'); - } else { // right turn - script.triggerControl(this.currentDeck, 'beatjump_1_forward'); - } - }; - - this.loopToggleEncoderPress = function (channel, control, value, status, group) { - if (value > 0) { - if (engine.getValue(this.currentDeck, 'loop_enabled') === 1) { - engine.setValue(this.currentDeck, 'reloop_toggle', 1); - engine.setValue(this.currentDeck, 'reloop_toggle', 0); - } else { - engine.setValue(this.currentDeck, 'beatloop_activate', 1); - engine.setValue(this.currentDeck, 'beatloop_activate', 0); - } - } - }; - - this.loopEncoderShiftPress = function (channel, control, value, status, group) { - if (engine.getValue(this.currentDeck, 'loop_enabled') === 1) { - engine.setValue(this.currentDeck, 'reloop_andstop', value / 127); - } else { - engine.setValue(this.currentDeck, 'reloop_toggle', value / 127); - } - }; - - this.tempoEncoder = function (channel, control, value, status, group) { - var direction = (value > 64) ? -1 : 1; - engine.setValue(this.currentDeck, 'rate', engine.getValue(this.currentDeck, 'rate') + (0.01 * direction)); - }; - - this.tempoEncoderPress = function (channel, control, value, status, group) { - if (value) { - engine.setValue(this.currentDeck, 'rate', 0); - } - }; - - this.beatJumpEncoder = function (channel, control, value, status, group) { - var beatJumpSize = engine.getValue(this.currentDeck, 'beatjump_size'); - if (this.beatJumpEncoderPressed) { - if (value > 64 && beatJumpSize > 1/32) { // turn left - beatJumpSize /= 2; - } else if (value < 64 && beatJumpSize < 64) { // turn right - beatJumpSize *= 2; - } - engine.setValue(this.currentDeck, 'beatjump_size', beatJumpSize); - // The firmware will only change the numeric LED readout when sent messages - // on the unshifted channel. - midi.sendShortMsg(0xB0 + channel - P32.shiftOffset, 0x1B, 5 + Math.log(beatJumpSize) / Math.log(2)); - } else { - var direction = (value > 64) ? 'backward' : 'forward'; - engine.setValue(this.currentDeck, 'beatjump_' + direction, 1); - engine.beginTimer(200, function () { - engine.setValue(this.currentDeck, 'beatjump_' + direction, 0); - }, true); - } - }; - - this.beatJumpEncoderPress = function (channel, control, value, status, group) { - // The firmware will only change the numeric LED readout when sent messages - // on the unshifted channel. - if (value === 127) { - this.beatJumpEncoderPressed = true; - var beatJumpSize = engine.getValue(this.currentDeck, 'beatjump_size'); - midi.sendShortMsg(0xB0 + channel - P32.shiftOffset, 0x1B, - 5 + Math.log(beatJumpSize) / Math.log(2)); - } else { - this.beatJumpEncoderPressed = false; - var loopSize = engine.getValue(this.currentDeck, 'beatloop_size'); - midi.sendShortMsg(0xB0 + channel - P32.shiftOffset, 0x1B, - 5 + Math.log(loopSize) / Math.log(2)); - } - }; - - this.loadTrack = function (channel, control, value, status, group) { - if (value === 127) { - engine.setValue(this.currentDeck, 'LoadSelectedTrack', 1); - } - }; - - this.ejectTrack = function (channel, control, value, status, group) { - engine.setValue(this.currentDeck, 'eject', value / 127); - }; + this.volume = new components.Pot({ + midi: [0xB0 + channel, 0x01], + inKey: 'volume', + }); this.reconnectComponents(function (component) { if (component.group === undefined) { component.group = this.currentDeck; } }); - - // ================================= EFFECTS ===================================== - this.effectUnit = new components.EffectUnit(deckNumbers); - this.effectUnit.knobs[1].midi = [0xB0 + channel, 0x06]; - this.effectUnit.knobs[2].midi = [0xB0 + channel, 0x07]; - this.effectUnit.knobs[3].midi = [0xB0 + channel, 0x08]; - this.effectUnit.dryWetKnob.midi = [0xB0 + channel, 0x09]; - this.effectUnit.enableButtons[1].midi = [0x90 + channel, 0x03]; - this.effectUnit.enableButtons[2].midi = [0x90 + channel, 0x04]; - this.effectUnit.enableButtons[3].midi = [0x90 + channel, 0x05]; - this.effectUnit.effectFocusButton.midi = [0x90 + channel, 0x06]; - this.effectUnit.init(); }; P32.Deck.prototype = new components.Deck(); From 53465fba6270d2cbe9ff51d208cb94891bbdb66e Mon Sep 17 00:00:00 2001 From: be_ Date: Mon, 3 Jul 2017 18:00:36 -0500 Subject: [PATCH 32/34] Components minor code cleanup --- res/controllers/midi-components-0.0.js | 27 +++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/res/controllers/midi-components-0.0.js b/res/controllers/midi-components-0.0.js index 368d68462741..1105a5b72a56 100644 --- a/res/controllers/midi-components-0.0.js +++ b/res/controllers/midi-components-0.0.js @@ -319,9 +319,10 @@ engine.setValue(this.group, 'play', 0); } else { engine.setValue(this.group, 'eject', 1); - engine.beginTimer(225, function () { - engine.setValue(this.group, 'eject', 0); - }, true); + } + } else { + if (engine.getValue(this.group, 'play') === 0) { + engine.setValue(this.group, 'eject', 0); } } }; @@ -475,12 +476,22 @@ isShifted: false, shift: function () { this.forEachComponent(function (component) { + // Controls for push type Buttons depend on getting reset to 0 when the + // Button is released for correct behavior. If there is a skin button + // that lights up with the inKey, the skin button would stay lit if the + // inKey does not get reset to 0. So, if a push type Button is held down + // when shift is pressed, when the Button is released, the MIDI signal + // for the Button release will be processed when the Button is in the + // shifted state, and the unshifted inKey would not get reset to 0. + // To work around this, reset push Buttons' inKey to 0 when the shift + // button is pressed. if (typeof component.shift === 'function') { if (component instanceof Button && (component.type === Button.prototype.types.push || component.type === undefined) - && component.inKey !== undefined - && component.input === Button.prototype.input) { + && component.input === Button.prototype.input + && typeof component.inKey === 'string' + && typeof component.group === 'string') { if (engine.getValue(component.group, component.inKey) !== 0) { engine.setValue(component.group, component.inKey, 0); } @@ -493,12 +504,14 @@ }, unshift: function () { this.forEachComponent(function (component) { + // Refer to comment in ComponentContainer.shift() above for explanation if (typeof component.unshift === 'function') { if (component instanceof Button && (component.type === Button.prototype.types.push || component.type === undefined) - && component.inKey !== undefined - && component.input === Button.prototype.input) { + && component.input === Button.prototype.input + && typeof component.inKey === 'string' + && typeof component.group === 'string') { if (engine.getValue(component.group, component.inKey) !== 0) { engine.setValue(component.group, component.inKey, 0); } From dae70b8f6cc26099e5462b10ee4127743af1437e Mon Sep 17 00:00:00 2001 From: be_ Date: Mon, 3 Jul 2017 18:31:36 -0500 Subject: [PATCH 33/34] Hercules P32: make asymmetrical mapping of encoders optional By default, the mapping is mirrored like the encoders' labels --- res/controllers/Hercules P32 DJ.midi.xml | 16 +++++++------- res/controllers/Hercules-P32-scripts.js | 27 ++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/res/controllers/Hercules P32 DJ.midi.xml b/res/controllers/Hercules P32 DJ.midi.xml index a93ba4265ece..203ac3aff2c6 100644 --- a/res/controllers/Hercules P32 DJ.midi.xml +++ b/res/controllers/Hercules P32 DJ.midi.xml @@ -43,7 +43,7 @@ [Channel1] - P32.leftDeck.loopEncoder.input + P32.leftDeck.leftEncoder.input 0xB1 0x0A @@ -52,7 +52,7 @@ [Channel1] - P32.leftDeck.loopEncoder.input + P32.leftDeck.leftEncoder.input 0xB4 0x0A @@ -61,7 +61,7 @@ [Channel1] - P32.leftDeck.loopEncoderPress.input + P32.leftDeck.leftEncoderPress.input 0x91 0x01 @@ -70,7 +70,7 @@ [Channel1] - P32.leftDeck.loopEncoderPress.input + P32.leftDeck.leftEncoderPress.input 0x94 0x01 @@ -908,7 +908,7 @@ [Channel1] - P32.rightDeck.loopEncoder.input + P32.rightDeck.leftEncoder.input 0xB2 0x05 @@ -917,7 +917,7 @@ [Channel1] - P32.rightDeck.loopEncoder.input + P32.rightDeck.leftEncoder.input 0xB5 0x05 @@ -926,7 +926,7 @@ [Channel1] - P32.rightDeck.loopEncoderPress.input + P32.rightDeck.leftEncoderPress.input 0x92 0x02 @@ -935,7 +935,7 @@ [Channel1] - P32.rightDeck.loopEncoderPress.input + P32.rightDeck.leftEncoderPress.input 0x95 0x02 diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index 3ed1b823482d..9b07bafe5f14 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -1,4 +1,8 @@ // USER CONFIGURABLE OPTIONS +// The labels on the encoders are mirrored, but the rest of the controller +// is asymmetrical. If this is confusing for you to use, set this to "false" to swap the +// mapping of the encoders on the right deck so the whole controller is asymmetrical. +var mirroredEncoders = true; // Set to "true" to use the dot on the loop size LED display to indicate // that a loop is active. This restricts loop sizes to 2-32 beats and // may be helpful if you never use loops less than 2 beats long. @@ -281,7 +285,7 @@ P32.Deck = function (deckNumbers, channel) { } }; - this.rightEncoder = new components.Encoder({ + this.tempoAndBeatjumpEncoder = new components.Encoder({ unshift: function () { this.input = function (channel, control, value, status, group) { var direction = (value > 64) ? -1 : 1; @@ -308,7 +312,7 @@ P32.Deck = function (deckNumbers, channel) { }, }); - this.rightEncoderPress = new components.Button({ + this.tempoAndBeatjumpEncoderPress = new components.Button({ unshift: function () { theDeck.loopEncoder.trigger(); this.input = function (channel, control, value, status, group) { @@ -330,6 +334,25 @@ P32.Deck = function (deckNumbers, channel) { }, }); + if (mirroredEncoders) { + if (channel == 1) { // left deck + this.leftEncoder = this.loopEncoder; + this.leftEncoderPress = this.loopEncoderPress; + this.rightEncoder = this.tempoAndBeatjumpEncoder; + this.rightEncoderPress = this.tempoAndBeatjumpEncoderPress; + } else if (channel == 2) { // right deck + this.leftEncoder = this.tempoAndBeatjumpEncoder; + this.leftEncoderPress = this.tempoAndBeatjumpEncoderPress; + this.rightEncoder = this.loopEncoder; + this.rightEncoderPress = this.loopEncoderPress; + } + } else { + this.leftEncoder = this.loopEncoder; + this.leftEncoderPress = this.loopEncoderPress; + this.rightEncoder = this.tempoAndBeatjumpEncoder; + this.rightEncoderPress = this.tempoAndBeatjumpEncoderPress; + } + // ================================= EFFECTS ===================================== this.effectUnit = new components.EffectUnit(deckNumbers); this.effectUnit.knobs[1].midi = [0xB0 + channel, 0x06]; From 8ebe756012896d54468089343b42e7510e9891ef Mon Sep 17 00:00:00 2001 From: be_ Date: Mon, 3 Jul 2017 19:18:32 -0500 Subject: [PATCH 34/34] Hercules P32: clamp loop & beatjump size to 64 by default The LED displays on the controller can show a maximum of 64. --- res/controllers/Hercules-P32-scripts.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/res/controllers/Hercules-P32-scripts.js b/res/controllers/Hercules-P32-scripts.js index 9b07bafe5f14..4d79963def23 100644 --- a/res/controllers/Hercules-P32-scripts.js +++ b/res/controllers/Hercules-P32-scripts.js @@ -3,6 +3,9 @@ // is asymmetrical. If this is confusing for you to use, set this to "false" to swap the // mapping of the encoders on the right deck so the whole controller is asymmetrical. var mirroredEncoders = true; +// Set this to "false" to be able to set the loop and beatjump sizes above 64 beats +// to values that cannot be shown on the controller's LED display. +var clampLoopAndBeatJumpSize = true; // Set to "true" to use the dot on the loop size LED display to indicate // that a loop is active. This restricts loop sizes to 2-32 beats and // may be helpful if you never use loops less than 2 beats long. @@ -183,17 +186,23 @@ P32.Deck = function (deckNumbers, channel) { if (value > 64 && loopSize > 2) { // turn left // Unfortunately, there is no way to show 1 with a dot on the // loop size LED. - script.triggerControl(this.group, 'loop_halve'); + engine.setValue(this.group, 'beatloop_size', loopSize / 2); } else if (value < 64 && loopSize < 32) { // turn right // Mixxx supports loops longer than 32 beats, but there is no way // to show 64 with a dot on the loop size LED. - script.triggerControl(this.group, 'loop_double'); + engine.setValue(this.group, 'beatloop_size', loopSize * 2); } } else { if (value > 64 && loopSize > 1/32) { // turn left - script.triggerControl(this.group, 'loop_halve'); + engine.setValue(this.group, 'beatloop_size', loopSize / 2); } else if (value < 64) { // turn right - script.triggerControl(this.group, 'loop_double'); + if (clampLoopAndBeatJumpSize) { + if (loopSize * 2 <= 64) { + engine.setValue(this.group, 'beatloop_size', loopSize * 2); + } + } else { + engine.setValue(this.group, 'beatloop_size', loopSize * 2); + } } } }; @@ -300,6 +309,9 @@ P32.Deck = function (deckNumbers, channel) { if (value > 64 && beatJumpSize > 1/32) { // turn left beatJumpSize /= 2; } else if (value < 64) { // turn right + if (clampLoopAndBeatJumpSize && beatJumpSize >= 64) { + return; + } beatJumpSize *= 2; } engine.setValue(this.group, 'beatjump_size', beatJumpSize);