From 57107c831ff071d16faeff8ef0507aa232eb1a78 Mon Sep 17 00:00:00 2001 From: Bim Overbohm Date: Thu, 18 Aug 2022 18:49:54 +0200 Subject: [PATCH] Map more controls --- Reloop_Mixage_IE_MIDI_1.midi.xml | 314 +++++++++++++++++-------------- reloop_mixage_ie_scripts.js | 203 ++++++++++++++------ 2 files changed, 322 insertions(+), 195 deletions(-) mode change 100644 => 100755 Reloop_Mixage_IE_MIDI_1.midi.xml mode change 100644 => 100755 reloop_mixage_ie_scripts.js diff --git a/Reloop_Mixage_IE_MIDI_1.midi.xml b/Reloop_Mixage_IE_MIDI_1.midi.xml old mode 100644 new mode 100755 index 21ab5c7..16293d0 --- a/Reloop_Mixage_IE_MIDI_1.midi.xml +++ b/Reloop_Mixage_IE_MIDI_1.midi.xml @@ -3,7 +3,7 @@ Reloop Mixage IE Bim Overbohm - Mapping for the Reloop Mixage Interface Edition controller. Should also work on the non-interface version. Requires reloop_mixage_ie_script.js in the same directory to function properly. This is v0.9.0 and it needs Mixxx 2.1+. See https://github.com/HorstBaerbel/MixxxReloopMixageMappings for the most current version. + Mapping for the Reloop Mixage Interface Edition controller. Should also work on the non-interface version. Requires reloop_mixage_ie_script.js in the same directory to function properly. This is v0.9.5 and it needs Mixxx 2.1+. See https://github.com/HorstBaerbel/MixxxReloopMixageMappings for the most current version. @@ -21,7 +21,16 @@ [Channel2] - cue_set + MixageIE.wheelTurn + 0xB0 + 0x25 + + + + + + [Channel2] + cue_gotoandstop 0x90 0x17 @@ -30,11 +39,20 @@ [Channel2] - MixageIE.wheelTurn - 0xB0 - 0x25 + cue_default + 0x90 + 0x19 - + + + + + [Channel2] + cue_gotoandplay + 0x90 + 0x18 + + @@ -48,36 +66,36 @@ [Channel1] - rate_temp_down + cue_gotoandstop 0x90 - 0x01 + 0x09 - [QuickEffectRack1_[Channel1]] - super1 - 0xB0 - 0x34 + [Channel1] + cue_default + 0x90 + 0x0B - [Channel2] - rate_temp_up + [Channel1] + rate_temp_down 0x90 - 0x10 + 0x01 - [QuickEffectRack1_[Channel2]] - super1 - 0xB0 - 0x3A + [Channel2] + rate_temp_up + 0x90 + 0x10 @@ -136,15 +154,6 @@ - - [EqualizerRack1_[Channel1]_Effect1] - parameter1 - 0xB0 - 0x37 - - - - [Channel2] beatloop_activate @@ -172,6 +181,60 @@ + + [EffectRack1_EffectUnit1] + MixageIE.handleEffectMasterOn + 0x90 + 0x46 + + + + + + [EffectRack1_EffectUnit2] + MixageIE.handleEffectMasterOn + 0x90 + 0x54 + + + + + + [EffectRack1_EffectUnit1] + MixageIE.handleEffectChannelOn + 0x90 + 0x08 + + + + + + [EffectRack1_EffectUnit2] + MixageIE.handleEffectChannelOn + 0x90 + 0x16 + + + + + + [EffectRack1_EffectUnit1] + MixageIE.handleEffectChannelSelect + 0x90 + 0x07 + + + + + + [EffectRack1_EffectUnit2] + MixageIE.handleEffectChannelSelect + 0x90 + 0x15 + + + + [EffectRack1_EffectUnit1] MixageIE.handleEffectDryWet @@ -181,6 +244,60 @@ + + [EffectRack1_EffectUnit2] + MixageIE.handleEffectDryWet + 0xB0 + 0x23 + + + + + + [EffectRack1_EffectUnit1] + MixageIE.handleEffectSuper + 0xB0 + 0x60 + + + + + + [EffectRack1_EffectUnit2] + MixageIE.handleEffectSuper + 0xB0 + 0x62 + + + + + + [EqualizerRack1_[Channel1]_Effect1] + parameter1 + 0xB0 + 0x37 + + + + + + [EqualizerRack1_[Channel1]_Effect1] + parameter2 + 0xB0 + 0x36 + + + + + + [EqualizerRack1_[Channel1]_Effect1] + parameter3 + 0xB0 + 0x35 + + + + [EqualizerRack1_[Channel2]_Effect1] parameter1 @@ -191,30 +308,48 @@ - [Channel2] - MixageIE.handleBeatMovePressed - 0x90 - 0x22 + [EqualizerRack1_[Channel2]_Effect1] + parameter2 + 0xB0 + 0x3C - + - [Channel2] - cue_default - 0x90 - 0x19 + [EqualizerRack1_[Channel2]_Effect1] + parameter3 + 0xB0 + 0x3B + + + + + + [QuickEffectRack1_[Channel1]] + super1 + 0xB0 + 0x34 + + + + + + [QuickEffectRack1_[Channel2]] + super1 + 0xB0 + 0x3A [Channel2] - cue_default + MixageIE.handleBeatMovePressed 0x90 - 0x19 + 0x22 - + @@ -253,15 +388,6 @@ - - [EqualizerRack1_[Channel1]_Effect1] - parameter2 - 0xB0 - 0x36 - - - - [Channel2] MixageIE.scratchActive @@ -289,15 +415,6 @@ - - [Channel1] - cue_set - 0x90 - 0x09 - - - - [Channel1] MixageIE.handleBeatMoveLength @@ -307,15 +424,6 @@ - - [EqualizerRack1_[Channel2]_Effect1] - parameter2 - 0xB0 - 0x3C - - - - [Channel2] MixageIE.wheelTouch @@ -325,15 +433,6 @@ - - [Channel2] - cue_gotoandplay - 0x90 - 0x18 - - - - [Channel1] pregain @@ -379,15 +478,6 @@ - - [EffectRack1_EffectUnit2] - MixageIE.handleEffectDryWet - 0xB0 - 0x23 - - - - [Channel1] MixageIE.wheelTouch @@ -486,24 +576,6 @@ - - [Channel1] - cue_default - 0x90 - 0x0B - - - - - - [Channel1] - cue_default - 0x90 - 0x0B - - - - [Channel2] volume @@ -530,33 +602,6 @@ - - [EqualizerRack1_[Channel1]_Effect1] - parameter3 - 0xB0 - 0x35 - - - - - - [EffectRack1_EffectUnit1] - group_[Channel1]_enable - 0x90 - 0x08 - - - - - - [EffectRack1_EffectUnit2] - group_[Channel2]_enable - 0x90 - 0x16 - - - - [Channel2] MixageIE.scrollActive @@ -602,15 +647,6 @@ - - [EqualizerRack1_[Channel2]_Effect1] - parameter3 - 0xB0 - 0x3B - - - - diff --git a/reloop_mixage_ie_scripts.js b/reloop_mixage_ie_scripts.js old mode 100644 new mode 100755 index 4b4b796..6e089f3 --- a/reloop_mixage_ie_scripts.js +++ b/reloop_mixage_ie_scripts.js @@ -1,6 +1,6 @@ // Name: Reloop Mixage IE // Author: Bim Overbohm -// Version: 0.9.0, needs Mixxx 2.1+ +// Version: 0.9.5, needs Mixxx 2.1+ var MixageIE = {}; @@ -13,64 +13,78 @@ MixageIE.scratchPressed = false; MixageIE.scrollPressed = false; MixageIE.scratchByWheelTouch = false; MixageIE.beatMovePressed = false; +MixageIE.effectRackSelected = [[true, false], [true, false]]; // if effect rack 1/2 is selected for channel 1/2 +MixageIE.effectRackEnabled = [false, false]; // if effect rack 1/2 is enabled for channel 1/2 MixageIE.init = function (id, debugging) { MixageIE.connectControlsToFunctions('[Channel1]'); MixageIE.connectControlsToFunctions('[Channel2]'); // all buttons off for (var i = 0; i < 255; i++) { - midi.sendShortMsg(0x90, i, 0); + midi.sendShortMsg(0x90, i, 0); } // start timers for updating the VU meters MixageIE.updateVUMetersTimer = engine.beginTimer(33, MixageIE.updateVUMeters); engine.scratchDisable(1); engine.scratchDisable(2); + // disable effects for both channels + engine.setValue('[EffectRack1_EffectUnit1]', 'group_[Channel1]_enable', false); + engine.setValue('[EffectRack1_EffectUnit2]', 'group_[Channel1]_enable', false); + engine.setValue('[EffectRack1_EffectUnit1]', 'group_[Channel2]_enable', false); + engine.setValue('[EffectRack1_EffectUnit2]', 'group_[Channel2]_enable', false); } - -MixageIE.shutdown = function() { + +MixageIE.shutdown = function () { engine.stopTimer(MixageIE.updateVUMetersTimer); MixageIE.setLibraryMaximized(false); MixageIE.connectControlsToFunctions('[Channel1]', true); MixageIE.connectControlsToFunctions('[Channel2]', true); // all button LEDs off for (var i = 0; i < 255; i++) { - midi.sendShortMsg(0x90, i, 0); + midi.sendShortMsg(0x90, i, 0); } } // Maps channels and their controls to a MIDI control number to toggle their LEDs MixageIE.ledMap = { - '[Channel1]': { + '[Channel1]': { 'cue_indicator': 0x0A, - 'cue_default': 0x0B, - 'play_indicator': 0x0C, - 'pfl': 0x0E - }, - '[Channel2]': { + 'cue_default': 0x0B, + 'play_indicator': 0x0C, + 'pfl': 0x0E, + 'loop_enabled': 0x06, + 'master_on': 0x07, + 'fx_on': 0x08 + }, + '[Channel2]': { 'cue_indicator': 0x18, 'cue_default': 0x19, - 'play_indicator': 0x1A, - 'pfl': 0x1C - } + 'play_indicator': 0x1A, + 'pfl': 0x1C, + 'loop_enabled': 0x14, + 'master_on': 0x15, + 'fx_on': 0x16 + } }; // Maps mixxx controls to a function that toggles their LEDs MixageIE.connectionMap = { 'cue_indicator': 'MixageIE.toggleLED', 'cue_default': 'MixageIE.toggleLED', - 'play_indicator': 'MixageIE.handlePlay', - 'pfl': 'MixageIE.toggleLED' + 'play_indicator': 'MixageIE.handlePlay', + 'pfl': 'MixageIE.toggleLED', + 'loop_enabled': 'MixageIE.toggleLED' }; // Set or remove functions to call when the state of a mixxx control changes MixageIE.connectControlsToFunctions = function (group, remove) { remove = (typeof remove !== 'undefined') ? remove : false; - for (var control in MixageIE.connectionMap) { - engine.connectControl(group, control, MixageIE.connectionMap[control], remove) - if (! remove) { - engine.trigger(group, control) - } - } + for (var control in MixageIE.connectionMap) { + engine.connectControl(group, control, MixageIE.connectionMap[control], remove) + if (!remove) { + engine.trigger(group, control) + } + } } // Toggle the LED on the MIDI controller by sending a MIDI message @@ -78,7 +92,7 @@ MixageIE.toggleLED = function (value, group, control) { midi.sendShortMsg(0x90, MixageIE.ledMap[group][control], (value === 1) ? 0x7F : 0); } -MixageIE.updateVUMeters = function() { +MixageIE.updateVUMeters = function () { midi.sendShortMsg(0x90, 29, engine.getValue('[Channel1]', 'VuMeter') * 7); midi.sendShortMsg(0x90, 30, engine.getValue('[Channel2]', 'VuMeter') * 7); } @@ -155,7 +169,7 @@ MixageIE.setLibraryMaximized = function (visible) { } MixageIE.libraryRemainingTime = 0; engine.setValue('[Master]', 'maximize_library', false); - } + } } MixageIE.libraryCheckTimeout = function () { @@ -174,13 +188,13 @@ MixageIE.scratchActive = function (channel, control, value, status, group) { var deckNr = control === 0x04 ? 1 : 2; if (value === 0x7F) { MixageIE.scratchPressed = true; - var alpha = 1.0/8.0; - var beta = alpha/32.0; + var alpha = 1.0 / 8.0; + var beta = alpha / 32.0; engine.scratchEnable(deckNr, 620, 20.0/*33.0+1.0/3.0*/, alpha, beta); - } else { + } else { MixageIE.scratchPressed = false; - engine.scratchDisable(deckNr); - } + engine.scratchDisable(deckNr); + } } // The "magnifying glass" button that enables/disables playlist scrolling @@ -200,24 +214,24 @@ MixageIE.wheelTouch = function (channel, control, value, status, group) { // calculate deck number from MIDI control. 0x24 controls deck 1, 0x25 deck 2 var deckNr = control - 0x24 + 1; if (value === 0x7F) { - var alpha = 1.0/8; - var beta = alpha/32.0; - engine.scratchEnable(deckNr, 620, 33.0+1.0/3.0, alpha, beta); + var alpha = 1.0 / 8; + var beta = alpha / 32.0; + engine.scratchEnable(deckNr, 620, 33.0 + 1.0 / 3.0, alpha, beta); } else { - engine.scratchDisable(deckNr); + engine.scratchDisable(deckNr); } } } - + // The wheel that actually controls the scratching / jogging MixageIE.wheelTurn = function (channel, control, value, status, group) { // calculate deck number from MIDI control. 0x24 controls deck 1, 0x25 deck 2 var deckNr = control - 0x24 + 1; - // Control centers on 0x40 (64), calculate difference to that value - var newValue = value - 64; - // In either case, register the movement - if (MixageIE.scratchPressed) { - engine.scratchTick(deckNr, newValue); // scratch + // Control centers on 0x40 (64), calculate difference to that value + var newValue = value - 64; + // In either case, register the movement + if (MixageIE.scratchPressed) { + engine.scratchTick(deckNr, newValue); // scratch } else { engine.scratchDisable(deckNr); @@ -225,47 +239,124 @@ MixageIE.wheelTurn = function (channel, control, value, status, group) { if (MixageIE.scrollPressed) { MixageIE.scrollLibrary(newValue); } - //engine.setValue('[Channel'+deckNr+']', 'jog', newValue); // Pitch bend + //engine.setValue('[Channel'+deckNr+']', 'jog', newValue); // Pitch bend +} + +// The MASTER button that toggles routing master through effects +MixageIE.handleEffectMasterOn = function (channel, control, value, status, group) { + // calculate effect unit number from MIDI control. 0x46 controls unit 1, 0x54 unit 2 + var unitNr = control === 0x46 ? 1 : 2; + // react only on first message / keydown + if (value === 0x7F) { + // check and toggle enablement + var controlString = '[EffectRack1_EffectUnit' + unitNr + ']'; + var keyString = 'group_[Master]_enable'; + var isEnabled = !engine.getValue(controlString, keyString); + engine.setValue(controlString, keyString, isEnabled); + MixageIE.toggleLED(isEnabled ? 1 : 0, '[Channel' + unitNr + ']', 'master_on'); + } +} + +// The FX ON button that toggles routing channel 1/2 through effects +MixageIE.handleEffectChannelOn = function (channel, control, value, status, group) { + // calculate effect unit number from MIDI control. 0x08 controls unit 1, 0x16 unit 2 + var unitNr = control === 0x08 ? 1 : 2; + // react only on first message / keydown + if (value === 0x7F) { + // check and toggle enablement + MixageIE.effectRackEnabled[unitNr - 1] = !MixageIE.effectRackEnabled[unitNr - 1]; + var isEnabled = MixageIE.effectRackEnabled[unitNr - 1]; + // update controls + var keyString = 'group_[Channel' + unitNr + ']_enable'; + engine.setValue('[EffectRack1_EffectUnit1]', keyString, isEnabled && MixageIE.effectRackSelected[unitNr - 1][0]); + engine.setValue('[EffectRack1_EffectUnit2]', keyString, isEnabled && MixageIE.effectRackSelected[unitNr - 1][1]); + MixageIE.toggleLED(isEnabled ? 1 : 0, '[Channel' + unitNr + ']', 'fx_on'); + } +} + +// The FX SEL button that selects which effects are enabled for channel 1/2 +MixageIE.handleEffectChannelSelect = function (channel, control, value, status, group) { + // calculate effect unit number from MIDI control. 0x07 controls unit 1, 0x15 unit 2 + var unitNr = control === 0x07 ? 1 : 2; + // react only on first message / keydown + if (value === 0x7F) { + // check and toggle select state + var selected1 = MixageIE.effectRackSelected[unitNr - 1][0]; + var selected2 = MixageIE.effectRackSelected[unitNr - 1][1]; + if (selected1 && selected2) { + selected1 = true; + selected2 = false; + } + else if (selected1) { + selected1 = false; + selected2 = true; + } + else { + selected1 = true; + selected2 = true; + } + MixageIE.effectRackSelected[unitNr - 1][0] = selected1; + MixageIE.effectRackSelected[unitNr - 1][1] = selected2; + // update controls + var isEnabled = MixageIE.effectRackEnabled[unitNr - 1]; + var keyString = 'group_[Channel' + unitNr + ']_enable'; + engine.setValue('[EffectRack1_EffectUnit1]', keyString, isEnabled && MixageIE.effectRackSelected[unitNr - 1][0]); + engine.setValue('[EffectRack1_EffectUnit2]', keyString, isEnabled && MixageIE.effectRackSelected[unitNr - 1][1]); + } } MixageIE.handleEffectDryWet = function (channel, control, value, status, group) { // calculate effect unit number from MIDI control. 0x21 controls unit 1, 0x25 unit 2 var unitNr = control === 0x21 ? 1 : 2; - // Control centers on 0x40 (64), calculate difference to that value and multiply by 4 - var diff = (value - 64) / 10.0; - // In either case, register the movement - var controlString = '[EffectRack1_EffectUnit'+unitNr+']'; - var value = engine.getValue(controlString, 'mix'); + // Control centers on 0x40 (64), calculate difference to that value and multiply by 4 + var diff = (value - 64) / 10.0; + // In either case, register the movement + var controlString = '[EffectRack1_EffectUnit' + unitNr + ']'; + var value = engine.getValue(controlString, 'mix'); engine.setValue(controlString, 'mix', value + diff); } +// The PAN rotatry control used here for the overall effect super control +MixageIE.handleEffectSuper = function (channel, control, value, status, group) { + // calculate effect unit number from MIDI control. 0x60 controls unit 1, 0x62 unit 2 + var unitNr = control === 0x60 ? 1 : 2; + // Control centers on 0x40 (64), calculate difference to that value and multiply by 4 + var diff = (value - 64) / 10.0; + // In either case, register the movement + var controlString = '[EffectRack1_EffectUnit' + unitNr + ']'; + var value = engine.getValue(controlString, 'super1'); + engine.setValue(controlString, 'super1', value + diff); +} + MixageIE.handleBeatMovePressed = function (channel, control, value, status, group) { - MixageIE.beatMovePressed = value === 0x7f; + MixageIE.beatMovePressed = value === 0x7f; } MixageIE.handleBeatMoveLength = function (channel, control, value, status, group) { // calculate effect unit number from MIDI control. 0x20 controls unit 1, 0x22 unit 2 var unitNr = control === 0x20 ? 1 : 2; + var moveDirection = unitNr == 1 ? 1 : -1; // Control centers on 0x40 (64), calculate difference to that var diff = (value - 64); // In either case, register the movement if (MixageIE.beatMovePressed) { - var value = engine.getParameter('[Channel'+unitNr+']', 'beatjump_size'); - value = diff > 0 ? 2 * value : value / 2; - engine.setParameter('[Channel'+unitNr+']', 'beatjump_size', value); + var value = engine.getParameter('[Channel' + unitNr + ']', 'beatjump_size'); + value = moveDirection * diff > 0 ? 2 * value : value / 2; + engine.setParameter('[Channel' + unitNr + ']', 'beatjump_size', value); } else { - var direction = diff > 0 ? 'loop_double' : 'loop_halve'; - engine.setValue('[Channel'+unitNr+']', direction, true); + var direction = moveDirection * diff > 0 ? 'loop_double' : 'loop_halve'; + engine.setValue('[Channel' + unitNr + ']', direction, true); } } MixageIE.handleBeatMove = function (channel, control, value, status, group) { // calculate effect unit number from MIDI control. 0x5f controls unit 1, 0x61 unit 2 var unitNr = control === 0x5f ? 1 : 2; - // Control centers on 0x40 (64), calculate difference to that - var diff = (value - 64); - // In either case, register the movement - var direction = diff > 0 ? 'beatjump_forward' : 'beatjump_backward'; - engine.setValue('[Channel'+unitNr+']', direction, true); + var moveDirection = unitNr == 1 ? 1 : -1; + // Control centers on 0x40 (64), calculate difference to that + var diff = (value - 64); + // In either case, register the movement + var direction = moveDirection * diff > 0 ? 'beatjump_forward' : 'beatjump_backward'; + engine.setValue('[Channel' + unitNr + ']', direction, true); }