Lint
This commit is contained in:
parent
9a0a353b2b
commit
e1ec4b57b4
|
@ -58,12 +58,12 @@ PioneerDDJFLX4.lights = {
|
||||||
},
|
},
|
||||||
deck1: {
|
deck1: {
|
||||||
vuMeter: {
|
vuMeter: {
|
||||||
status: 0xB0,
|
status: 0xb0,
|
||||||
data1: 0x02,
|
data1: 0x02,
|
||||||
},
|
},
|
||||||
playPause: {
|
playPause: {
|
||||||
status: 0x90,
|
status: 0x90,
|
||||||
data1: 0x0B,
|
data1: 0x0b,
|
||||||
},
|
},
|
||||||
shiftPlayPause: {
|
shiftPlayPause: {
|
||||||
status: 0x90,
|
status: 0x90,
|
||||||
|
@ -71,7 +71,7 @@ PioneerDDJFLX4.lights = {
|
||||||
},
|
},
|
||||||
cue: {
|
cue: {
|
||||||
status: 0x90,
|
status: 0x90,
|
||||||
data1: 0x0C,
|
data1: 0x0c,
|
||||||
},
|
},
|
||||||
shiftCue: {
|
shiftCue: {
|
||||||
status: 0x90,
|
status: 0x90,
|
||||||
|
@ -79,7 +79,7 @@ PioneerDDJFLX4.lights = {
|
||||||
},
|
},
|
||||||
hotcueMode: {
|
hotcueMode: {
|
||||||
status: 0x90,
|
status: 0x90,
|
||||||
data1: 0x1B,
|
data1: 0x1b,
|
||||||
},
|
},
|
||||||
keyboardMode: {
|
keyboardMode: {
|
||||||
status: 0x90,
|
status: 0x90,
|
||||||
|
@ -87,11 +87,11 @@ PioneerDDJFLX4.lights = {
|
||||||
},
|
},
|
||||||
padFX1Mode: {
|
padFX1Mode: {
|
||||||
status: 0x90,
|
status: 0x90,
|
||||||
data1: 0x1E,
|
data1: 0x1e,
|
||||||
},
|
},
|
||||||
padFX2Mode: {
|
padFX2Mode: {
|
||||||
status: 0x90,
|
status: 0x90,
|
||||||
data1: 0x6B,
|
data1: 0x6b,
|
||||||
},
|
},
|
||||||
beatJumpMode: {
|
beatJumpMode: {
|
||||||
status: 0x90,
|
status: 0x90,
|
||||||
|
@ -99,7 +99,7 @@ PioneerDDJFLX4.lights = {
|
||||||
},
|
},
|
||||||
beatLoopMode: {
|
beatLoopMode: {
|
||||||
status: 0x90,
|
status: 0x90,
|
||||||
data1: 0x6D,
|
data1: 0x6d,
|
||||||
},
|
},
|
||||||
samplerMode: {
|
samplerMode: {
|
||||||
status: 0x90,
|
status: 0x90,
|
||||||
|
@ -107,17 +107,17 @@ PioneerDDJFLX4.lights = {
|
||||||
},
|
},
|
||||||
keyShiftMode: {
|
keyShiftMode: {
|
||||||
status: 0x90,
|
status: 0x90,
|
||||||
data1: 0x6F,
|
data1: 0x6f,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
deck2: {
|
deck2: {
|
||||||
vuMeter: {
|
vuMeter: {
|
||||||
status: 0xB0,
|
status: 0xb0,
|
||||||
data1: 0x02,
|
data1: 0x02,
|
||||||
},
|
},
|
||||||
playPause: {
|
playPause: {
|
||||||
status: 0x91,
|
status: 0x91,
|
||||||
data1: 0x0B,
|
data1: 0x0b,
|
||||||
},
|
},
|
||||||
shiftPlayPause: {
|
shiftPlayPause: {
|
||||||
status: 0x91,
|
status: 0x91,
|
||||||
|
@ -125,7 +125,7 @@ PioneerDDJFLX4.lights = {
|
||||||
},
|
},
|
||||||
cue: {
|
cue: {
|
||||||
status: 0x91,
|
status: 0x91,
|
||||||
data1: 0x0C,
|
data1: 0x0c,
|
||||||
},
|
},
|
||||||
shiftCue: {
|
shiftCue: {
|
||||||
status: 0x91,
|
status: 0x91,
|
||||||
|
@ -133,7 +133,7 @@ PioneerDDJFLX4.lights = {
|
||||||
},
|
},
|
||||||
hotcueMode: {
|
hotcueMode: {
|
||||||
status: 0x91,
|
status: 0x91,
|
||||||
data1: 0x1B,
|
data1: 0x1b,
|
||||||
},
|
},
|
||||||
keyboardMode: {
|
keyboardMode: {
|
||||||
status: 0x91,
|
status: 0x91,
|
||||||
|
@ -141,11 +141,11 @@ PioneerDDJFLX4.lights = {
|
||||||
},
|
},
|
||||||
padFX1Mode: {
|
padFX1Mode: {
|
||||||
status: 0x91,
|
status: 0x91,
|
||||||
data1: 0x1E,
|
data1: 0x1e,
|
||||||
},
|
},
|
||||||
padFX2Mode: {
|
padFX2Mode: {
|
||||||
status: 0x91,
|
status: 0x91,
|
||||||
data1: 0x6B,
|
data1: 0x6b,
|
||||||
},
|
},
|
||||||
beatJumpMode: {
|
beatJumpMode: {
|
||||||
status: 0x91,
|
status: 0x91,
|
||||||
|
@ -153,7 +153,7 @@ PioneerDDJFLX4.lights = {
|
||||||
},
|
},
|
||||||
beatLoopMode: {
|
beatLoopMode: {
|
||||||
status: 0x91,
|
status: 0x91,
|
||||||
data1: 0x6D,
|
data1: 0x6d,
|
||||||
},
|
},
|
||||||
samplerMode: {
|
samplerMode: {
|
||||||
status: 0x91,
|
status: 0x91,
|
||||||
|
@ -161,7 +161,7 @@ PioneerDDJFLX4.lights = {
|
||||||
},
|
},
|
||||||
keyShiftMode: {
|
keyShiftMode: {
|
||||||
status: 0x91,
|
status: 0x91,
|
||||||
data1: 0x6F,
|
data1: 0x6f,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -171,7 +171,10 @@ PioneerDDJFLX4.timers = {};
|
||||||
|
|
||||||
// Keep alive timer
|
// Keep alive timer
|
||||||
PioneerDDJFLX4.sendKeepAlive = function () {
|
PioneerDDJFLX4.sendKeepAlive = function () {
|
||||||
midi.sendSysexMsg([0xF0, 0x00, 0x40, 0x05, 0x00, 0x00, 0x04, 0x05, 0x00, 0x50, 0x02, 0xf7], 12); // This was reverse engineered with Wireshark
|
midi.sendSysexMsg(
|
||||||
|
[0xf0, 0x00, 0x40, 0x05, 0x00, 0x00, 0x04, 0x05, 0x00, 0x50, 0x02, 0xf7],
|
||||||
|
12
|
||||||
|
); // This was reverse engineered with Wireshark
|
||||||
};
|
};
|
||||||
|
|
||||||
// Jog wheel constants
|
// Jog wheel constants
|
||||||
|
@ -183,7 +186,7 @@ PioneerDDJFLX4.beta = PioneerDDJFLX4.alpha/32;
|
||||||
PioneerDDJFLX4.fastSeekScale = 150;
|
PioneerDDJFLX4.fastSeekScale = 150;
|
||||||
PioneerDDJFLX4.bendScale = 0.4;
|
PioneerDDJFLX4.bendScale = 0.4;
|
||||||
|
|
||||||
PioneerDDJFLX4.tempoRanges = [0.06, 0.10, 0.16, 0.25];
|
PioneerDDJFLX4.tempoRanges = [0.06, 0.1, 0.16, 0.25];
|
||||||
|
|
||||||
PioneerDDJFLX4.shiftButtonDown = [false, false];
|
PioneerDDJFLX4.shiftButtonDown = [false, false];
|
||||||
|
|
||||||
|
@ -201,7 +204,7 @@ PioneerDDJFLX4.beatjumpSizeForPad = {
|
||||||
0x24: -4, // PAD 5
|
0x24: -4, // PAD 5
|
||||||
0x25: 4, // PAD 6
|
0x25: 4, // PAD 6
|
||||||
0x26: -8, // PAD 7
|
0x26: -8, // PAD 7
|
||||||
0x27: 8 // PAD 8
|
0x27: 8, // PAD 8
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.quickJumpSize = 32;
|
PioneerDDJFLX4.quickJumpSize = 32;
|
||||||
|
@ -209,19 +212,19 @@ PioneerDDJFLX4.quickJumpSize = 32;
|
||||||
// Used for tempo slider
|
// Used for tempo slider
|
||||||
PioneerDDJFLX4.highResMSB = {
|
PioneerDDJFLX4.highResMSB = {
|
||||||
"[Channel1]": {},
|
"[Channel1]": {},
|
||||||
"[Channel2]": {}
|
"[Channel2]": {},
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.trackLoadedLED = function (value, group, _control) {
|
PioneerDDJFLX4.trackLoadedLED = function (value, group, _control) {
|
||||||
midi.sendShortMsg(
|
midi.sendShortMsg(
|
||||||
0x9F,
|
0x9f,
|
||||||
group.match(script.channelRegEx)[1] - 1,
|
group.match(script.channelRegEx)[1] - 1,
|
||||||
value > 0 ? 0x7F : 0x00
|
value > 0 ? 0x7f : 0x00
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.toggleLight = function (midiIn, active) {
|
PioneerDDJFLX4.toggleLight = function (midiIn, active) {
|
||||||
midi.sendShortMsg(midiIn.status, midiIn.data1, active ? 0x7F : 0);
|
midi.sendShortMsg(midiIn.status, midiIn.data1, active ? 0x7f : 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -249,28 +252,59 @@ PioneerDDJFLX4.init = function() {
|
||||||
engine.setValue("[App]", "num_samplers", samplerCount);
|
engine.setValue("[App]", "num_samplers", samplerCount);
|
||||||
}
|
}
|
||||||
for (let i = 1; i <= samplerCount; ++i) {
|
for (let i = 1; i <= samplerCount; ++i) {
|
||||||
engine.makeConnection("[Sampler" + i + "]", "play", PioneerDDJFLX4.samplerPlayOutputCallbackFunction);
|
engine.makeConnection(
|
||||||
|
"[Sampler" + i + "]",
|
||||||
|
"play",
|
||||||
|
PioneerDDJFLX4.samplerPlayOutputCallbackFunction
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
engine.makeConnection("[Channel1]", "track_loaded", PioneerDDJFLX4.trackLoadedLED);
|
engine.makeConnection(
|
||||||
engine.makeConnection("[Channel2]", "track_loaded", PioneerDDJFLX4.trackLoadedLED);
|
"[Channel1]",
|
||||||
|
"track_loaded",
|
||||||
|
PioneerDDJFLX4.trackLoadedLED
|
||||||
|
);
|
||||||
|
engine.makeConnection(
|
||||||
|
"[Channel2]",
|
||||||
|
"track_loaded",
|
||||||
|
PioneerDDJFLX4.trackLoadedLED
|
||||||
|
);
|
||||||
|
|
||||||
// play the "track loaded" animation on both decks at startup
|
// play the "track loaded" animation on both decks at startup
|
||||||
midi.sendShortMsg(0x9F, 0x00, 0x7F);
|
midi.sendShortMsg(0x9f, 0x00, 0x7f);
|
||||||
midi.sendShortMsg(0x9F, 0x01, 0x7F);
|
midi.sendShortMsg(0x9f, 0x01, 0x7f);
|
||||||
|
|
||||||
PioneerDDJFLX4.setLoopButtonLights(0x90, 0x7F);
|
PioneerDDJFLX4.setLoopButtonLights(0x90, 0x7f);
|
||||||
PioneerDDJFLX4.setLoopButtonLights(0x91, 0x7F);
|
PioneerDDJFLX4.setLoopButtonLights(0x91, 0x7f);
|
||||||
|
|
||||||
engine.makeConnection("[Channel1]", "loop_enabled", PioneerDDJFLX4.loopToggle);
|
engine.makeConnection(
|
||||||
engine.makeConnection("[Channel2]", "loop_enabled", PioneerDDJFLX4.loopToggle);
|
"[Channel1]",
|
||||||
|
"loop_enabled",
|
||||||
|
PioneerDDJFLX4.loopToggle
|
||||||
|
);
|
||||||
|
engine.makeConnection(
|
||||||
|
"[Channel2]",
|
||||||
|
"loop_enabled",
|
||||||
|
PioneerDDJFLX4.loopToggle
|
||||||
|
);
|
||||||
|
|
||||||
for (i = 1; i <= 3; i++) {
|
for (i = 1; i <= 3; i++) {
|
||||||
engine.makeConnection("[EffectRack1_EffectUnit1_Effect" + i +"]", "enabled", PioneerDDJFLX4.toggleFxLight);
|
engine.makeConnection(
|
||||||
|
"[EffectRack1_EffectUnit1_Effect" + i + "]",
|
||||||
|
"enabled",
|
||||||
|
PioneerDDJFLX4.toggleFxLight
|
||||||
|
);
|
||||||
}
|
}
|
||||||
engine.makeConnection("[EffectRack1_EffectUnit1]", "focused_effect", PioneerDDJFLX4.toggleFxLight);
|
engine.makeConnection(
|
||||||
|
"[EffectRack1_EffectUnit1]",
|
||||||
|
"focused_effect",
|
||||||
|
PioneerDDJFLX4.toggleFxLight
|
||||||
|
);
|
||||||
|
|
||||||
PioneerDDJFLX4.keepAliveTimer = engine.beginTimer(200, PioneerDDJFLX4.sendKeepAlive);
|
PioneerDDJFLX4.keepAliveTimer = engine.beginTimer(
|
||||||
|
200,
|
||||||
|
PioneerDDJFLX4.sendKeepAlive
|
||||||
|
);
|
||||||
|
|
||||||
// query the controller for current control positions on startup
|
// query the controller for current control positions on startup
|
||||||
PioneerDDJFLX4.sendKeepAlive(); // the query seems to double as a keep alive message
|
PioneerDDJFLX4.sendKeepAlive(); // the query seems to double as a keep alive message
|
||||||
|
@ -280,7 +314,13 @@ PioneerDDJFLX4.init = function() {
|
||||||
// Waveform zoom
|
// Waveform zoom
|
||||||
//
|
//
|
||||||
|
|
||||||
PioneerDDJFLX4.waveformZoom = function(midichan, control, value, status, group) {
|
PioneerDDJFLX4.waveformZoom = function (
|
||||||
|
midichan,
|
||||||
|
control,
|
||||||
|
value,
|
||||||
|
status,
|
||||||
|
group
|
||||||
|
) {
|
||||||
if (value === 0x7f) {
|
if (value === 0x7f) {
|
||||||
script.triggerControl(group, "waveform_zoom_up", 100);
|
script.triggerControl(group, "waveform_zoom_up", 100);
|
||||||
} else {
|
} else {
|
||||||
|
@ -297,11 +337,11 @@ PioneerDDJFLX4.vuMeterUpdate = function(value, group) {
|
||||||
|
|
||||||
switch (group) {
|
switch (group) {
|
||||||
case "[Channel1]":
|
case "[Channel1]":
|
||||||
midi.sendShortMsg(0xB0, 0x02, newVal);
|
midi.sendShortMsg(0xb0, 0x02, newVal);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "[Channel2]":
|
case "[Channel2]":
|
||||||
midi.sendShortMsg(0xB1, 0x02, newVal);
|
midi.sendShortMsg(0xb1, 0x02, newVal);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -318,29 +358,38 @@ PioneerDDJFLX4.toggleFxLight = function(_value, _group, _control) {
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.focusedFxGroup = function () {
|
PioneerDDJFLX4.focusedFxGroup = function () {
|
||||||
const focusedFx = engine.getValue("[EffectRack1_EffectUnit1]", "focused_effect");
|
const focusedFx = engine.getValue(
|
||||||
|
"[EffectRack1_EffectUnit1]",
|
||||||
|
"focused_effect"
|
||||||
|
);
|
||||||
return "[EffectRack1_EffectUnit1_Effect" + focusedFx + "]";
|
return "[EffectRack1_EffectUnit1_Effect" + focusedFx + "]";
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.beatFxLevelDepthRotate = function (_channel, _control, value) {
|
PioneerDDJFLX4.beatFxLevelDepthRotate = function (_channel, _control, value) {
|
||||||
if (PioneerDDJFLX4.shiftButtonDown[0] || PioneerDDJFLX4.shiftButtonDown[1]) {
|
if (PioneerDDJFLX4.shiftButtonDown[0] || PioneerDDJFLX4.shiftButtonDown[1]) {
|
||||||
engine.softTakeoverIgnoreNextValue("[EffectRack1_EffectUnit1]", "mix");
|
engine.softTakeoverIgnoreNextValue("[EffectRack1_EffectUnit1]", "mix");
|
||||||
engine.setParameter(PioneerDDJFLX4.focusedFxGroup(), "meta", value / 0x7F);
|
engine.setParameter(PioneerDDJFLX4.focusedFxGroup(), "meta", value / 0x7f);
|
||||||
} else {
|
} else {
|
||||||
engine.softTakeoverIgnoreNextValue(PioneerDDJFLX4.focusedFxGroup(), "meta");
|
engine.softTakeoverIgnoreNextValue(PioneerDDJFLX4.focusedFxGroup(), "meta");
|
||||||
engine.setParameter("[EffectRack1_EffectUnit1]", "mix", value / 0x7F);
|
engine.setParameter("[EffectRack1_EffectUnit1]", "mix", value / 0x7f);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.changeFocusedEffectBy = function (numberOfSteps) {
|
PioneerDDJFLX4.changeFocusedEffectBy = function (numberOfSteps) {
|
||||||
let focusedEffect = engine.getValue("[EffectRack1_EffectUnit1]", "focused_effect");
|
let focusedEffect = engine.getValue(
|
||||||
|
"[EffectRack1_EffectUnit1]",
|
||||||
|
"focused_effect"
|
||||||
|
);
|
||||||
|
|
||||||
// Convert to zero-based index
|
// Convert to zero-based index
|
||||||
focusedEffect -= 1;
|
focusedEffect -= 1;
|
||||||
|
|
||||||
// Standard Euclidean modulo by use of two plain modulos
|
// Standard Euclidean modulo by use of two plain modulos
|
||||||
const numberOfEffectsPerEffectUnit = 3;
|
const numberOfEffectsPerEffectUnit = 3;
|
||||||
focusedEffect = (((focusedEffect + numberOfSteps) % numberOfEffectsPerEffectUnit) + numberOfEffectsPerEffectUnit) % numberOfEffectsPerEffectUnit;
|
focusedEffect =
|
||||||
|
(((focusedEffect + numberOfSteps) % numberOfEffectsPerEffectUnit) +
|
||||||
|
numberOfEffectsPerEffectUnit) %
|
||||||
|
numberOfEffectsPerEffectUnit;
|
||||||
|
|
||||||
// Convert back to one-based index
|
// Convert back to one-based index
|
||||||
focusedEffect += 1;
|
focusedEffect += 1;
|
||||||
|
@ -349,38 +398,53 @@ PioneerDDJFLX4.changeFocusedEffectBy = function(numberOfSteps) {
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.beatFxSelectPressed = function (_channel, _control, value) {
|
PioneerDDJFLX4.beatFxSelectPressed = function (_channel, _control, value) {
|
||||||
if (value === 0) { return; }
|
if (value === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
engine.setValue(PioneerDDJFLX4.focusedFxGroup(), "next_effect", value);
|
engine.setValue(PioneerDDJFLX4.focusedFxGroup(), "next_effect", value);
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.beatFxSelectShiftPressed = function (_channel, _control, value) {
|
PioneerDDJFLX4.beatFxSelectShiftPressed = function (_channel, _control, value) {
|
||||||
if (value === 0) { return; }
|
if (value === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
engine.setValue(PioneerDDJFLX4.focusedFxGroup(), "prev_effect", value);
|
engine.setValue(PioneerDDJFLX4.focusedFxGroup(), "prev_effect", value);
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.beatFxLeftPressed = function (_channel, _control, value) {
|
PioneerDDJFLX4.beatFxLeftPressed = function (_channel, _control, value) {
|
||||||
if (value === 0) { return; }
|
if (value === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
PioneerDDJFLX4.changeFocusedEffectBy(-1);
|
PioneerDDJFLX4.changeFocusedEffectBy(-1);
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.beatFxRightPressed = function (_channel, _control, value) {
|
PioneerDDJFLX4.beatFxRightPressed = function (_channel, _control, value) {
|
||||||
if (value === 0) { return; }
|
if (value === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
PioneerDDJFLX4.changeFocusedEffectBy(1);
|
PioneerDDJFLX4.changeFocusedEffectBy(1);
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.beatFxOnOffPressed = function (_channel, _control, value) {
|
PioneerDDJFLX4.beatFxOnOffPressed = function (_channel, _control, value) {
|
||||||
if (value === 0) { return; }
|
if (value === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const toggleEnabled = !engine.getValue(PioneerDDJFLX4.focusedFxGroup(), "enabled");
|
const toggleEnabled = !engine.getValue(
|
||||||
|
PioneerDDJFLX4.focusedFxGroup(),
|
||||||
|
"enabled"
|
||||||
|
);
|
||||||
engine.setValue(PioneerDDJFLX4.focusedFxGroup(), "enabled", toggleEnabled);
|
engine.setValue(PioneerDDJFLX4.focusedFxGroup(), "enabled", toggleEnabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.beatFxOnOffShiftPressed = function (_channel, _control, value) {
|
PioneerDDJFLX4.beatFxOnOffShiftPressed = function (_channel, _control, value) {
|
||||||
if (value === 0) { return; }
|
if (value === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
engine.setParameter("[EffectRack1_EffectUnit1]", "mix", 0);
|
engine.setParameter("[EffectRack1_EffectUnit1]", "mix", 0);
|
||||||
engine.softTakeoverIgnoreNextValue("[EffectRack1_EffectUnit1]", "mix");
|
engine.softTakeoverIgnoreNextValue("[EffectRack1_EffectUnit1]", "mix");
|
||||||
|
@ -392,18 +456,34 @@ PioneerDDJFLX4.beatFxOnOffShiftPressed = function(_channel, _control, value) {
|
||||||
PioneerDDJFLX4.toggleLight(PioneerDDJFLX4.lights.shiftBeatFx, false);
|
PioneerDDJFLX4.toggleLight(PioneerDDJFLX4.lights.shiftBeatFx, false);
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.beatFxChannel1 = function(_channel, control, value, _status, group) {
|
PioneerDDJFLX4.beatFxChannel1 = function (
|
||||||
|
_channel,
|
||||||
|
control,
|
||||||
|
value,
|
||||||
|
_status,
|
||||||
|
group
|
||||||
|
) {
|
||||||
let enableChannel = 0;
|
let enableChannel = 0;
|
||||||
|
|
||||||
if (value === 0x7f) { enableChannel = 1; }
|
if (value === 0x7f) {
|
||||||
|
enableChannel = 1;
|
||||||
|
}
|
||||||
|
|
||||||
engine.setValue(group, "group_[Channel1]_enable", enableChannel);
|
engine.setValue(group, "group_[Channel1]_enable", enableChannel);
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.beatFxChannel2 = function(_channel, control, value, _status, group) {
|
PioneerDDJFLX4.beatFxChannel2 = function (
|
||||||
|
_channel,
|
||||||
|
control,
|
||||||
|
value,
|
||||||
|
_status,
|
||||||
|
group
|
||||||
|
) {
|
||||||
let enableChannel = 0;
|
let enableChannel = 0;
|
||||||
|
|
||||||
if (value === 0x7f) { enableChannel = 1; }
|
if (value === 0x7f) {
|
||||||
|
enableChannel = 1;
|
||||||
|
}
|
||||||
|
|
||||||
engine.setValue(group, "group_[Channel2]_enable", enableChannel);
|
engine.setValue(group, "group_[Channel2]_enable", enableChannel);
|
||||||
};
|
};
|
||||||
|
@ -412,7 +492,13 @@ PioneerDDJFLX4.beatFxChannel2 = function(_channel, control, value, _status, grou
|
||||||
// Loop IN/OUT ADJUST
|
// Loop IN/OUT ADJUST
|
||||||
//
|
//
|
||||||
|
|
||||||
PioneerDDJFLX4.toggleLoopAdjustIn = function(channel, _control, value, _status, group) {
|
PioneerDDJFLX4.toggleLoopAdjustIn = function (
|
||||||
|
channel,
|
||||||
|
_control,
|
||||||
|
value,
|
||||||
|
_status,
|
||||||
|
group
|
||||||
|
) {
|
||||||
if (value === 0 || engine.getValue(group, "loop_enabled" === 0)) {
|
if (value === 0 || engine.getValue(group, "loop_enabled" === 0)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -420,54 +506,64 @@ PioneerDDJFLX4.toggleLoopAdjustIn = function(channel, _control, value, _status,
|
||||||
PioneerDDJFLX4.loopAdjustOut[channel] = false;
|
PioneerDDJFLX4.loopAdjustOut[channel] = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.toggleLoopAdjustOut = function(channel, _control, value, _status, group) {
|
PioneerDDJFLX4.toggleLoopAdjustOut = function (
|
||||||
|
channel,
|
||||||
|
_control,
|
||||||
|
value,
|
||||||
|
_status,
|
||||||
|
group
|
||||||
|
) {
|
||||||
if (value === 0 || engine.getValue(group, "loop_enabled" === 0)) {
|
if (value === 0 || engine.getValue(group, "loop_enabled" === 0)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PioneerDDJFLX4.loopAdjustOut[channel] = !PioneerDDJFLX4.loopAdjustOut[channel];
|
PioneerDDJFLX4.loopAdjustOut[channel] =
|
||||||
|
!PioneerDDJFLX4.loopAdjustOut[channel];
|
||||||
PioneerDDJFLX4.loopAdjustIn[channel] = false;
|
PioneerDDJFLX4.loopAdjustIn[channel] = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Two signals are sent here so that the light stays lit/unlit in its shift state too
|
// Two signals are sent here so that the light stays lit/unlit in its shift state too
|
||||||
PioneerDDJFLX4.setReloopLight = function (status, value) {
|
PioneerDDJFLX4.setReloopLight = function (status, value) {
|
||||||
midi.sendShortMsg(status, 0x4D, value);
|
midi.sendShortMsg(status, 0x4d, value);
|
||||||
midi.sendShortMsg(status, 0x50, value);
|
midi.sendShortMsg(status, 0x50, value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
PioneerDDJFLX4.setLoopButtonLights = function (status, value) {
|
PioneerDDJFLX4.setLoopButtonLights = function (status, value) {
|
||||||
[0x10, 0x11, 0x4E, 0x4C].forEach(function(control) {
|
[0x10, 0x11, 0x4e, 0x4c].forEach(function (control) {
|
||||||
midi.sendShortMsg(status, control, value);
|
midi.sendShortMsg(status, control, value);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.startLoopLightsBlink = function(channel, control, status, group) {
|
PioneerDDJFLX4.startLoopLightsBlink = function (
|
||||||
let blink = 0x7F;
|
channel,
|
||||||
|
control,
|
||||||
|
status,
|
||||||
|
group
|
||||||
|
) {
|
||||||
|
let blink = 0x7f;
|
||||||
|
|
||||||
PioneerDDJFLX4.stopLoopLightsBlink(group, control, status);
|
PioneerDDJFLX4.stopLoopLightsBlink(group, control, status);
|
||||||
|
|
||||||
PioneerDDJFLX4.timers[group][control] = engine.beginTimer(500, () => {
|
PioneerDDJFLX4.timers[group][control] = engine.beginTimer(500, () => {
|
||||||
blink = 0x7F - blink;
|
blink = 0x7f - blink;
|
||||||
|
|
||||||
// When adjusting the loop out position, turn the loop in light off
|
// When adjusting the loop out position, turn the loop in light off
|
||||||
if (PioneerDDJFLX4.loopAdjustOut[channel]) {
|
if (PioneerDDJFLX4.loopAdjustOut[channel]) {
|
||||||
midi.sendShortMsg(status, 0x10, 0x00);
|
midi.sendShortMsg(status, 0x10, 0x00);
|
||||||
midi.sendShortMsg(status, 0x4C, 0x00);
|
midi.sendShortMsg(status, 0x4c, 0x00);
|
||||||
} else {
|
} else {
|
||||||
midi.sendShortMsg(status, 0x10, blink);
|
midi.sendShortMsg(status, 0x10, blink);
|
||||||
midi.sendShortMsg(status, 0x4C, blink);
|
midi.sendShortMsg(status, 0x4c, blink);
|
||||||
}
|
}
|
||||||
|
|
||||||
// When adjusting the loop in position, turn the loop out light off
|
// When adjusting the loop in position, turn the loop out light off
|
||||||
if (PioneerDDJFLX4.loopAdjustIn[channel]) {
|
if (PioneerDDJFLX4.loopAdjustIn[channel]) {
|
||||||
midi.sendShortMsg(status, 0x11, 0x00);
|
midi.sendShortMsg(status, 0x11, 0x00);
|
||||||
midi.sendShortMsg(status, 0x4E, 0x00);
|
midi.sendShortMsg(status, 0x4e, 0x00);
|
||||||
} else {
|
} else {
|
||||||
midi.sendShortMsg(status, 0x11, blink);
|
midi.sendShortMsg(status, 0x11, blink);
|
||||||
midi.sendShortMsg(status, 0x4E, blink);
|
midi.sendShortMsg(status, 0x4e, blink);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.stopLoopLightsBlink = function (group, control, status) {
|
PioneerDDJFLX4.stopLoopLightsBlink = function (group, control, status) {
|
||||||
|
@ -477,14 +573,14 @@ PioneerDDJFLX4.stopLoopLightsBlink = function(group, control, status) {
|
||||||
engine.stopTimer(PioneerDDJFLX4.timers[group][control]);
|
engine.stopTimer(PioneerDDJFLX4.timers[group][control]);
|
||||||
}
|
}
|
||||||
PioneerDDJFLX4.timers[group][control] = undefined;
|
PioneerDDJFLX4.timers[group][control] = undefined;
|
||||||
PioneerDDJFLX4.setLoopButtonLights(status, 0x7F);
|
PioneerDDJFLX4.setLoopButtonLights(status, 0x7f);
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.loopToggle = function (value, group, control) {
|
PioneerDDJFLX4.loopToggle = function (value, group, control) {
|
||||||
const status = group === "[Channel1]" ? 0x90 : 0x91,
|
const status = group === "[Channel1]" ? 0x90 : 0x91,
|
||||||
channel = group === "[Channel1]" ? 0 : 1;
|
channel = group === "[Channel1]" ? 0 : 1;
|
||||||
|
|
||||||
PioneerDDJFLX4.setReloopLight(status, value ? 0x7F : 0x00);
|
PioneerDDJFLX4.setReloopLight(status, value ? 0x7f : 0x00);
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
PioneerDDJFLX4.startLoopLightsBlink(channel, control, status, group);
|
PioneerDDJFLX4.startLoopLightsBlink(channel, control, status, group);
|
||||||
|
@ -499,13 +595,25 @@ PioneerDDJFLX4.loopToggle = function(value, group, control) {
|
||||||
// CUE/LOOP CALL
|
// CUE/LOOP CALL
|
||||||
//
|
//
|
||||||
|
|
||||||
PioneerDDJFLX4.cueLoopCallLeft = function(_channel, _control, value, _status, group) {
|
PioneerDDJFLX4.cueLoopCallLeft = function (
|
||||||
|
_channel,
|
||||||
|
_control,
|
||||||
|
value,
|
||||||
|
_status,
|
||||||
|
group
|
||||||
|
) {
|
||||||
if (value) {
|
if (value) {
|
||||||
engine.setValue(group, "loop_scale", 0.5);
|
engine.setValue(group, "loop_scale", 0.5);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.cueLoopCallRight = function(_channel, _control, value, _status, group) {
|
PioneerDDJFLX4.cueLoopCallRight = function (
|
||||||
|
_channel,
|
||||||
|
_control,
|
||||||
|
value,
|
||||||
|
_status,
|
||||||
|
group
|
||||||
|
) {
|
||||||
if (value) {
|
if (value) {
|
||||||
engine.setValue(group, "loop_scale", 2.0);
|
engine.setValue(group, "loop_scale", 2.0);
|
||||||
}
|
}
|
||||||
|
@ -526,14 +634,28 @@ PioneerDDJFLX4.syncPressed = function(channel, control, value, status, group) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.syncLongPressed = function(channel, control, value, status, group) {
|
PioneerDDJFLX4.syncLongPressed = function (
|
||||||
|
channel,
|
||||||
|
control,
|
||||||
|
value,
|
||||||
|
status,
|
||||||
|
group
|
||||||
|
) {
|
||||||
if (value) {
|
if (value) {
|
||||||
engine.setValue(group, "sync_enabled", 1);
|
engine.setValue(group, "sync_enabled", 1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.cycleTempoRange = function(_channel, _control, value, _status, group) {
|
PioneerDDJFLX4.cycleTempoRange = function (
|
||||||
if (value === 0) { return; } // ignore release
|
_channel,
|
||||||
|
_control,
|
||||||
|
value,
|
||||||
|
_status,
|
||||||
|
group
|
||||||
|
) {
|
||||||
|
if (value === 0) {
|
||||||
|
return;
|
||||||
|
} // ignore release
|
||||||
|
|
||||||
const currRange = engine.getValue(group, "rateRange");
|
const currRange = engine.getValue(group, "rateRange");
|
||||||
let idx = 0;
|
let idx = 0;
|
||||||
|
@ -562,12 +684,16 @@ PioneerDDJFLX4.jogTurn = function(channel, _control, value, _status, group) {
|
||||||
const loopEnabled = engine.getValue(group, "loop_enabled");
|
const loopEnabled = engine.getValue(group, "loop_enabled");
|
||||||
if (loopEnabled > 0) {
|
if (loopEnabled > 0) {
|
||||||
if (PioneerDDJFLX4.loopAdjustIn[channel]) {
|
if (PioneerDDJFLX4.loopAdjustIn[channel]) {
|
||||||
newVal = newVal * PioneerDDJFLX4.loopAdjustMultiply + engine.getValue(group, "loop_start_position");
|
newVal =
|
||||||
|
newVal * PioneerDDJFLX4.loopAdjustMultiply +
|
||||||
|
engine.getValue(group, "loop_start_position");
|
||||||
engine.setValue(group, "loop_start_position", newVal);
|
engine.setValue(group, "loop_start_position", newVal);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (PioneerDDJFLX4.loopAdjustOut[channel]) {
|
if (PioneerDDJFLX4.loopAdjustOut[channel]) {
|
||||||
newVal = newVal * PioneerDDJFLX4.loopAdjustMultiply + engine.getValue(group, "loop_end_position");
|
newVal =
|
||||||
|
newVal * PioneerDDJFLX4.loopAdjustMultiply +
|
||||||
|
engine.getValue(group, "loop_end_position");
|
||||||
engine.setValue(group, "loop_end_position", newVal);
|
engine.setValue(group, "loop_end_position", newVal);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -575,13 +701,19 @@ PioneerDDJFLX4.jogTurn = function(channel, _control, value, _status, group) {
|
||||||
|
|
||||||
if (engine.isScratching(deckNum)) {
|
if (engine.isScratching(deckNum)) {
|
||||||
engine.scratchTick(deckNum, newVal);
|
engine.scratchTick(deckNum, newVal);
|
||||||
} else { // fallback
|
} else {
|
||||||
|
// fallback
|
||||||
engine.setValue(group, "jog", newVal * this.bendScale);
|
engine.setValue(group, "jog", newVal * this.bendScale);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
PioneerDDJFLX4.jogSearch = function (
|
||||||
PioneerDDJFLX4.jogSearch = function(_channel, _control, value, _status, group) {
|
_channel,
|
||||||
|
_control,
|
||||||
|
value,
|
||||||
|
_status,
|
||||||
|
group
|
||||||
|
) {
|
||||||
const newVal = (value - 64) * PioneerDDJFLX4.fastSeekScale;
|
const newVal = (value - 64) * PioneerDDJFLX4.fastSeekScale;
|
||||||
engine.setValue(group, "jog", newVal);
|
engine.setValue(group, "jog", newVal);
|
||||||
};
|
};
|
||||||
|
@ -590,7 +722,10 @@ PioneerDDJFLX4.jogTouch = function(channel, _control, value) {
|
||||||
const deckNum = channel + 1;
|
const deckNum = channel + 1;
|
||||||
|
|
||||||
// skip while adjusting the loop points
|
// skip while adjusting the loop points
|
||||||
if (PioneerDDJFLX4.loopAdjustIn[channel] || PioneerDDJFLX4.loopAdjustOut[channel]) {
|
if (
|
||||||
|
PioneerDDJFLX4.loopAdjustIn[channel] ||
|
||||||
|
PioneerDDJFLX4.loopAdjustOut[channel]
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -605,11 +740,16 @@ PioneerDDJFLX4.jogTouch = function(channel, _control, value) {
|
||||||
// Shift button
|
// Shift button
|
||||||
//
|
//
|
||||||
|
|
||||||
PioneerDDJFLX4.shiftPressed = function(channel, _control, value, _status, _group) {
|
PioneerDDJFLX4.shiftPressed = function (
|
||||||
PioneerDDJFLX4.shiftButtonDown[channel] = value === 0x7F;
|
channel,
|
||||||
|
_control,
|
||||||
|
value,
|
||||||
|
_status,
|
||||||
|
_group
|
||||||
|
) {
|
||||||
|
PioneerDDJFLX4.shiftButtonDown[channel] = value === 0x7f;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tempo sliders
|
// Tempo sliders
|
||||||
//
|
//
|
||||||
|
@ -618,18 +758,26 @@ PioneerDDJFLX4.shiftPressed = function(channel, _control, value, _status, _group
|
||||||
// UI and the control sliders always move in the same direction.
|
// UI and the control sliders always move in the same direction.
|
||||||
//
|
//
|
||||||
|
|
||||||
PioneerDDJFLX4.tempoSliderMSB = function(channel, control, value, status, group) {
|
PioneerDDJFLX4.tempoSliderMSB = function (
|
||||||
|
channel,
|
||||||
|
control,
|
||||||
|
value,
|
||||||
|
status,
|
||||||
|
group
|
||||||
|
) {
|
||||||
PioneerDDJFLX4.highResMSB[group].tempoSlider = value;
|
PioneerDDJFLX4.highResMSB[group].tempoSlider = value;
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.tempoSliderLSB = function(channel, control, value, status, group) {
|
PioneerDDJFLX4.tempoSliderLSB = function (
|
||||||
|
channel,
|
||||||
|
control,
|
||||||
|
value,
|
||||||
|
status,
|
||||||
|
group
|
||||||
|
) {
|
||||||
const fullValue = (PioneerDDJFLX4.highResMSB[group].tempoSlider << 7) + value;
|
const fullValue = (PioneerDDJFLX4.highResMSB[group].tempoSlider << 7) + value;
|
||||||
|
|
||||||
engine.setValue(
|
engine.setValue(group, "rate", 1 - fullValue / 0x2000);
|
||||||
group,
|
|
||||||
"rate",
|
|
||||||
1 - (fullValue / 0x2000)
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -640,39 +788,79 @@ PioneerDDJFLX4.tempoSliderLSB = function(channel, control, value, status, group)
|
||||||
// allow further increasing/decreasing of all the values.
|
// allow further increasing/decreasing of all the values.
|
||||||
//
|
//
|
||||||
|
|
||||||
PioneerDDJFLX4.beatjumpPadPressed = function(_channel, control, value, _status, group) {
|
PioneerDDJFLX4.beatjumpPadPressed = function (
|
||||||
|
_channel,
|
||||||
|
control,
|
||||||
|
value,
|
||||||
|
_status,
|
||||||
|
group
|
||||||
|
) {
|
||||||
if (value === 0) {
|
if (value === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
engine.setValue(group, "beatjump_size", Math.abs(PioneerDDJFLX4.beatjumpSizeForPad[control]));
|
engine.setValue(
|
||||||
engine.setValue(group, "beatjump", PioneerDDJFLX4.beatjumpSizeForPad[control]);
|
group,
|
||||||
|
"beatjump_size",
|
||||||
|
Math.abs(PioneerDDJFLX4.beatjumpSizeForPad[control])
|
||||||
|
);
|
||||||
|
engine.setValue(
|
||||||
|
group,
|
||||||
|
"beatjump",
|
||||||
|
PioneerDDJFLX4.beatjumpSizeForPad[control]
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.increaseBeatjumpSizes = function(_channel, control, value, _status, group) {
|
PioneerDDJFLX4.increaseBeatjumpSizes = function (
|
||||||
|
_channel,
|
||||||
|
control,
|
||||||
|
value,
|
||||||
|
_status,
|
||||||
|
group
|
||||||
|
) {
|
||||||
if (value === 0 || PioneerDDJFLX4.beatjumpSizeForPad[0x21] * 16 > 16) {
|
if (value === 0 || PioneerDDJFLX4.beatjumpSizeForPad[0x21] * 16 > 16) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Object.keys(PioneerDDJFLX4.beatjumpSizeForPad).forEach(function (pad) {
|
Object.keys(PioneerDDJFLX4.beatjumpSizeForPad).forEach(function (pad) {
|
||||||
PioneerDDJFLX4.beatjumpSizeForPad[pad] = PioneerDDJFLX4.beatjumpSizeForPad[pad] * 16;
|
PioneerDDJFLX4.beatjumpSizeForPad[pad] =
|
||||||
|
PioneerDDJFLX4.beatjumpSizeForPad[pad] * 16;
|
||||||
});
|
});
|
||||||
engine.setValue(group, "beatjump_size", PioneerDDJFLX4.beatjumpSizeForPad[0x21]);
|
engine.setValue(
|
||||||
|
group,
|
||||||
|
"beatjump_size",
|
||||||
|
PioneerDDJFLX4.beatjumpSizeForPad[0x21]
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.decreaseBeatjumpSizes = function(_channel, control, value, _status, group) {
|
PioneerDDJFLX4.decreaseBeatjumpSizes = function (
|
||||||
|
_channel,
|
||||||
|
control,
|
||||||
|
value,
|
||||||
|
_status,
|
||||||
|
group
|
||||||
|
) {
|
||||||
if (value === 0 || PioneerDDJFLX4.beatjumpSizeForPad[0x21] / 16 < 1 / 16) {
|
if (value === 0 || PioneerDDJFLX4.beatjumpSizeForPad[0x21] / 16 < 1 / 16) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Object.keys(PioneerDDJFLX4.beatjumpSizeForPad).forEach(function (pad) {
|
Object.keys(PioneerDDJFLX4.beatjumpSizeForPad).forEach(function (pad) {
|
||||||
PioneerDDJFLX4.beatjumpSizeForPad[pad] = PioneerDDJFLX4.beatjumpSizeForPad[pad] / 16;
|
PioneerDDJFLX4.beatjumpSizeForPad[pad] =
|
||||||
|
PioneerDDJFLX4.beatjumpSizeForPad[pad] / 16;
|
||||||
});
|
});
|
||||||
engine.setValue(group, "beatjump_size", PioneerDDJFLX4.beatjumpSizeForPad[0x21]);
|
engine.setValue(
|
||||||
|
group,
|
||||||
|
"beatjump_size",
|
||||||
|
PioneerDDJFLX4.beatjumpSizeForPad[0x21]
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Sampler mode
|
// Sampler mode
|
||||||
//
|
//
|
||||||
|
|
||||||
PioneerDDJFLX4.samplerPlayOutputCallbackFunction = function(value, group, _control) {
|
PioneerDDJFLX4.samplerPlayOutputCallbackFunction = function (
|
||||||
|
value,
|
||||||
|
group,
|
||||||
|
_control
|
||||||
|
) {
|
||||||
if (value === 1) {
|
if (value === 1) {
|
||||||
const curPad = group.match(script.samplerRegEx)[1];
|
const curPad = group.match(script.samplerRegEx)[1];
|
||||||
let deckIndex = 0;
|
let deckIndex = 0;
|
||||||
|
@ -692,36 +880,48 @@ PioneerDDJFLX4.samplerPlayOutputCallbackFunction = function(value, group, _contr
|
||||||
padIndex = curPad - 9;
|
padIndex = curPad - 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
PioneerDDJFLX4.startSamplerBlink(
|
PioneerDDJFLX4.startSamplerBlink(0x97 + deckIndex, 0x30 + padIndex, group);
|
||||||
0x97 + deckIndex,
|
|
||||||
0x30 + padIndex,
|
|
||||||
group);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.padModeKeyPressed = function(_channel, _control, value, _status, _group) {
|
PioneerDDJFLX4.padModeKeyPressed = function (
|
||||||
const deck = (_status === 0x90 ? PioneerDDJFLX4.lights.deck1 : PioneerDDJFLX4.lights.deck2);
|
_channel,
|
||||||
|
_control,
|
||||||
|
value,
|
||||||
|
_status,
|
||||||
|
_group
|
||||||
|
) {
|
||||||
|
const deck =
|
||||||
|
_status === 0x90
|
||||||
|
? PioneerDDJFLX4.lights.deck1
|
||||||
|
: PioneerDDJFLX4.lights.deck2;
|
||||||
|
|
||||||
if (_control === 0x1B) {
|
if (_control === 0x1b) {
|
||||||
PioneerDDJFLX4.toggleLight(deck.hotcueMode, true);
|
PioneerDDJFLX4.toggleLight(deck.hotcueMode, true);
|
||||||
} else if (_control === 0x69) {
|
} else if (_control === 0x69) {
|
||||||
PioneerDDJFLX4.toggleLight(deck.keyboardMode, true);
|
PioneerDDJFLX4.toggleLight(deck.keyboardMode, true);
|
||||||
} else if (_control === 0x1E) {
|
} else if (_control === 0x1e) {
|
||||||
PioneerDDJFLX4.toggleLight(deck.padFX1Mode, true);
|
PioneerDDJFLX4.toggleLight(deck.padFX1Mode, true);
|
||||||
} else if (_control === 0x6B) {
|
} else if (_control === 0x6b) {
|
||||||
PioneerDDJFLX4.toggleLight(deck.padFX2Mode, true);
|
PioneerDDJFLX4.toggleLight(deck.padFX2Mode, true);
|
||||||
} else if (_control === 0x20) {
|
} else if (_control === 0x20) {
|
||||||
PioneerDDJFLX4.toggleLight(deck.beatJumpMode, true);
|
PioneerDDJFLX4.toggleLight(deck.beatJumpMode, true);
|
||||||
} else if (_control === 0x6D) {
|
} else if (_control === 0x6d) {
|
||||||
PioneerDDJFLX4.toggleLight(deck.beatLoopMode, true);
|
PioneerDDJFLX4.toggleLight(deck.beatLoopMode, true);
|
||||||
} else if (_control === 0x22) {
|
} else if (_control === 0x22) {
|
||||||
PioneerDDJFLX4.toggleLight(deck.samplerMode, true);
|
PioneerDDJFLX4.toggleLight(deck.samplerMode, true);
|
||||||
} else if (_control === 0x6F) {
|
} else if (_control === 0x6f) {
|
||||||
PioneerDDJFLX4.toggleLight(deck.keyShiftMode, true);
|
PioneerDDJFLX4.toggleLight(deck.keyShiftMode, true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.samplerPadPressed = function(_channel, _control, value, _status, group) {
|
PioneerDDJFLX4.samplerPadPressed = function (
|
||||||
|
_channel,
|
||||||
|
_control,
|
||||||
|
value,
|
||||||
|
_status,
|
||||||
|
group
|
||||||
|
) {
|
||||||
if (engine.getValue(group, "track_loaded")) {
|
if (engine.getValue(group, "track_loaded")) {
|
||||||
engine.setValue(group, "cue_gotoandplay", value);
|
engine.setValue(group, "cue_gotoandplay", value);
|
||||||
} else {
|
} else {
|
||||||
|
@ -729,7 +929,13 @@ PioneerDDJFLX4.samplerPadPressed = function(_channel, _control, value, _status,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.samplerPadShiftPressed = function(_channel, _control, value, _status, group) {
|
PioneerDDJFLX4.samplerPadShiftPressed = function (
|
||||||
|
_channel,
|
||||||
|
_control,
|
||||||
|
value,
|
||||||
|
_status,
|
||||||
|
group
|
||||||
|
) {
|
||||||
if (engine.getValue(group, "play")) {
|
if (engine.getValue(group, "play")) {
|
||||||
engine.setValue(group, "cue_gotoandstop", value);
|
engine.setValue(group, "cue_gotoandstop", value);
|
||||||
} else if (engine.getValue(group, "track_loaded")) {
|
} else if (engine.getValue(group, "track_loaded")) {
|
||||||
|
@ -747,7 +953,7 @@ PioneerDDJFLX4.startSamplerBlink = function(channel, control, group) {
|
||||||
// blink the appropriate pad
|
// blink the appropriate pad
|
||||||
midi.sendShortMsg(channel, control, val);
|
midi.sendShortMsg(channel, control, val);
|
||||||
// also blink the pad while SHIFT is pressed
|
// also blink the pad while SHIFT is pressed
|
||||||
midi.sendShortMsg((channel+1), control, val);
|
midi.sendShortMsg(channel + 1, control, val);
|
||||||
|
|
||||||
const isPlaying = engine.getValue(group, "play") === 1;
|
const isPlaying = engine.getValue(group, "play") === 1;
|
||||||
|
|
||||||
|
@ -757,7 +963,7 @@ PioneerDDJFLX4.startSamplerBlink = function(channel, control, group) {
|
||||||
// set the pad LED to ON
|
// set the pad LED to ON
|
||||||
midi.sendShortMsg(channel, control, 0x7f);
|
midi.sendShortMsg(channel, control, 0x7f);
|
||||||
// set the pad LED to ON while SHIFT is pressed
|
// set the pad LED to ON while SHIFT is pressed
|
||||||
midi.sendShortMsg((channel+1), control, 0x7f);
|
midi.sendShortMsg(channel + 1, control, 0x7f);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -771,20 +977,37 @@ PioneerDDJFLX4.stopSamplerBlink = function(channel, control) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
PioneerDDJFLX4.toggleQuantize = function (
|
||||||
PioneerDDJFLX4.toggleQuantize = function(_channel, _control, value, _status, group) {
|
_channel,
|
||||||
|
_control,
|
||||||
|
value,
|
||||||
|
_status,
|
||||||
|
group
|
||||||
|
) {
|
||||||
if (value) {
|
if (value) {
|
||||||
script.toggleControl(group, "quantize");
|
script.toggleControl(group, "quantize");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.quickJumpForward = function(_channel, _control, value, _status, group) {
|
PioneerDDJFLX4.quickJumpForward = function (
|
||||||
|
_channel,
|
||||||
|
_control,
|
||||||
|
value,
|
||||||
|
_status,
|
||||||
|
group
|
||||||
|
) {
|
||||||
if (value) {
|
if (value) {
|
||||||
engine.setValue(group, "beatjump", PioneerDDJFLX4.quickJumpSize);
|
engine.setValue(group, "beatjump", PioneerDDJFLX4.quickJumpSize);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PioneerDDJFLX4.quickJumpBack = function(_channel, _control, value, _status, group) {
|
PioneerDDJFLX4.quickJumpBack = function (
|
||||||
|
_channel,
|
||||||
|
_control,
|
||||||
|
value,
|
||||||
|
_status,
|
||||||
|
group
|
||||||
|
) {
|
||||||
if (value) {
|
if (value) {
|
||||||
engine.setValue(group, "beatjump", -PioneerDDJFLX4.quickJumpSize);
|
engine.setValue(group, "beatjump", -PioneerDDJFLX4.quickJumpSize);
|
||||||
}
|
}
|
||||||
|
@ -805,14 +1028,14 @@ PioneerDDJFLX4.shutdown = function() {
|
||||||
midi.sendShortMsg(0x97, 0x30 + i, 0x00); // Deck 1 pads
|
midi.sendShortMsg(0x97, 0x30 + i, 0x00); // Deck 1 pads
|
||||||
midi.sendShortMsg(0x98, 0x30 + i, 0x00); // Deck 1 pads with SHIFT
|
midi.sendShortMsg(0x98, 0x30 + i, 0x00); // Deck 1 pads with SHIFT
|
||||||
midi.sendShortMsg(0x99, 0x30 + i, 0x00); // Deck 2 pads
|
midi.sendShortMsg(0x99, 0x30 + i, 0x00); // Deck 2 pads
|
||||||
midi.sendShortMsg(0x9A, 0x30 + i, 0x00); // Deck 2 pads with SHIFT
|
midi.sendShortMsg(0x9a, 0x30 + i, 0x00); // Deck 2 pads with SHIFT
|
||||||
}
|
}
|
||||||
// turn off all Hotcue LEDs
|
// turn off all Hotcue LEDs
|
||||||
for (i = 0; i <= 7; ++i) {
|
for (i = 0; i <= 7; ++i) {
|
||||||
midi.sendShortMsg(0x97, 0x00 + i, 0x00); // Deck 1 pads
|
midi.sendShortMsg(0x97, 0x00 + i, 0x00); // Deck 1 pads
|
||||||
midi.sendShortMsg(0x98, 0x00 + i, 0x00); // Deck 1 pads with SHIFT
|
midi.sendShortMsg(0x98, 0x00 + i, 0x00); // Deck 1 pads with SHIFT
|
||||||
midi.sendShortMsg(0x99, 0x00 + i, 0x00); // Deck 2 pads
|
midi.sendShortMsg(0x99, 0x00 + i, 0x00); // Deck 2 pads
|
||||||
midi.sendShortMsg(0x9A, 0x00 + i, 0x00); // Deck 2 pads with SHIFT
|
midi.sendShortMsg(0x9a, 0x00 + i, 0x00); // Deck 2 pads with SHIFT
|
||||||
}
|
}
|
||||||
|
|
||||||
// turn off loop in and out lights
|
// turn off loop in and out lights
|
||||||
|
|
Loading…
Reference in New Issue