Skip to content

Commit

Permalink
Merge pull request #4755 from fwcd/fix-mc7000-shift-inversion-bug
Browse files Browse the repository at this point in the history
MC7000: Fix 'inverted shift' bug in the controller mapping
  • Loading branch information
Swiftb0y authored May 16, 2022
2 parents 826a010 + ffdaa4e commit 0f2274b
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 1 deletion.
29 changes: 28 additions & 1 deletion res/controllers/Denon-MC7000-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ MC7000.factor = [];
//Set Shift button state to false as default
MC7000.shift = [false, false, false, false];

// For each side whether the top or bottom deck is active.
MC7000.topDeckActive = [true, true];

// initialize the PAD Mode to Hot Cue and all others off when starting
MC7000.PADModeCue = [true, true, true, true];
MC7000.PADModeCueLoop = [false, false, false, false];
Expand Down Expand Up @@ -181,6 +184,10 @@ MC7000.init = function() {
engine.makeConnection("[Channel3]", "VuMeter", MC7000.VuMeter);
engine.makeConnection("[Channel4]", "VuMeter", MC7000.VuMeter);

// Switch to active decks
midi.sendShortMsg(MC7000.topDeckActive[0] ? 0x90 : 0x92, 0x08, 0x7F);
midi.sendShortMsg(MC7000.topDeckActive[1] ? 0x91 : 0x93, 0x08, 0x7F);

// Platter Ring LED mode
midi.sendShortMsg(0x90, 0x64, MC7000.modeSingleLED);
midi.sendShortMsg(0x91, 0x64, MC7000.modeSingleLED);
Expand Down Expand Up @@ -597,7 +604,7 @@ MC7000.PadButtons = function(channel, control, value, status, group) {
// Shift Button
MC7000.shiftButton = function(channel, control, value, status, group) {
var deckOffset = script.deckFromGroup(group) - 1;
MC7000.shift[deckOffset] = ! MC7000.shift[deckOffset];
MC7000.shift[deckOffset] = value > 0;
midi.sendShortMsg(0x90 + deckOffset, 0x32,
MC7000.shift[deckOffset] ? 0x7F : 0x01);
};
Expand Down Expand Up @@ -887,6 +894,26 @@ MC7000.crossFaderCurve = function(control, value) {
script.crossfaderCurve(value);
};

// Update state on deck changes
MC7000.switchDeck = function(channel, control, value, status) {
var deckOffset = status - 0x90;
var isTopDeck = deckOffset < 2;
var side = deckOffset % 2;
var previousDeckOffset = (deckOffset + 2) % 4;

// We need to 'transfer' the shift state when switching decks,
// otherwise it will get stuck and result in an 'inverted'
// shift after switching back to the deck.
// Since the controller switches immediately upon pressing down,
// we only do this when value is high.

if (value === 0x7F && MC7000.topDeckActive[side] !== isTopDeck) {
MC7000.topDeckActive[side] = isTopDeck;
MC7000.shift[deckOffset] = MC7000.shift[previousDeckOffset];
MC7000.shift[previousDeckOffset] = false;
}
};

// Set FX wet/dry value
MC7000.fxWetDry = function(channel, control, value, status, group) {
var numTicks = (value < 0x64) ? value : (value - 128);
Expand Down
41 changes: 41 additions & 0 deletions res/controllers/Denon-MC7000.midi.xml
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,47 @@
<script-binding/>
</options>
</control>
<!-- DECK BUTTONS -->
<control>
<group>[Channel1]</group>
<key>MC7000.switchDeck</key>
<description>Switch to deck 1</description>
<status>0x90</status>
<midino>0x08</midino>
<options>
<script-binding/>
</options>
</control>
<control>
<group>[Channel2]</group>
<key>MC7000.switchDeck</key>
<description>Switch to deck 2</description>
<status>0x91</status>
<midino>0x08</midino>
<options>
<script-binding/>
</options>
</control>
<control>
<group>[Channel3]</group>
<key>MC7000.switchDeck</key>
<description>Switch to deck 3</description>
<status>0x92</status>
<midino>0x08</midino>
<options>
<script-binding/>
</options>
</control>
<control>
<group>[Channel4]</group>
<key>MC7000.switchDeck</key>
<description>Switch to deck 4</description>
<status>0x93</status>
<midino>0x08</midino>
<options>
<script-binding/>
</options>
</control>
<!-- FX WET/DRY + SAMPLER + CROSS FADER CURVE -->
<control>
<group>[EffectRack1_EffectUnit1]</group>
Expand Down

0 comments on commit 0f2274b

Please sign in to comment.