diff --git a/res/controllers/Denon-MC7000-scripts.js b/res/controllers/Denon-MC7000-scripts.js index 708668ff9c2b..3c95b8edee83 100644 --- a/res/controllers/Denon-MC7000-scripts.js +++ b/res/controllers/Denon-MC7000-scripts.js @@ -24,7 +24,7 @@ * older Linux Kernels. You should upgrade your Kernel to minimum versions * LTS: 4.19.105 or 5.4.21, stable branch 5.5.5 or current 5.6 (2020-Feb-19). * Newer Kernels will provide native audio support for this controller. -**/ + */ var MC7000 = {}; @@ -169,10 +169,10 @@ MC7000.padColor = { /* DECK INITIALIZATION */ MC7000.init = function() { - var i; + let i; // obtain all knob and slider positions - var ControllerStatusSysex = [0xF0, 0x00, 0x20, 0x7F, 0x03, 0x01, 0xF7]; + const ControllerStatusSysex = [0xF0, 0x00, 0x20, 0x7F, 0x03, 0x01, 0xF7]; midi.sendSysexMsg(ControllerStatusSysex, ControllerStatusSysex.length); // VU meters @@ -231,15 +231,15 @@ MC7000.samplerLevel = function(channel, control, value) { engine.setValue("[Samplers]", "show_samplers", false); } //control the 8 sampler volumes with the one knob on the mixer - for (var i = 1; i <= 8; i++) { + for (let i = 1; i <= 8; i++) { engine.setValue("[Sampler"+i+"]", "pregain", script.absoluteNonLin(value, 0, 1.0, 4.0)); } }; // PAD Mode Hot Cue MC7000.padModeCue = function(channel, control, value, status, group) { - var deckNumber = script.deckFromGroup(group); - var deckOffset = deckNumber - 1; + const deckNumber = script.deckFromGroup(group); + const deckOffset = deckNumber - 1; if (value === 0x00) { return; // don't respond to note off messages } @@ -255,7 +255,7 @@ MC7000.padModeCue = function(channel, control, value, status, group) { MC7000.PADModePitch[deckNumber] = false; // change PAD color when switching to Hot Cue Mode - for (var i = 1; i <= 8; i++) { + for (let i = 1; i <= 8; i++) { if (engine.getValue(group, "hotcue_" + i + "_enabled", true)) { midi.sendShortMsg(0x94 + deckOffset, 0x14 + i - 1, MC7000.padColor.hotcueon); } else { @@ -266,8 +266,8 @@ MC7000.padModeCue = function(channel, control, value, status, group) { // PAD Mode Cue Loop MC7000.padModeCueLoop = function(channel, control, value, status, group) { - var deckNumber = script.deckFromGroup(group); - var deckOffset = deckNumber - 1; + const deckNumber = script.deckFromGroup(group); + const deckOffset = deckNumber - 1; if (value === 0x00) { return; // don't respond to note off messages } @@ -283,15 +283,15 @@ MC7000.padModeCueLoop = function(channel, control, value, status, group) { MC7000.PADModePitch[deckNumber] = false; // switch off PAD illumination - for (var i = 0; i < 8; i++) { + for (let i = 0; i < 8; i++) { midi.sendShortMsg(0x94 + deckOffset, 0x14 + i, MC7000.padColor.alloff); } }; // PAD Mode Flip MC7000.padModeFlip = function(channel, control, value, status, group) { - var deckNumber = script.deckFromGroup(group); - var deckOffset = deckNumber - 1; + const deckNumber = script.deckFromGroup(group); + const deckOffset = deckNumber - 1; if (value === 0x00) { return; // don't respond to note off messages } @@ -307,15 +307,15 @@ MC7000.padModeFlip = function(channel, control, value, status, group) { MC7000.PADModePitch[deckNumber] = false; // switch off PAD illumination - for (var i = 0; i < 8; i++) { + for (let i = 0; i < 8; i++) { midi.sendShortMsg(0x94 + deckOffset, 0x1C + i, MC7000.padColor.alloff); } }; // PAD Mode Roll MC7000.padModeRoll = function(channel, control, value, status, group) { - var deckNumber = script.deckFromGroup(group); - var deckOffset = deckNumber - 1; + const deckNumber = script.deckFromGroup(group); + const deckOffset = deckNumber - 1; if (value === 0x00) { return; // don't respond to note off messages } @@ -331,15 +331,15 @@ MC7000.padModeRoll = function(channel, control, value, status, group) { MC7000.PADModePitch[deckNumber] = false; // change PAD color when switching to Roll Mode - for (var i = 0; i < 8; i++) { + for (let i = 0; i < 8; i++) { midi.sendShortMsg(0x94 + deckOffset, 0x14 + i, MC7000.padColor.rolloff); } }; // PAD Mode Saved Loop MC7000.padModeSavedLoop = function(channel, control, value, status, group) { - var deckNumber = script.deckFromGroup(group); - var deckOffset = deckNumber - 1; + const deckNumber = script.deckFromGroup(group); + const deckOffset = deckNumber - 1; if (value === 0x00) { return; // don't respond to note off messages } @@ -355,16 +355,16 @@ MC7000.padModeSavedLoop = function(channel, control, value, status, group) { MC7000.PADModePitch[deckNumber] = false; // change PAD color when switching to Saved Loop Mode - for (var i = 0; i < 8; i++) { - var activeLED = engine.getValue(group, "beatloop_" + MC7000.fixedLoop[i] + "_enabled") ? MC7000.padColor.fixedloopon : MC7000.padColor.fixedloopoff; + for (let i = 0; i < 8; i++) { + const activeLED = engine.getValue(group, "beatloop_" + MC7000.fixedLoop[i] + "_enabled") ? MC7000.padColor.fixedloopon : MC7000.padColor.fixedloopoff; midi.sendShortMsg(0x94 + deckOffset, 0x14 + i, activeLED); } }; // PAD Mode Slicer MC7000.padModeSlicer = function(channel, control, value, status, group) { - var deckNumber = script.deckFromGroup(group); - var deckOffset = deckNumber - 1; + const deckNumber = script.deckFromGroup(group); + const deckOffset = deckNumber - 1; if (value === 0x00) { return; // don't respond to note off messages } @@ -380,15 +380,15 @@ MC7000.padModeSlicer = function(channel, control, value, status, group) { MC7000.PADModePitch[deckNumber] = false; // change PAD color when switching to Slicer Mode - for (var i = 0; i < 8; i++) { + for (let i = 0; i < 8; i++) { midi.sendShortMsg(0x94 + deckOffset, 0x14 + i, MC7000.padColor.sliceron); } }; // PAD Mode Slicer Loop MC7000.padModeSlicerLoop = function(channel, control, value, status, group) { - var deckNumber = script.deckFromGroup(group); - var deckOffset = deckNumber - 1; + const deckNumber = script.deckFromGroup(group); + const deckOffset = deckNumber - 1; if (value === 0x00) { return; // don't respond to note off messages } @@ -404,15 +404,15 @@ MC7000.padModeSlicerLoop = function(channel, control, value, status, group) { MC7000.PADModePitch[deckNumber] = false; // switch off PAD illumination - for (var i = 0; i < 8; i++) { + for (let i = 0; i < 8; i++) { midi.sendShortMsg(0x94 + deckOffset, 0x14 + i, MC7000.padColor.alloff); } }; // PAD Mode Sampler MC7000.padModeSampler = function(channel, control, value, status, group) { - var deckNumber = script.deckFromGroup(group); - var deckOffset = deckNumber - 1; + const deckNumber = script.deckFromGroup(group); + const deckOffset = deckNumber - 1; if (value === 0x00) { return; // don't respond to note off messages } @@ -428,7 +428,7 @@ MC7000.padModeSampler = function(channel, control, value, status, group) { MC7000.PADModePitch[deckNumber] = false; // change PAD color when switching to Sampler Mode - for (var i = 1; i <= 8; i++) { + for (let i = 1; i <= 8; i++) { if (engine.getValue("[Sampler" + i + "]", "play")) { midi.sendShortMsg(0x94 + deckOffset, 0x14 + i - 1, MC7000.padColor.samplerplay); } else if (engine.getValue("[Sampler" + i + "]", "track_loaded") === 0) { @@ -441,8 +441,8 @@ MC7000.padModeSampler = function(channel, control, value, status, group) { // PAD Mode Velocity Sampler MC7000.padModeVelSamp = function(channel, control, value, status, group) { - var deckNumber = script.deckFromGroup(group); - var deckOffset = deckNumber - 1; + const deckNumber = script.deckFromGroup(group); + const deckOffset = deckNumber - 1; if (value === 0x00) { return; // don't respond to note off messages } @@ -458,15 +458,15 @@ MC7000.padModeVelSamp = function(channel, control, value, status, group) { MC7000.PADModePitch[deckNumber] = false; // switch off PAD illumination - for (var i = 0; i < 8; i++) { + for (let i = 0; i < 8; i++) { midi.sendShortMsg(0x94 + deckOffset, 0x14 + i, MC7000.padColor.alloff); } }; // PAD Mode Pitch MC7000.padModePitch = function(channel, control, value, status, group) { - var deckNumber = script.deckFromGroup(group); - var deckOffset = deckNumber - 1; + const deckNumber = script.deckFromGroup(group); + const deckOffset = deckNumber - 1; if (value === 0x00) { return; // don't respond to note off messages } @@ -482,7 +482,7 @@ MC7000.padModePitch = function(channel, control, value, status, group) { MC7000.PADModePitch[deckNumber] = true; // switch off PAD illumination - for (var i = 0; i < 8; i++) { + for (let i = 0; i < 8; i++) { midi.sendShortMsg(0x94 + deckOffset, 0x14 + i, MC7000.padColor.alloff); midi.sendShortMsg(0x94 + deckOffset, 0x1C + i, MC7000.padColor.alloff); } @@ -490,9 +490,18 @@ MC7000.padModePitch = function(channel, control, value, status, group) { // PAD buttons MC7000.PadButtons = function(channel, control, value, status, group) { - var deckNumber = script.deckFromGroup(group); - var deckOffset = deckNumber - 1; - var i, j; + const deckNumber = script.deckFromGroup(group); + const deckOffset = deckNumber - 1; + let i, j; + + // The following modes are currently unhandled and could be + // added as if-branches in the future: + + // - MC7000.PADModeCueLoop + // - MC7000.PADModeFlip + // - MC7000.PADModeSlicerLoop + // - MC7000.PADModeVelSamp + // - MC7000.PADModePitch // activate and clear Hot Cues if (MC7000.PADModeCue[deckNumber] && engine.getValue(group, "track_loaded") === 1) { @@ -512,10 +521,6 @@ MC7000.PadButtons = function(channel, control, value, status, group) { midi.sendShortMsg(0x94 + deckOffset, 0x1C + i - 1, MC7000.padColor.hotcueoff); } } - } else if (MC7000.PADModeCueLoop[deckNumber]) { - return; - } else if (MC7000.PADModeFlip[deckNumber]) { - return; } else if (MC7000.PADModeRoll[deckNumber]) { // TODO(all): check for actual beatloop_size and apply back after a PAD Roll i = control - 0x14; @@ -533,7 +538,7 @@ MC7000.PadButtons = function(channel, control, value, status, group) { i = control - 0x14; engine.setValue(group, "beatloop_" + MC7000.fixedLoop[i] + "_toggle", true); for (j =0; j < 8; j++) { - var activeLED = engine.getValue(group, "beatloop_" + MC7000.fixedLoop[j] + "_enabled") ? MC7000.padColor.fixedloopon : MC7000.padColor.fixedloopoff; + const activeLED = engine.getValue(group, "beatloop_" + MC7000.fixedLoop[j] + "_enabled") ? MC7000.padColor.fixedloopon : MC7000.padColor.fixedloopoff; midi.sendShortMsg(0x94 + deckOffset, 0x14 + j, activeLED); } } else if (MC7000.PADModeSlicer[deckNumber]) { @@ -560,8 +565,6 @@ MC7000.PadButtons = function(channel, control, value, status, group) { } else { midi.sendShortMsg(0x94 + deckOffset, control, MC7000.padColor.sliceron); } - } else if (MC7000.PADModeSlicerLoop[deckNumber]) { - return; } else if (MC7000.PADModeSampler[deckNumber]) { for (i = 1; i <= 8; i++) { if (control === 0x14 + i - 1 && value >= 0x01) { @@ -588,16 +591,12 @@ MC7000.PadButtons = function(channel, control, value, status, group) { } } } - } else if (MC7000.PADModeVelSamp[deckNumber]) { - return; - } else if (MC7000.PADModePitch[deckNumber]) { - return; } }; // Shift Button MC7000.shiftButton = function(channel, control, value, status, group) { - var deckOffset = script.deckFromGroup(group) - 1; + const deckOffset = script.deckFromGroup(group) - 1; MC7000.shift[deckOffset] = ! MC7000.shift[deckOffset]; midi.sendShortMsg(0x90 + deckOffset, 0x32, MC7000.shift[deckOffset] ? 0x7F : 0x01); @@ -608,7 +607,7 @@ MC7000.vinylModeToggle = function(channel, control, value, status, group) { if (value === 0x00) { return; // don't respond to note off messages } - var deckOffset = script.deckFromGroup(group) - 1; + const deckOffset = script.deckFromGroup(group) - 1; MC7000.isVinylMode[deckOffset] = !MC7000.isVinylMode[deckOffset]; midi.sendShortMsg(0x90 + deckOffset, 0x07, MC7000.isVinylMode[deckOffset] ? 0x7F : 0x01); @@ -651,9 +650,9 @@ MC7000.loadButton = function(channel, control, value, status, group) { // The button that enables/disables scratching MC7000.wheelTouch = function(channel, control, value, status, group) { - var deckNumber = script.deckFromGroup(group); - var deckOffset = deckNumber - 1; - var libraryMaximized = engine.getValue("[Master]", "maximize_library") > 0; + const deckNumber = script.deckFromGroup(group); + const deckOffset = deckNumber - 1; + const libraryMaximized = engine.getValue("[Master]", "maximize_library") > 0; if (MC7000.isVinylMode[deckOffset] && !libraryMaximized) { if (value === 0x7F) { engine.scratchEnable(deckNumber, MC7000.jogWheelTicksPerRevolution, @@ -680,22 +679,22 @@ MC7000.wheelTurn = function(channel, control, value, status, group) { // depending on audio latency anymore. // A: For a control that centers on 0: - var numTicks = (value < 0x64) ? value : (value - 128); - var adjustedSpeed = numTicks * MC7000.jogSensitivity / 10; - var deckNumber = script.deckFromGroup(group); - var deckOffset = deckNumber - 1; - var libraryMaximized = engine.getValue("[Master]", "maximize_library"); + const numTicks = (value < 0x64) ? value : (value - 128); + const adjustedSpeed = numTicks * MC7000.jogSensitivity / 10; + const deckNumber = script.deckFromGroup(group); + const deckOffset = deckNumber - 1; + const libraryMaximized = engine.getValue("[Master]", "maximize_library"); if (libraryMaximized === 1 && numTicks > 0) { engine.setValue("[Library]", "MoveDown", 1); } else if (libraryMaximized === 1 && numTicks < 0) { engine.setValue("[Library]", "MoveUp", 1); } else if (engine.isScratching(deckNumber)) { - // Scratch! + // Scratch! engine.scratchTick(deckNumber, numTicks * MC7000.jogSensitivity); } else { if (MC7000.shift[deckOffset]) { // While Shift Button pressed -> Search through track - var jogSearch = 100 * adjustedSpeed; // moves 100 times faster than normal jog + const jogSearch = 100 * adjustedSpeed; // moves 100 times faster than normal jog engine.setValue(group, "jog", jogSearch); } else { // While Shift Button released -> Pitch Bend @@ -706,7 +705,7 @@ MC7000.wheelTurn = function(channel, control, value, status, group) { // Needle Search Touch detection MC7000.needleSearchTouch = function(channel, control, value, status, group) { - var deckNumber = script.deckFromGroup(group); + const deckNumber = script.deckFromGroup(group); if (engine.getValue(group, "play")) { MC7000.needleSearchTouched[deckNumber] = MC7000.needleSearchPlay && (!!value); } else { @@ -717,7 +716,7 @@ MC7000.needleSearchTouch = function(channel, control, value, status, group) { // Needle Search Touch while "SHIFT" button is pressed MC7000.needleSearchTouchShift = function(channel, control, value, status, group) { - var deckNumber = script.deckFromGroup(group); + const deckNumber = script.deckFromGroup(group); MC7000.needleSearchTouched[deckNumber] = !!value; }; @@ -729,10 +728,10 @@ MC7000.needleSearchMSB = function(channel, control, value) { // Needle Search Position detection (MSB + LSB) MC7000.needleSearchStripPosition = function(channel, control, value, status, group) { - var deckNumber = script.deckFromGroup(group); + const deckNumber = script.deckFromGroup(group); if (MC7000.needleSearchTouched[deckNumber]) { - var fullValue = (MC7000.needleDropMSB << 7) + value; // move MSB 7 binary digits to the left and add LSB - var position = (fullValue / 0x3FFF); // divide by all possible positions to get relative between 0 - 1 + const fullValue = (MC7000.needleDropMSB << 7) + value; // move MSB 7 binary digits to the left and add LSB + const position = (fullValue / 0x3FFF); // divide by all possible positions to get relative between 0 - 1 engine.setParameter(group, "playposition", position); } }; @@ -744,8 +743,8 @@ MC7000.pitchFaderMSB = function(channel, control, value) { // Pitch Fader Position (MSB + LSB) MC7000.pitchFaderPosition = function(channel, control, value, status, group) { - var fullValue = (MC7000.pitchMSB << 7) + value; - var position = 1 - (fullValue / 0x3FFF); // 1 - () to turn around the direction + const fullValue = (MC7000.pitchMSB << 7) + value; + const position = 1 - (fullValue / 0x3FFF); // 1 - () to turn around the direction engine.setParameter(group, "rate", position); }; @@ -754,12 +753,12 @@ MC7000.nextRateRange = function(midichan, control, value, status, group) { if (value === 0) { return; // don't respond to note off messages } - var currRateRange = engine.getValue(group, "rateRange"); + const currRateRange = engine.getValue(group, "rateRange"); engine.setValue(group, "rateRange", MC7000.getNextRateRange(currRateRange)); }; MC7000.getNextRateRange = function(currRateRange) { - for (var i = 0; i < MC7000.rateRanges.length; i++) { + for (let i = 0; i < MC7000.rateRanges.length; i++) { if (MC7000.rateRanges[i] > currRateRange) { return MC7000.rateRanges[i]; } @@ -772,12 +771,12 @@ MC7000.prevRateRange = function(midichan, control, value, status, group) { if (value === 0) { return; // don't respond to note off messages } - var currRateRange = engine.getValue(group, "rateRange"); + const currRateRange = engine.getValue(group, "rateRange"); engine.setValue(group, "rateRange", MC7000.getPrevRateRange(currRateRange)); }; MC7000.getPrevRateRange = function(currRateRange) { - for (var i = MC7000.rateRanges.length; i >= 0; i--) { + for (let i = MC7000.rateRanges.length; i >= 0; i--) { if (MC7000.rateRanges[i] < currRateRange) { return MC7000.rateRanges[i]; } @@ -787,7 +786,7 @@ MC7000.getPrevRateRange = function(currRateRange) { // Key & Waveform zoom Select MC7000.keySelect = function(midichan, control, value, status, group) { - var deckOffset = script.deckFromGroup(group) - 1; + const deckOffset = script.deckFromGroup(group) - 1; // While Shift Button is pressed: Waveform Zoom if (MC7000.shift[deckOffset]) { if (value === 0x7F) { @@ -807,7 +806,7 @@ MC7000.keySelect = function(midichan, control, value, status, group) { // Key & Waveform zoom Reset MC7000.keyReset = function(channel, control, value, status, group) { - var deckOffset = script.deckFromGroup(group) - 1; + const deckOffset = script.deckFromGroup(group) - 1; if (value === 0x00) { return; } @@ -833,7 +832,7 @@ MC7000.crossfaderAssign = function(channel, control, value, status, group) { // Assign Spinback length to STOP TIME knob MC7000.stopTime = function(channel, control, value, status, group) { - var deckNumber = script.deckFromGroup(group); + const deckNumber = script.deckFromGroup(group); // "factor" for engine.brake() // this formula produces factors between 31 (min STOP TIME for ca 7 sec back // in track) and 1 (max STOP TIME for ca 18.0 sec back in track) @@ -842,7 +841,7 @@ MC7000.stopTime = function(channel, control, value, status, group) { // Use SHIFT + CENSOR button as Spinback with STOP TIME adjusted length MC7000.reverse = function(channel, control, value, status, group) { - var deckNumber = script.deckFromGroup(group); + const deckNumber = script.deckFromGroup(group); if (value > 0) { // while the button is pressed spin back // start at a rate of -10 and decrease by "MC7000.factor" @@ -890,8 +889,8 @@ MC7000.crossFaderCurve = function(control, value) { // Set FX wet/dry value MC7000.fxWetDry = function(channel, control, value, status, group) { - var numTicks = (value < 0x64) ? value : (value - 128); - var newVal = engine.getValue(group, "mix") + numTicks/64*2; + const numTicks = (value < 0x64) ? value : (value - 128); + const newVal = engine.getValue(group, "mix") + numTicks/64*2; engine.setValue(group, "mix", Math.max(0, Math.min(1, newVal))); }; @@ -900,7 +899,7 @@ MC7000.sortLibrary = function(channel, control, value) { if (value === 0) { return; } - var sortColumn; + let sortColumn; switch (control) { case 0x12: // TITLE sortColumn = 2; @@ -921,9 +920,9 @@ MC7000.sortLibrary = function(channel, control, value) { /* LEDs for VuMeter */ // VuMeters only for Channel 1-4 / Master is on Hardware MC7000.VuMeter = function(value, group) { - var deckOffset = script.deckFromGroup(group) - 1; + const deckOffset = script.deckFromGroup(group) - 1; // sends either PeakIndicator or scales value (0..1) to (0..117) while truncating to each LED - var vuLevelOutValue = engine.getValue(group, "PeakIndicator") ? MC7000.VuMeterLEDPeakValue : Math.floor(Math.pow(value, 2.5) * 9) * 13; + const vuLevelOutValue = engine.getValue(group, "PeakIndicator") ? MC7000.VuMeterLEDPeakValue : Math.floor(Math.pow(value, 2.5) * 9) * 13; // only send Midi signal when LED value has changed if (MC7000.prevVuLevel[deckOffset] !== vuLevelOutValue) { midi.sendShortMsg(0xB0 + deckOffset, 0x1F, vuLevelOutValue); @@ -940,18 +939,18 @@ MC7000.TrackPositionLEDs = function(value, group) { return; } // lets define some variables first - var deckNumber = script.deckFromGroup(group); - var deckOffset = deckNumber - 1; - var trackDuration = engine.getValue(group, "duration"); // in seconds - var beatLength = engine.getValue(group, "file_bpm") / 60; // in Beats Per Seconds - var cuePosition = engine.getValue(group, "cue_point") / engine.getValue(group, "track_samplerate") / 2; // in seconds - var playPosition = value * trackDuration; // in seconds - var jogLEDPosition = playPosition / 60 * MC7000.scratchParams.recordSpeed; - var jogLEDNumber = 48; // LED ring contains 48 segments each triggered by the next even Midi value + const deckNumber = script.deckFromGroup(group); + const deckOffset = deckNumber - 1; + const trackDuration = engine.getValue(group, "duration"); // in seconds + const beatLength = engine.getValue(group, "file_bpm") / 60; // in Beats Per Seconds + const cuePosition = engine.getValue(group, "cue_point") / engine.getValue(group, "track_samplerate") / 2; // in seconds + const playPosition = value * trackDuration; // in seconds + const jogLEDPosition = playPosition / 60 * MC7000.scratchParams.recordSpeed; + const jogLEDNumber = 48; // LED ring contains 48 segments each triggered by the next even Midi value // check for Vinyl Mode and decide to spin the Jog LED or show play position - var activeJogLED = MC7000.isVinylMode[deckOffset] ? Math.round(jogLEDPosition * jogLEDNumber) % jogLEDNumber : Math.round(value * jogLEDNumber); + const activeJogLED = MC7000.isVinylMode[deckOffset] ? Math.round(jogLEDPosition * jogLEDNumber) % jogLEDNumber : Math.round(value * jogLEDNumber); // count the beats (1 to 8) after the CUE point - var beatCountLED = (Math.floor((playPosition - cuePosition) * beatLength) % 8); //calculate PAD LED position + const beatCountLED = (Math.floor((playPosition - cuePosition) * beatLength) % 8); //calculate PAD LED position // TODO(all): check for playposition < (trackduration - warning length) for sending position signals // check if a Jog LED has changed and if so then send the signal to the next Jog LED @@ -969,7 +968,7 @@ MC7000.TrackPositionLEDs = function(value, group) { // only send new LED status when beatCountLED really changes if (MC7000.prevPadLED[deckOffset] !== beatCountLED) { // first set all LEDs to default color incl shifted - for (var i = 0; i < 16; i++) { + for (let i = 0; i < 16; i++) { midi.sendShortMsg(0x94 + deckOffset, 0x14 + i, MC7000.padColor.sliceron); } // now chose which PAD LED to turn on (+8 means shifted PAD LEDs) @@ -990,10 +989,10 @@ MC7000.TrackPositionLEDs = function(value, group) { // initial HotCue LED when loading a track with already existing hotcues MC7000.HotCueLED = function(value, group) { - var deckNumber = script.deckFromGroup(group); - var deckOffset = deckNumber - 1; + const deckNumber = script.deckFromGroup(group); + const deckOffset = deckNumber - 1; if (MC7000.PADModeCue[deckNumber]) { - for (var i = 1; i <= 8; i++) { + for (let i = 1; i <= 8; i++) { if (value === 1) { if (engine.getValue(group, "hotcue_"+i+"_enabled") === 1) { midi.sendShortMsg(0x94 + deckOffset, 0x14 + i - 1, MC7000.padColor.hotcueon); @@ -1009,8 +1008,8 @@ MC7000.HotCueLED = function(value, group) { // Sampler LED MC7000.SamplerLED = function() { - for (var j = 1; j <= 4; j++) { - for (var i = 1; i <= 8; i++) { + for (let j = 1; j <= 4; j++) { + for (let i = 1; i <= 8; i++) { if (MC7000.PADModeSampler[j]) { if (engine.getValue("[Sampler"+i+"]", "track_loaded") === 1) { if (engine.getValue("[Sampler"+i+"]", "play") === 0) { @@ -1033,7 +1032,7 @@ MC7000.shutdown = function() { // otherwise the controller cannot handle the signal traffic // Switch off Transport section LEDs - for (var i = 0; i <= 3; i++) { + for (let i = 0; i <= 3; i++) { midi.sendShortMsg(0x90 + i, 0x00, 0x01); midi.sendShortMsg(0x90 + i, 0x01, 0x01); midi.sendShortMsg(0x90 + i, 0x02, 0x01); @@ -1042,7 +1041,7 @@ MC7000.shutdown = function() { midi.sendShortMsg(0x90 + i, 0x05, 0x01); } // Switch off Loop Section LEDs - for (i = 0; i <= 3; i++) { + for (let i = 0; i <= 3; i++) { midi.sendShortMsg(0x94 + i, 0x32, 0x01); midi.sendShortMsg(0x94 + i, 0x33, 0x01); midi.sendShortMsg(0x94 + i, 0x34, 0x01); @@ -1053,21 +1052,21 @@ MC7000.shutdown = function() { midi.sendShortMsg(0x94 + i, 0x00, 0x04); } // Switch all PAD LEDs to HotCue mode - for (i = 0x14; i <= 0x1B; i++) { + for (let i = 0x14; i <= 0x1B; i++) { midi.sendShortMsg(0x94, i, 0x02); midi.sendShortMsg(0x95, i, 0x02); midi.sendShortMsg(0x96, i, 0x02); midi.sendShortMsg(0x97, i, 0x02); } // Switch off Channel Cue, VINYL, SLIP, KEY LOCK LEDs - for (i = 0; i <= 3; i++) { + for (let i = 0; i <= 3; i++) { midi.sendShortMsg(0x90 + i, 0x07, 0x01); midi.sendShortMsg(0x90 + i, 0x0F, 0x01); midi.sendShortMsg(0x90 + i, 0x0D, 0x01); midi.sendShortMsg(0x90 + i, 0x1B, 0x01); } // Switch off FX Section LEDs - for (i = 0; i <= 1; i++) { + for (let i = 0; i <= 1; i++) { midi.sendShortMsg(0x98 + i, 0x00, 0x01); midi.sendShortMsg(0x98 + i, 0x01, 0x01); midi.sendShortMsg(0x98 + i, 0x02, 0x01); @@ -1079,7 +1078,7 @@ MC7000.shutdown = function() { midi.sendShortMsg(0x98 + i, 0x08, 0x01); } // Reset Level Meters and JogLED - for (i = 0; i <= 3; i++) { + for (let i = 0; i <= 3; i++) { // Switch off Level Meters midi.sendShortMsg(0xB0 + i, 0x1F, 0x00); // Platter Ring: Reset JogLED to Zero position