From 97f965e08e4fa70c993175989a5d97440c8b4811 Mon Sep 17 00:00:00 2001 From: Markus Kohlhase Date: Sun, 19 Sep 2021 21:13:59 +0200 Subject: [PATCH] Denon MC7000: Use parameter buttons for beat jumps --- res/controllers/Denon-MC7000-scripts.js | 40 +++++++++++++ res/controllers/Denon-MC7000.midi.xml | 80 ++++++++++++------------- 2 files changed, 80 insertions(+), 40 deletions(-) diff --git a/res/controllers/Denon-MC7000-scripts.js b/res/controllers/Denon-MC7000-scripts.js index ca19170622d..d76b7c9de27 100644 --- a/res/controllers/Denon-MC7000-scripts.js +++ b/res/controllers/Denon-MC7000-scripts.js @@ -846,6 +846,46 @@ MC7000.autoLoop = function(channel, control, value, status, group) { } }; +// Parameter Button '<' +MC7000.parameterButtonDown = function(channel, control, value, status, group) { + if (value) { + script.triggerControl(group, "beatjump_backward"); + } +}; + +// Parameter Button '>' +MC7000.parameterButtonUp = function(channel, control, value, status, group) { + if (value) { + script.triggerControl(group, "beatjump_forward"); + } +}; + +// Parameter Button '<' + 'SHIFT' +MC7000.parameterButtonDownShifted = function(channel, control, value, status, group) { + if (value) { + const beatJumpSize = engine.getValue(group, "beatjump_size"); + let decreasedIndex = MC7000.beatJump.indexOf(beatJumpSize) - 1; + if (decreasedIndex < 0) { + decreasedIndex = 0; + } + const newBeatJumpSize = MC7000.beatJump[decreasedIndex]; + engine.setValue(group, "beatjump_size", newBeatJumpSize); + } +}; + +// Parameter Button '>' + 'SHIFT' +MC7000.parameterButtonUpShifted = function(channel, control, value, status, group) { + if (value) { + const beatjumpSize = engine.getValue(group, "beatjump_size"); + let increasedIndex = MC7000.beatJump.indexOf(beatjumpSize) + 1; + if (increasedIndex >= MC7000.beatJump.length) { + increasedIndex = MC7000.beatJump.length === 0 ? 0 : MC7000.beatJump.length - 1; + } + const newBeatJumpSize = MC7000.beatJump[increasedIndex]; + engine.setValue(group, "beatjump_size", newBeatJumpSize); + } +}; + // 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 4d613c9dbb9..871f6dc64c0 100644 --- a/res/controllers/Denon-MC7000.midi.xml +++ b/res/controllers/Denon-MC7000.midi.xml @@ -1886,162 +1886,162 @@ [Channel1] - stars_down + MC7000.parameterButtonDown 0x94 0x28 - + [Channel1] - stars_up + MC7000.parameterButtonUp 0x94 0x29 - + - [Library] - track_color_prev + [Channel1] + MC7000.parameterButtonDownShifted 0x94 0x2A - + - [Library] - track_color_next + [Channel1] + MC7000.parameterButtonUpShifted 0x94 0x2B - + [Channel2] - stars_down + MC7000.parameterButtonDown 0x95 0x28 - + [Channel2] - stars_up + MC7000.parameterButtonUp 0x95 0x29 - + - [Library] - track_color_prev + [Channel2] + MC7000.parameterButtonDownShifted 0x95 0x2A - + - [Library] - track_color_next + [Channel2] + MC7000.parameterButtonUpShifted 0x95 0x2B - + [Channel3] - stars_down + MC7000.parameterButtonDown 0x96 0x28 - + [Channel3] - stars_up + MC7000.parameterButtonUp 0x96 0x29 - + - [Library] - track_color_prev + [Channel3] + MC7000.parameterButtonDownShifted 0x96 0x2A - + - [Library] - track_color_next + [Channel3] + MC7000.parameterButtonUpShifted 0x96 0x2B - + [Channel4] - stars_down + MC7000.parameterButtonDown 0x97 0x28 - + [Channel4] - stars_up + MC7000.parameterButtonUp 0x97 0x29 - + - [Library] - track_color_prev + [Channel4] + MC7000.parameterButtonDownShifted 0x97 0x2A - + - [Library] - track_color_next + [Channel4] + MC7000.parameterButtonUpShifted 0x97 0x2B - +