From 218ec25d72676b3571e4e70c365d08980de446ff Mon Sep 17 00:00:00 2001 From: dj3730 Date: Mon, 2 Mar 2020 20:24:35 -0600 Subject: [PATCH] DDJ-400: script control of rate sliders to correct behavior when mapped directly in the xml, the on-screen slider behavior is inverted from the physical slider behavior i.e. moving the physical slider UP results in the on-screen slider moving DOWN the functions PioneerDDJ400.tempoSliderMSB and PioneerDDJ400.tempoSliderLSB were adapted from the Pioneer-DDJ-SB2-script.js mapping file --- res/controllers/Pioneer-DDJ-400-script.js | 28 +++++++++++++++++++++++ res/controllers/Pioneer-DDJ-400.midi.xml | 28 ++++++++++------------- 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/res/controllers/Pioneer-DDJ-400-script.js b/res/controllers/Pioneer-DDJ-400-script.js index 6d29ba46462..ccf4ae395a7 100644 --- a/res/controllers/Pioneer-DDJ-400-script.js +++ b/res/controllers/Pioneer-DDJ-400-script.js @@ -217,6 +217,34 @@ PioneerDDJ400.jogTouch = function(channel, _control, value) { } }; +/////////////////////////////////////////////////////////////// +// HIGH RESOLUTION MIDI INPUT HANDLERS // +/////////////////////////////////////////////////////////////// + +PioneerDDJ400.highResMSB = { + '[Channel1]': {}, + '[Channel2]': {}, + '[Channel3]': {}, + '[Channel4]': {} +}; + + +PioneerDDJ400.tempoSliderMSB = function (channel, control, value, status, group) { + PioneerDDJ400.highResMSB[group].tempoSlider = value; +}; + +PioneerDDJ400.tempoSliderLSB = function (channel, control, value, status, group) { + var fullValue = (PioneerDDJ400.highResMSB[group].tempoSlider << 7) + value; + + engine.setValue( + group, + 'rate', + ((0x4000 - fullValue) - 0x2000) / 0x2000 + ); + + +}; + PioneerDDJ400.cycleTempoRange = function(_channel, _control, value, _status, group) { "use strict"; if (value === 0) return; // ignore release diff --git a/res/controllers/Pioneer-DDJ-400.midi.xml b/res/controllers/Pioneer-DDJ-400.midi.xml index b1aee902c79..0e64bf658f0 100644 --- a/res/controllers/Pioneer-DDJ-400.midi.xml +++ b/res/controllers/Pioneer-DDJ-400.midi.xml @@ -323,47 +323,43 @@ - TEMPO (DECK1) - fader - Tempo control + TEMPO (DECK1) - fader - Tempo control LSB [Channel1] - rate + PioneerDDJ400.tempoSliderLSB 0xB0 0x20 - - + - TEMPO (DECK1) - fader - Tempo control + TEMPO (DECK1) - fader - Tempo control MSB [Channel1] - rate + PioneerDDJ400.tempoSliderMSB 0xB0 0x00 - - + - TEMPO (DECK2) - fader - Tempo control + TEMPO (DECK2) - fader - Tempo control LSB [Channel2] - rate + PioneerDDJ400.tempoSliderLSB 0xB1 0x20 - - + - TEMPO (DECK2) - fader - Tempo control + TEMPO (DECK2) - fader - Tempo control MSB [Channel2] - rate + PioneerDDJ400.tempoSliderMSB 0xB1 0x00 - - +