From 867f9b21220d09d04f283ca4993b60f716dc1910 Mon Sep 17 00:00:00 2001 From: Markus Kohlhase Date: Thu, 23 Sep 2021 16:54:21 +0200 Subject: [PATCH] Denon MC7000: Handle autoloop button in script --- res/controllers/Denon-MC7000-scripts.js | 26 ++++++++++++++++++++----- res/controllers/Denon-MC7000.midi.xml | 16 +++++++-------- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/res/controllers/Denon-MC7000-scripts.js b/res/controllers/Denon-MC7000-scripts.js index 16d90ea6abc1..93e8c633b7ef 100644 --- a/res/controllers/Denon-MC7000-scripts.js +++ b/res/controllers/Denon-MC7000-scripts.js @@ -513,9 +513,9 @@ MC7000.PadButtons = function(channel, control, value, status, group) { } } } else if (MC7000.PADModeCueLoop[deckNumber]) { - return; + // TODO } else if (MC7000.PADModeFlip[deckNumber]) { - return; + // TODO } else if (MC7000.PADModeRoll[deckNumber]) { // TODO(all): check for actual beatloop_size and apply back after a PAD Roll i = control - 0x14; @@ -561,7 +561,7 @@ MC7000.PadButtons = function(channel, control, value, status, group) { midi.sendShortMsg(0x94 + deckOffset, control, MC7000.padColor.sliceron); } } else if (MC7000.PADModeSlicerLoop[deckNumber]) { - return; + // TODO } else if (MC7000.PADModeSampler[deckNumber]) { for (i = 1; i <= 8; i++) { if (control === 0x14 + i - 1 && value >= 0x01) { @@ -589,9 +589,9 @@ MC7000.PadButtons = function(channel, control, value, status, group) { } } } else if (MC7000.PADModeVelSamp[deckNumber]) { - return; + // TODO } else if (MC7000.PADModePitch[deckNumber]) { - return; + // TODO } }; @@ -883,6 +883,22 @@ MC7000.censor = function(channel, control, value, status, group) { } }; +// Auto-Loop Button +MC7000.autoLoop = function(channel, control, value, status, group) { + if (value) { // Button Down == 0x7F + if (engine.getValue(group, "loop_enabled")) { + engine.setValue(group, "loop_enabled", false); + engine.setValue(group, "reloop_toggle", true); + } else { + // NOTE: + // `script.toggleControl` does not work here, + // so we have to do it manually. + engine.setValue(group, "beatloop_activate", true); + engine.setValue(group, "beatloop_activate", false); + } + } +}; + // Set Crossfader Curve MC7000.crossFaderCurve = function(control, value) { script.crossfaderCurve(value); diff --git a/res/controllers/Denon-MC7000.midi.xml b/res/controllers/Denon-MC7000.midi.xml index fa66ed534fe5..e2341fcf6a2e 100644 --- a/res/controllers/Denon-MC7000.midi.xml +++ b/res/controllers/Denon-MC7000.midi.xml @@ -1645,42 +1645,42 @@ [Channel1] - beatloop_activate + MC7000.autoLoop AutoLoop Ch1 0x94 0x32 - + [Channel2] - beatloop_activate + MC7000.autoLoop AutoLoop Ch2 0x95 0x32 - + [Channel3] - beatloop_activate + MC7000.autoLoop AutoLoop Ch3 0x96 0x32 - + [Channel4] - beatloop_activate + MC7000.autoLoop AutoLoop Ch4 0x97 0x32 - +