Skip to content

Commit

Permalink
DDJ-400: script control of rate sliders to correct behavior
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dj3730 authored and jusko committed Jan 30, 2021
1 parent 663607f commit 218ec25
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 16 deletions.
28 changes: 28 additions & 0 deletions res/controllers/Pioneer-DDJ-400-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 12 additions & 16 deletions res/controllers/Pioneer-DDJ-400.midi.xml
Original file line number Diff line number Diff line change
Expand Up @@ -323,47 +323,43 @@
</control>

<control>
<description>TEMPO (DECK1) - fader - Tempo control</description>
<description>TEMPO (DECK1) - fader - Tempo control LSB</description>
<group>[Channel1]</group>
<key>rate</key>
<key>PioneerDDJ400.tempoSliderLSB</key>
<status>0xB0</status>
<midino>0x20</midino>
<options>
<fourteen-bit-lsb/>
<soft-takeover/>
<script-binding/>
</options>
</control>
<control>
<description>TEMPO (DECK1) - fader - Tempo control</description>
<description>TEMPO (DECK1) - fader - Tempo control MSB</description>
<group>[Channel1]</group>
<key>rate</key>
<key>PioneerDDJ400.tempoSliderMSB</key>
<status>0xB0</status>
<midino>0x00</midino>
<options>
<fourteen-bit-msb/>
<soft-takeover/>
<script-binding/>
</options>
</control>
<control>
<description>TEMPO (DECK2) - fader - Tempo control</description>
<description>TEMPO (DECK2) - fader - Tempo control LSB</description>
<group>[Channel2]</group>
<key>rate</key>
<key>PioneerDDJ400.tempoSliderLSB</key>
<status>0xB1</status>
<midino>0x20</midino>
<options>
<fourteen-bit-lsb/>
<soft-takeover/>
<script-binding/>
</options>
</control>
<control>
<description>TEMPO (DECK2) - fader - Tempo control</description>
<description>TEMPO (DECK2) - fader - Tempo control MSB</description>
<group>[Channel2]</group>
<key>rate</key>
<key>PioneerDDJ400.tempoSliderMSB</key>
<status>0xB1</status>
<midino>0x00</midino>
<options>
<fourteen-bit-msb/>
<soft-takeover/>
<script-binding/>
</options>
</control>

Expand Down

0 comments on commit 218ec25

Please sign in to comment.