Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MC7000: Fix 'inverted shift' bug in the controller mapping #4755

Merged
merged 5 commits into from
May 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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