Skip to content

Commit

Permalink
controllers: fix engine.beginTimer() syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Dec 5, 2023
1 parent 40d23f3 commit 067f5d6
Show file tree
Hide file tree
Showing 35 changed files with 156 additions and 156 deletions.
10 changes: 5 additions & 5 deletions res/controllers/Akai-LPD8-RK-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ LPD8RK.init = function (id, debug) { // called when the device is opened & set u
engine.softTakeover("[Sampler2]","rate",true);

//set LED timer
LPD8RK.ledTimer = engine.beginTimer(LPD8RK.LEDinterval, "LPD8RK.setLeds()");
LPD8RK.ledTimer = engine.beginTimer(LPD8RK.LEDinterval, LPD8RK.setLeds);
};

LPD8RK.shutdown = function () {
Expand All @@ -263,7 +263,7 @@ LPD8RK.shutdown = function () {
LPD8RK.resetLEDTimer = function () {
engine.stopTimer(LPD8RK.ledTimer);
LPD8RK.setLeds()
LPD8RK.ledTimer = engine.beginTimer(LPD8RK.LEDinterval, "LPD8RK.setLeds()");
LPD8RK.ledTimer = engine.beginTimer(LPD8RK.LEDinterval, LPD8RK.setLeds);
};

LPD8RK.setLeds = function () {
Expand Down Expand Up @@ -376,7 +376,7 @@ LPD8RK.reloopButton = function (channel, control, value, status, group) {
engine.stopTimer(LPD8RK.reloopTimer);
LPD8RK.loopbuttonDown=true;
LPD8RK.doreloop=true;
LPD8RK.reloopTimer = engine.beginTimer(500, "LPD8RK.disablereloop()", true);
LPD8RK.reloopTimer = engine.beginTimer(500, LPD8RK.disablereloop, true);
} else {//button was released
LPD8RK.loopbuttonDown=false;
if (LPD8RK.doreloop===true) {engine.setValue(group, "reloop_exit", 1);};
Expand Down Expand Up @@ -437,11 +437,11 @@ LPD8RK.hotcueBankDial = function (channel, control, value, status, group) {
LPD8RK.oldHotcueBank=LPD8RK.hotcueBank;
//set timer to clear old bank number after 500 msec, so bank indicator light will light up
engine.stopTimer(LPD8RK.oldbanktimer);
LPD8RK.oldbanktimer = engine.beginTimer(500, "LPD8RK.resetOldBank()", true);
LPD8RK.oldbanktimer = engine.beginTimer(500, LPD8RK.resetOldBank, true);

//set timer to restart LED updates in 500 msec
engine.stopTimer(LPD8RK.LEDPauseTimer);
LPD8RK.LEDPauseTimer = engine.beginTimer(LPD8RK.LEDinterval, "LPD8RK.resetLEDTimer()", true);
LPD8RK.LEDPauseTimer = engine.beginTimer(LPD8RK.LEDinterval, LPD8RK.resetLEDTimer, true);
};

LPD8RK.looplenDial = function (channel, control, value, status, group) {
Expand Down
2 changes: 1 addition & 1 deletion res/controllers/American-Audio-VMS2-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ VMS2.playlight = function(value, group, control) {
deck.Buttons.Pause.setLed(LedState.on);
// start a fancy blink timer
deck.switchPlaylightOff = true;
deck.playTimer = engine.beginTimer(500,"VMS2.playlightflash(\""+group+"\")");
deck.playTimer = engine.beginTimer(500, function() { VMS2.playlightflash(group); });
}
};

Expand Down
2 changes: 1 addition & 1 deletion res/controllers/Behringer-BCD3000-Advanced-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ BehringerBCD3000.jogWheel = function (channel, control, value, status, group) {
scratchValue = (value - 0x40);
engine.scratchEnable(deck + 1, 100, 33+1/3, 1.0/8, (1.0/8)/32);
engine.scratchTick(deck + 1, scratchValue);
BehringerBCD3000.scratchTimer[deck] = engine.beginTimer(20, "BehringerBCD3000.stopScratch(" + deck + ")", true);
BehringerBCD3000.scratchTimer[deck] = engine.beginTimer(20, function() { BehringerBCD3000.stopScratch(deck); }, true);

} else if (BehringerBCD3000.onKey) {
if (value > 0x40){
Expand Down
4 changes: 3 additions & 1 deletion res/controllers/DJ-Tech-CDJ-101-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ DJTechCDJ101.jogtouch = function(channel, control, value, status, group)
}
else {
DJTechCDJ101.outer2inner = true;
DJTechCDJ101.scratch_timer = engine.beginTimer(DJTechCDJ101.scratch_timeout, 'DJTechCDJ101.finishScratch(' + deck + ', true)');
DJTechCDJ101.scratch_timer = engine.beginTimer(
DJTechCDJ101.scratch_timeout,
function() { DJTechCDJ101.finishScratch(deck, true); });
}
}
}
Expand Down
18 changes: 9 additions & 9 deletions res/controllers/DJ-Tech-Kontrol-One-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ KONTROL1.mod["s"]={state:"o",timer:false,doshift:true};
KONTROL1.init = function init(id, debug) { // called when the device is opened & set up
if (KONTROL1.debug>2){print("##function: "+KONTROL1.getFunctionName())};
KONTROL1.updateLEDs();
if(KONTROL1.disableFlash!==true)KONTROL1.ledTimer = engine.beginTimer(1000, "KONTROL1.doLEDs()");//set timer for LED indicator flashes
if(KONTROL1.disableFlash!==true)KONTROL1.ledTimer = engine.beginTimer(1000, KONTROL1.doLEDs);//set timer for LED indicator flashes
engine.connectControl("[Channel1]", "volume", "KONTROL1.testconnect");
};

Expand Down Expand Up @@ -113,7 +113,7 @@ KONTROL1.knobPress = function knobPress(knobnum){
//{state:"o",timer:false,dobankswitch:true};
KONTROL1.modPress(knobnum);//turn mod on
engine.stopTimer(KONTROL1.mod[knobnum]["timer"]);//kill any previous timer
KONTROL1.mod[knobnum]["timer"]=engine.beginTimer(KONTROL1.modTimeout, "KONTROL1.disableBankSwitch('"+knobnum+"')", true);
KONTROL1.mod[knobnum]["timer"]=engine.beginTimer(KONTROL1.modTimeout, function() { KONTROL1.disableBankSwitch(knobnum); }, true);
}

KONTROL1.knobRelease = function knobRelease(knobnum){
Expand Down Expand Up @@ -145,7 +145,7 @@ KONTROL1.shiftPress = function shiftPress(){
var knobnum="s";
KONTROL1.modPress(knobnum);//turn mod on
engine.stopTimer(KONTROL1.mod[knobnum]["timer"]);//kill any previous timer
KONTROL1.mod[knobnum]["timer"]=engine.beginTimer(500, "KONTROL1.disableShiftSwitch('"+knobnum+"')", true);
KONTROL1.mod[knobnum]["timer"]=engine.beginTimer(500, function() { KONTROL1.disableShiftSwitch(knobnum); }, true);
}

KONTROL1.shiftRelease = function shiftRelease(){
Expand Down Expand Up @@ -198,7 +198,7 @@ KONTROL1.modRelease = function modRelease(knobnum){
KONTROL1.doLEDs = function doLEDs() {
if (KONTROL1.debug>2){print("##function: "+KONTROL1.getFunctionName())};
engine.stopTimer(KONTROL1.flashTimer);
KONTROL1.flashTimer=engine.beginTimer(30, "KONTROL1.bankIndicators()");
KONTROL1.flashTimer=engine.beginTimer(30, KONTROL1.bankIndicators);
return;
};

Expand Down Expand Up @@ -589,7 +589,7 @@ KONTROL1.cueClear = function cueClear(cue, control, deck){//clear hotcue - OR mo
if(engine.getValue(group, "hotcue_"+cue+"_enabled")!=true){//hotcue not set - prepare to move next hotcue pressed to this button
KONTROL1.cueMoveToNum=cue;
engine.stopTimer(KONTROL1.cueMoveIndicator);
KONTROL1.cueMoveIndicator=engine.beginTimer(100, "KONTROL1.cueMoveIndicatorLEDs("+control+")");//start timer for LED indicator flasher showing the button we're moving to
KONTROL1.cueMoveIndicator=engine.beginTimer(100, function() { KONTROL1.cueMoveIndicatorLEDs(control); });//start timer for LED indicator flasher showing the button we're moving to
return true;
}

Expand Down Expand Up @@ -817,7 +817,7 @@ KONTROL1.reloopButton = function reloopButton(value, deck) {//reloop/exit button
engine.stopTimer(KONTROL1.reloopTimer);
KONTROL1.loopbuttonDown=true;
KONTROL1.doreloop=true;
KONTROL1.reloopTimer = engine.beginTimer(500, "KONTROL1.disablereloop()", true);
KONTROL1.reloopTimer = engine.beginTimer(500, KONTROL1.disablereloop, true);
} else {//button was released
KONTROL1.loopbuttonDown=false;
if (KONTROL1.doreloop===true) {
Expand Down Expand Up @@ -881,7 +881,7 @@ KONTROL1.loopIn = function loopIn(value, deck) {
if (value>0){//button was pressed
KONTROL1.loopinbuttonDown=true;
KONTROL1.doloopin=true;
KONTROL1.loopinbuttonTimer = engine.beginTimer(500, "KONTROL1.disableloopin()", true);
KONTROL1.loopinbuttonTimer = engine.beginTimer(500, KONTROL1.disableloopin, true);
} else {//button was released
KONTROL1.loopinbuttonDown=false;
if (KONTROL1.doloopin===true) {engine.setValue(group, "loop_in", 1);engine.setValue(group, "loop_in", 0);};
Expand All @@ -900,7 +900,7 @@ KONTROL1.loopOut = function loopOut(value, deck) {
if (value>0){//button was pressed
KONTROL1.loopoutbuttonDown=true;
KONTROL1.doloopout=true;
KONTROL1.loopoutbuttonTimer = engine.beginTimer(500, "KONTROL1.disableloopout()", true);
KONTROL1.loopoutbuttonTimer = engine.beginTimer(500, KONTROL1.disableloopout, true);
} else {//button was released
KONTROL1.loopoutbuttonDown=false;
if (KONTROL1.doloopout===true) {engine.setValue(group, "loop_out", 1);};
Expand Down Expand Up @@ -1307,7 +1307,7 @@ KONTROL1.test = function test(channel, control, value, status, group) {
};


//KONTROL1.ledTimer = engine.beginTimer(250, "KONTROL1.testflash()");
//KONTROL1.ledTimer = engine.beginTimer(250, KONTROL1.testflash);
//midi.sendShortMsg(status, ctrl, state);
//engine.stopTimer(KONTROL1.ledTimer);

Expand Down
2 changes: 1 addition & 1 deletion res/controllers/DJ-Tech-i-Mix-Reload-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ DJTechiMixReload.init = function(ID)
DJTechiMixReload.setbutton["[Channel2]"] = false;

DJTechiMixReload.allleadson();
engine.beginTimer(4000,"DJTechiMixReload.allleadsoff()",true);
engine.beginTimer(4000, DJTechiMixReload.allleadsoff, true);
for(var deck = 1; deck <= 2; deck++){
engine.connectControl("[Channel" + deck + "]","play","DJTechiMixReload.deck" + deck + "play");
engine.connectControl("[Channel" + deck + "]","cue_default","DJTechiMixReload.deck" + deck + "cue");
Expand Down
20 changes: 10 additions & 10 deletions res/controllers/Denon-DN-SC2000.midi.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ DenonDNSC2000.newValue = function(currentVal,min,max,increment,ticksCount) {

DenonDNSC2000.flanger = function (midino, control, value, status, group) {
DenonDNSC2000.toggleBinaryValue(group,'flanger');
engine.beginTimer(100, 'DenonDNSC2000.handleFlangerLed("'+group+'")', true);
engine.beginTimer(100, function() { DenonDNSC2000.handleFlangerLed(group); }, true);
}

DenonDNSC2000.changeDepth = function (midino, control, value, status, group) {
Expand Down Expand Up @@ -100,7 +100,7 @@ DenonDNSC2000.loadSelectedTrack = function (midino, control, value, status, grou
}
else {
engine.setValue(group, 'LoadSelectedTrack', 1);
engine.beginTimer(1500, 'DenonDNSC2000.handleLeds("'+group+'")', true);
engine.beginTimer(1500, function() { DenonDNSC2000.handleLeds(group); }, true);
}
}

Expand Down Expand Up @@ -170,7 +170,7 @@ DenonDNSC2000.hotcue = function(cueIndex, group, value, shift) {
else
engine.setValue(group, 'hotcue_' + cueIndex + '_clear',1);
}
engine.beginTimer(100, 'DenonDNSC2000.handleLoopAndHotcuesLeds("'+group+'")', true);
engine.beginTimer(100, function() { DenonDNSC2000.handleLoopAndHotcuesLeds(group); }, true);
}

DenonDNSC2000.loopIn = function(group, value, shift) {
Expand All @@ -179,7 +179,7 @@ DenonDNSC2000.loopIn = function(group, value, shift) {
}
else
engine.setValue(group, 'loop_in', 1);
engine.beginTimer(100, 'DenonDNSC2000.handleLoopAndHotcuesLeds("'+group+'")', true);
engine.beginTimer(100, function() { DenonDNSC2000.handleLoopAndHotcuesLeds(group); }, true);
}

DenonDNSC2000.loopOut = function(group, value, shift) {
Expand All @@ -190,7 +190,7 @@ DenonDNSC2000.loopOut = function(group, value, shift) {
}
else
engine.setValue(group, 'loop_out', 1);
engine.beginTimer(100, 'DenonDNSC2000.handleLoopAndHotcuesLeds("'+group+'")', true);
engine.beginTimer(100, function() { DenonDNSC2000.handleLoopAndHotcuesLeds(group); }, true);
}

DenonDNSC2000.reloop = function(group, value, shift) {
Expand Down Expand Up @@ -221,7 +221,7 @@ DenonDNSC2000.reloop = function(group, value, shift) {
engine.setValue(group, 'reloop_exit', 1);
}
}
engine.beginTimer(100, 'DenonDNSC2000.handleLoopAndHotcuesLeds("'+group+'")', true);
engine.beginTimer(100, function() { DenonDNSC2000.handleLoopAndHotcuesLeds(group); }, true);
}

DenonDNSC2000.resizeLoop = function(midino, control, value, status, group) {
Expand Down Expand Up @@ -267,7 +267,7 @@ DenonDNSC2000.resizeLoop = function(midino, control, value, status, group) {
newLoopOutPosition = Math.max(0,newLoopOutPosition - newLoopOutPosition % 2);
engine.setValue(group, 'loop_end_position', newLoopOutPosition);
}
engine.beginTimer(100, 'DenonDNSC2000.handleLoopAndHotcuesLeds("'+group+'")', true);
engine.beginTimer(100, function() { DenonDNSC2000.handleLoopAndHotcuesLeds(group); }, true);
}

DenonDNSC2000.moveLoopLeft = function(midino, control, value, status, group) {
Expand Down Expand Up @@ -311,7 +311,7 @@ DenonDNSC2000.play = function (midino, control, value, status, group) {
DenonDNSC2000.toggleBinaryValue(group,'play');
}
}
engine.beginTimer(100, 'DenonDNSC2000.handlePlayLed("'+group+'")', true);
engine.beginTimer(100, function() { DenonDNSC2000.handlePlayLed(group); }, true);
}

DenonDNSC2000.cue = function (midino, control, value, status, group) {
Expand All @@ -330,14 +330,14 @@ DenonDNSC2000.cue = function (midino, control, value, status, group) {
DenonDNSC2000.keyLock = function (midino, control, value, status, group) {
if ((status & 0xF0) == 0x90) {
DenonDNSC2000.toggleBinaryValue(group,'keylock');
engine.beginTimer(100, 'DenonDNSC2000.handleKeyLockLed("'+group+'")', true);
engine.beginTimer(100, function() { DenonDNSC2000.handleKeyLockLed(group); }, true);
}
}

DenonDNSC2000.beatSync = function (midino, control, value, status, group) {
if ((status & 0xF0) == 0x90) {
DenonDNSC2000.toggleBinaryValue(group,'beatsync');
engine.beginTimer(100, 'DenonDNSC2000.handleBeatSyncLed("'+group+'")', true);
engine.beginTimer(100, function() { DenonDNSC2000.handleBeatSyncLed(group); }, true);
}
}

Expand Down
10 changes: 4 additions & 6 deletions res/controllers/Electrix-Tweaker-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,7 @@ ElectrixTweaker.arrowSide = function(channel, control, value, status, group) {
group = ElectrixTweaker.deck[group];
if (value) {
if (ElectrixTweaker.topShift) {
engine.setValue(group, "eject", 1);
engine.beginTimer(250, "engine.setValue(\""+group+"\", \"eject\", 0)", true);
script.triggerControl(group, "eject", 250);
} else {
engine.setValue(group, "LoadSelectedTrack", 1);
}
Expand Down Expand Up @@ -553,8 +552,7 @@ ElectrixTweaker.oneShot = function(channel, control, value, status, group) {
engine.setValue(group, "sync_enabled", 0);
engine.setValue(group, "repeat", 0);
engine.setValue(group, "play", 0);
engine.setValue(group, "eject", 1);
engine.beginTimer(250, "engine.setValue(\""+group+"\", \"eject\", 0)", true);
script.triggerControl(group, "eject", 250); }, true);
} else {
if (ElectrixTweaker.samplerVelocityAsVolume) {
engine.setValue(group, "volume", script.absoluteNonLin(value * ElectrixTweaker.samplerSensitivity, 0, .25, 1));
Expand Down Expand Up @@ -696,7 +694,7 @@ ElectrixTweaker.midEncoder = function(channel, control, value, status, group) {
engine.setValue(group, "beatjump_32_forward", 1);
midi.sendShortMsg(0xB0, ElectrixTweaker.encoders[group].Mid.ring, 127);
}
ElectrixTweaker.midEncoderLEDTimer[group] = engine.beginTimer(1000, "midi.sendShortMsg(0xB0, ElectrixTweaker.encoders[\""+group+"\"][\"Mid\"][\"ring\"], 64)", true);
ElectrixTweaker.midEncoderLEDTimer[group] = engine.beginTimer(1000, function() { midi.sendShortMsg(0xB0, ElectrixTweaker.encoders[group][\"Mid\"][\"ring\"], 64); }, true);
} else {
switch (ElectrixTweaker.mode[group]) {
case "eq":
Expand All @@ -712,7 +710,7 @@ ElectrixTweaker.midEncoder = function(channel, control, value, status, group) {
engine.setValue(group, "loop_move_" + ElectrixTweaker.loopMoveSize[group] + "_forward", 1);
midi.sendShortMsg(0xB0, ElectrixTweaker.encoders[group].Mid.ring, 127);
}
ElectrixTweaker.midEncoderLEDTimer[group] = engine.beginTimer(1000, "midi.sendShortMsg(0xB0, ElectrixTweaker.encoders[\""+group+"\"][\"Mid\"][\"ring\"], 64)", true);
ElectrixTweaker.midEncoderLEDTimer[group] = engine.beginTimer(1000, function() { midi.sendShortMsg(0xB0, ElectrixTweaker.encoders[group][\"Mid\"][\"ring\"], 64); }, true);
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion res/controllers/Gemini-FirstMix-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ firstmix.preview = function (channel, control, value, status, group) {
engine.setValue("[Sampler4]", "volume", 0);
engine.setValue("[Sampler4]", "pfl", 1);
engine.setValue("[Sampler4]", "LoadSelectedTrack", 1);
engine.beginTimer(250,"engine.setValue(\"[Sampler4]\", \"play\", 1)",true); // I had to add a delay because this wouldn't work otherwise
engine.beginTimer(250, function() { engine.setValue("[Sampler4]", "play", 1); }, true); // I had to add a delay because this wouldn't work otherwise
firstmix.setLED(firstmix.leds[0]["preview"], 0x7f);
firstmix.previewButton = true;
}
Expand Down
4 changes: 2 additions & 2 deletions res/controllers/Hercules DJ Control MP3 e2-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ HerculesMP3e2.holdButton = function (group, value, first, second) {
if (value) {
engine.setValue(group, first, 1); // Set "On" the first function
holdTimerID = engine.beginTimer(2000, "HerculesMP3e2.holdTimer(\""+group+"\", \""+first+"\", \""+second+"\")", true);
holdTimerID = engine.beginTimer(2000, function() { HerculesMP3e2.holdTimer(group, first, second); }, true);
}
else {
if (holdButtonFlag) {
Expand Down Expand Up @@ -606,7 +606,7 @@ HerculesMP3e2.scratch = function(midino, control, value, status, group) {
if (scratchMode === 0) {
// Enable the scratch mode on the corresponding deck and start the timer
scratchMode = 1;
scratchTimer = engine.beginTimer(scratchResetTime, "HerculesMP3e2.wheelOnOff()");
scratchTimer = engine.beginTimer(scratchResetTime, HerculesMP3e2.wheelOnOff);
midi.sendShortMsg(0x90, 45, 0x7F); // Switch-on the Scratch led
engine.setValue("[Channel1]", "keylock", 0);
engine.setValue("[Channel2]", "keylock", 0);
Expand Down
2 changes: 1 addition & 1 deletion res/controllers/Hercules-DJ-Console-Mk1-hid-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ HerculesMk1Hid.scroll_tracks = function(g, e, v) {
if (v > 0) {
engine.setValue("[Playlist]", e == "track_next_a" ? "SelectNextTrack" : "SelectPrevTrack", 1);
if (!HerculesMk1Hid.scroll_timer) {
HerculesMk1Hid.scroll_timer = engine.beginTimer(150, 'HerculesMk1Hid.scroll_tracks("[Playlist]","' + e + '",' + v + ')');
HerculesMk1Hid.scroll_timer = engine.beginTimer(150, function() { HerculesMk1Hid.scroll_tracks("[Playlist]","' + e + '",' + v + '); });
}
}
else {
Expand Down
2 changes: 1 addition & 1 deletion res/controllers/Hercules-DJ-Console-Mk2-hid-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ HerculesMk2Hid.scroll_tracks = function(g, e, v) {
if (v > 0) {
engine.setValue("[Playlist]", e == "track_next_a" ? "SelectNextTrack" : "SelectPrevTrack", 1);
if (!HerculesMk2Hid.scroll_timer) {
HerculesMk2Hid.scroll_timer = engine.beginTimer(150, 'HerculesMk2Hid.scroll_tracks("[Playlist]","' + e + '",' + v + ')');
HerculesMk2Hid.scroll_timer = engine.beginTimer(150, function() { HerculesMk2Hid.scroll_tracks("[Playlist]","' + e + '",' + v + '); });
}
}
else {
Expand Down
Loading

0 comments on commit 067f5d6

Please sign in to comment.