From d99d55a9cac30190fc42afe793813f429d20fc93 Mon Sep 17 00:00:00 2001 From: Owen Williams Date: Sun, 26 Jul 2020 16:00:48 -0400 Subject: controller scripts: remove trailing whitespace --- res/controllers/Akai-LPD8-RK-scripts.js | 88 +- .../American-Audio-RADIUS-2000-scripts.js | 4 +- res/controllers/American-Audio-VMS4-scripts.js | 30 +- .../Behringer-BCD3000-Advanced-scripts.js | 20 +- res/controllers/Behringer-BCD3000-scripts.js | 12 +- res/controllers/Behringer-CMDStudio4a-scripts.js | 548 +- res/controllers/DJ-Tech-CDJ-101-scripts.js | 20 +- res/controllers/DJ-Tech-Kontrol-One-scripts.js | 134 +- res/controllers/DJ-Tech-Mixer-One-scripts.js | 6 +- res/controllers/DJ-Tech-i-Mix-Reload-scripts.js | 80 +- res/controllers/Denon-MC3000-scripts.js | 68 +- res/controllers/Denon-MC4000-scripts.js | 26 +- res/controllers/EKS-Otus.js | 50 +- res/controllers/Electrix-Tweaker-scripts.js | 54 +- res/controllers/Gemini-CDMP-7000-scripts.js | 136 +- res/controllers/Gemini-FirstMix-scripts.js | 530 +- .../Hercules DJ Control MP3 e2-scripts.js | 24 +- .../Hercules-DJ-Console-4-Mx-scripts.js | 3586 ++++++------- .../Hercules-DJ-Console-Mk1-hid-scripts.js | 48 +- .../Hercules-DJ-Console-Mk2-hid-scripts.js | 44 +- res/controllers/Hercules-DJ-Console-Mk2-scripts.js | 122 +- .../Hercules-DJ-Console-RMX-2-scripts.js | 16 +- .../Hercules-DJ-Console-RMX-hid-scripts.js | 2 +- res/controllers/Hercules-DJ-Console-RMX-scripts.js | 2 +- res/controllers/Hercules-DJ-Control-AIR-scripts.js | 2 +- .../Hercules-DJ-Control-Instinct-scripts.js | 44 +- .../Hercules-DJ-Control-MP3-hid-scripts.js | 58 +- res/controllers/Hercules-DJ-Control-MP3-scripts.js | 38 +- res/controllers/Hercules-P32-scripts.js | 4 +- res/controllers/Hercules-mp3e2-compat.js | 2 +- res/controllers/Ion-Discover-DJ-scripts.js | 14 +- res/controllers/KANE_QuNeo_scripts.js | 122 +- res/controllers/Kontrol-Dj-KDJ500-scripts.js | 8 +- res/controllers/Korg-KAOSS-DJ-scripts.js | 14 +- res/controllers/Korg-nanoKONTROL-2-scripts.js | 154 +- res/controllers/Korg-nanoPAD2-scripts.js | 18 +- res/controllers/Midi_for_light-scripts.js | 36 +- .../MixVibes-U-Mix-Control-Pro-2-scripts.js | 2 +- res/controllers/Mixman DM2 (Linux).js | 2 +- res/controllers/Nintendo-Wiimote.js | 56 +- res/controllers/Novation-Dicer-scripts.js | 62 +- res/controllers/Novation-Launchpad-Mini-scripts.js | 10 +- res/controllers/Numark-DJ2Go-scripts.js | 1382 ++--- res/controllers/Numark-Mixtrack-3-scripts.js | 68 +- res/controllers/Numark-NS7-scripts.js | 10 +- res/controllers/Numark-Omni-Control-scripts.js | 46 +- res/controllers/Numark-Total-Control-scripts.js | 46 +- res/controllers/Numark-V7-scripts.js | 30 +- res/controllers/Pioneer-CDJ-2000-scripts.js | 2 +- res/controllers/Pioneer-CDJ-350-scripts.js | 14 +- res/controllers/Pioneer-CDJ-850-scripts.js | 8 +- res/controllers/Reloop-Beatpad-scripts.js | 5496 ++++++++++---------- .../Reloop-Digital-Jockey2-Controller-scripts.js | 1870 +++---- res/controllers/Sony-SixxAxis.js | 14 +- res/controllers/Stanton-SCS1d-scripts.js | 248 +- res/controllers/Stanton-SCS1m-scripts.js | 68 +- res/controllers/Stanton-SCS3d-scripts.js | 206 +- res/controllers/Vestax-Typhoon-scripts.js | 66 +- res/controllers/Vestax-VCI-100-3DEX-scripts.js | 30 +- res/controllers/Vestax-VCI-100-hile.js | 44 +- res/controllers/Vestax-VCI-100-scripts.js | 10 +- res/controllers/Wireless-DJ-scripts.js | 66 +- res/controllers/common-hid-devices.js | 2 +- 63 files changed, 8011 insertions(+), 8011 deletions(-) diff --git a/res/controllers/Akai-LPD8-RK-scripts.js b/res/controllers/Akai-LPD8-RK-scripts.js index 35950bb273..f93d4b010a 100644 --- a/res/controllers/Akai-LPD8-RK-scripts.js +++ b/res/controllers/Akai-LPD8-RK-scripts.js @@ -251,7 +251,7 @@ LPD8RK.init = function (id, debug) { // called when the device is opened & set u engine.softTakeover("[Sampler1]","rate",true); engine.softTakeover("[Sampler2]","volume",true); engine.softTakeover("[Sampler2]","rate",true); - + //set LED timer LPD8RK.ledTimer = engine.beginTimer(LPD8RK.LEDinterval, "LPD8RK.setLeds()"); }; @@ -282,11 +282,11 @@ LPD8RK.setLeds = function () { var state = engine.getValue(LPD8RK.hotcues[id][LPD8RK.hotcueBank][0], "hotcue_"+LPD8RK.hotcues[id][LPD8RK.hotcueBank][1]+"_enabled"); //if (LPD8RK.debug){print("midi.sendShortMsg("+status+", "+ctrl+", "+state+")")}; - + LPD8RK.lightLED(status, ctrl, state); }; }; - + //loops for (var id in LPD8RK.loops){ //iterate through hotcues, set hotcue leds @@ -295,15 +295,15 @@ LPD8RK.setLeds = function () { var state = engine.getValue(LPD8RK.loops[id][0], "beatloop_"+LPD8RK.loops[id][1]+"_enabled"); //if (LPD8RK.debug){print("midi.sendShortMsg("+status+", "+ctrl+", "+state+")")}; - + LPD8RK.lightLED(status, ctrl, state); }; - + //reloop buttons - LPD8RK.lightLED(0xb0, 0x01, engine.getValue("[Channel1]", "loop_enabled")); - LPD8RK.lightLED(0xb1, 0x01, engine.getValue("[Channel2]", "loop_enabled")); - LPD8RK.lightLED(0xb2, 0x01, engine.getValue("[Sampler1]", "loop_enabled")); - LPD8RK.lightLED(0xb3, 0x01, engine.getValue("[Sampler2]", "loop_enabled")); + LPD8RK.lightLED(0xb0, 0x01, engine.getValue("[Channel1]", "loop_enabled")); + LPD8RK.lightLED(0xb1, 0x01, engine.getValue("[Channel2]", "loop_enabled")); + LPD8RK.lightLED(0xb2, 0x01, engine.getValue("[Sampler1]", "loop_enabled")); + LPD8RK.lightLED(0xb3, 0x01, engine.getValue("[Sampler2]", "loop_enabled")); }; LPD8RK.lightLED = function (status, ctrl, state){ @@ -316,8 +316,8 @@ LPD8RK.lightLED = function (status, ctrl, state){ if (state > 0 || state === true){state=1;}//make sure state is valid midi.sendShortMsg(status, ctrl, state); } - }; - + }; + LPD8RK.clear = function (){//enables hotcue clearing if (LPD8RK.debug){print("###hotcueclear##############")}; LPD8RK.hotcueClear=true; @@ -371,7 +371,7 @@ LPD8RK.loopButton = function (channel, control, value, status, group) { LPD8RK.reloopButton = function (channel, control, value, status, group) { if (LPD8RK.debug){print(LPD8RK.looplen+"len");} if (LPD8RK.debug){print(LPD8RK.looptype+"type");} - + if (value>0){//button was pressed engine.stopTimer(LPD8RK.reloopTimer); LPD8RK.loopbuttonDown=true; @@ -405,7 +405,7 @@ LPD8RK.resetOldBank = function () { LPD8RK.hotcueBankDial = function (channel, control, value, status, group) { //sets which hotcue bank to display (separate this out on dedicated controller) - + //pause LED resets, so bank indicator lights will be visible engine.stopTimer(LPD8RK.ledTimer); @@ -437,31 +437,31 @@ 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) { //activates variable length loop depending on dial position LPD8RK.looplen=value; - if (LPD8RK.loopbuttonDown !== true){return false;}//exit if no loop button down - else if (LPD8RK.looplen<=0x12){engine.setValue(group, LPD8RK.looptype+"_0.0625_activate", .0625);return true;} else - if (LPD8RK.looplen<=0x25){engine.setValue(group, LPD8RK.looptype+"_0.125_activate", .125);return true;} else - if (LPD8RK.looplen<=0x37){engine.setValue(group, LPD8RK.looptype+"_0.25_activate", .25);return true;} else - if (LPD8RK.looplen<=0x49){engine.setValue(group, LPD8RK.looptype+"_0.5_activate", .5);return true;} else - if (LPD8RK.looplen<=0x5b){engine.setValue(group, LPD8RK.looptype+"_1_activate", 1);return true;} else - if (LPD8RK.looplen<=0x6d){engine.setValue(group, LPD8RK.looptype+"_2_activate", 2);return true;} else - if (LPD8RK.looplen<=0x70){engine.setValue(group, LPD8RK.looptype+"_4_activate", 4);return true;} else - if (LPD8RK.looplen<=0x7f){engine.setValue(group, LPD8RK.looptype+"_8_activate", 8);return true;}; + if (LPD8RK.loopbuttonDown !== true){return false;}//exit if no loop button down + else if (LPD8RK.looplen<=0x12){engine.setValue(group, LPD8RK.looptype+"_0.0625_activate", .0625);return true;} else + if (LPD8RK.looplen<=0x25){engine.setValue(group, LPD8RK.looptype+"_0.125_activate", .125);return true;} else + if (LPD8RK.looplen<=0x37){engine.setValue(group, LPD8RK.looptype+"_0.25_activate", .25);return true;} else + if (LPD8RK.looplen<=0x49){engine.setValue(group, LPD8RK.looptype+"_0.5_activate", .5);return true;} else + if (LPD8RK.looplen<=0x5b){engine.setValue(group, LPD8RK.looptype+"_1_activate", 1);return true;} else + if (LPD8RK.looplen<=0x6d){engine.setValue(group, LPD8RK.looptype+"_2_activate", 2);return true;} else + if (LPD8RK.looplen<=0x70){engine.setValue(group, LPD8RK.looptype+"_4_activate", 4);return true;} else + if (LPD8RK.looplen<=0x7f){engine.setValue(group, LPD8RK.looptype+"_8_activate", 8);return true;}; }; LPD8RK.loopminus = function (channel, control, value, status, group) { //shrinks loop or moves loop back - if (LPD8RK.loopbuttonDown !== true){engine.setValue(group, "loop_halve", 1);engine.setValue(group, "loop_halve", 0); return false;}//shrink loop if no loop button down + if (LPD8RK.loopbuttonDown !== true){engine.setValue(group, "loop_halve", 1);engine.setValue(group, "loop_halve", 0); return false;}//shrink loop if no loop button down else if (engine.getValue(group, "loop_start_position")>=0 && engine.getValue(group, "loop_end_position")>=0 ){ //move loop var interval = LPD8RK.loopmove*engine.getValue(group, "track_samples")/engine.getValue(group, "duration"); @@ -475,7 +475,7 @@ LPD8RK.loopminus = function (channel, control, value, status, group) { LPD8RK.loopplus = function (channel, control, value, status, group) { //grows loop or moves loop forward - if (LPD8RK.loopbuttonDown !== true){engine.setValue(group, "loop_double", 1); engine.setValue(group, "loop_double", 0); return false;}//shrink loop if no loop button down + if (LPD8RK.loopbuttonDown !== true){engine.setValue(group, "loop_double", 1); engine.setValue(group, "loop_double", 0); return false;}//shrink loop if no loop button down else if (engine.getValue(group, "loop_start_position")>=0 && engine.getValue(group, "loop_end_position")>=0 ){ //move loop var interval = LPD8RK.loopmove*engine.getValue(group, "track_samples")/engine.getValue(group, "duration"); @@ -494,26 +494,26 @@ LPD8RK.beatjump = function (channel, control, value, status, group) { var backseconds = numbeats*(1/(engine.getValue(group, "bpm")/60)); var backsamples = backseconds*engine.getValue(group, "track_samples")/engine.getValue(group, "duration"); var newpos = curpos-(backsamples+engine.getValue("Master", "latency")); - + if (LPD8RK.debug){print("backseconds: "+backseconds);} if (LPD8RK.debug){print("backsamples: "+backsamples);} if (LPD8RK.debug){print("curpos: "+curpos);} if (LPD8RK.debug){print("newpos: "+newpos);} if (LPD8RK.debug){print("numbeats: "+numbeats);} - + engine.setValue(group, "playposition", newpos/engine.getValue(group, "track_samples")); }; LPD8RK.beatjumpDial = function (channel, control, value, status, group) { //activates variable length loop depending on dial position if(value>=0 && value <=127){ - if (value<=1){LPD8RK.beatjumpstep=.25; return true;} else - if (value<=31){LPD8RK.beatjumpstep=.5; return true;} else - if (value<=63){LPD8RK.beatjumpstep=1; return true;} else - if (value<=94){LPD8RK.beatjumpstep=2; return true;} else - if (value<=125){LPD8RK.beatjumpstep=4; return true;} else + if (value<=1){LPD8RK.beatjumpstep=.25; return true;} else + if (value<=31){LPD8RK.beatjumpstep=.5; return true;} else + if (value<=63){LPD8RK.beatjumpstep=1; return true;} else + if (value<=94){LPD8RK.beatjumpstep=2; return true;} else + if (value<=125){LPD8RK.beatjumpstep=4; return true;} else if (value<=127){LPD8RK.beatjumpstep=8; return true;}; - }; + }; }; LPD8RK.mute = function (group) { @@ -528,19 +528,19 @@ LPD8RK.mute = function (group) { LPD8RK.vol[group]=curvol; }; engine.softTakeover(group,"volume",true); - + if (LPD8RK.debug){print("MUTE");} }; LPD8RK.progChng = function (channel, control, value, status, group) { if (LPD8RK.debug){print("###PROG CHANGE###");} //workaround because prog chng buttons don't seem to like to work unless they're linked to scripts - if (control==0x07){LPD8RK.toggleplay(group, engine.getValue(group, "play")); return true;} else - if (control==0x03){engine.setValue(group, "cue_default", true); engine.setValue(group, "cue_default", false); return true;} else - if (control==0x06){engine.setValue(group, "beatsync", true); engine.setValue(group, "beatsync", false); return true;} else - if (control==0x02){LPD8RK.togglepfl(group, engine.getValue(group, "pfl")); return true;} else - if (control==0x05){LPD8RK.togglereverse(group, engine.getValue(group, "reverse")); return true;} else - if (control==0x04){LPD8RK.toggleback(group, engine.getValue(group, "back")); return true;} else + if (control==0x07){LPD8RK.toggleplay(group, engine.getValue(group, "play")); return true;} else + if (control==0x03){engine.setValue(group, "cue_default", true); engine.setValue(group, "cue_default", false); return true;} else + if (control==0x06){engine.setValue(group, "beatsync", true); engine.setValue(group, "beatsync", false); return true;} else + if (control==0x02){LPD8RK.togglepfl(group, engine.getValue(group, "pfl")); return true;} else + if (control==0x05){LPD8RK.togglereverse(group, engine.getValue(group, "reverse")); return true;} else + if (control==0x04){LPD8RK.toggleback(group, engine.getValue(group, "back")); return true;} else if (control==0x00){LPD8RK.togglefwd(group, engine.getValue(group, "fwd")); return true;} if (control==0x01){LPD8RK.mute(group); return true;} }; @@ -554,15 +554,15 @@ LPD8RK.togglepfl = function (group, state) { }; LPD8RK.togglereverse = function (group, state) { - if (state==true){engine.setValue(group, "reverse", false);} else {engine.setValue(group, "reverse", true);}; + if (state==true){engine.setValue(group, "reverse", false);} else {engine.setValue(group, "reverse", true);}; }; LPD8RK.toggleback = function (group, state) { - if (state==true){engine.setValue(group, "back", false);} else {engine.setValue(group, "back", true);}; + if (state==true){engine.setValue(group, "back", false);} else {engine.setValue(group, "back", true);}; }; LPD8RK.togglefwd = function (group, state) { - if (state==true){engine.setValue(group, "fwd", false);} else {engine.setValue(group, "fwd", true);}; + if (state==true){engine.setValue(group, "fwd", false);} else {engine.setValue(group, "fwd", true);}; }; LPD8RK.softXfade = function (channel, control, value, status, group) { diff --git a/res/controllers/American-Audio-RADIUS-2000-scripts.js b/res/controllers/American-Audio-RADIUS-2000-scripts.js index 4314b301da..9faf58f705 100644 --- a/res/controllers/American-Audio-RADIUS-2000-scripts.js +++ b/res/controllers/American-Audio-RADIUS-2000-scripts.js @@ -22,7 +22,7 @@ RADIUS2000.currentDeck2 = function (group) { return "[Channel1]"; else if (group == "[Channel2]") return "[Channel2]"; - + print("Invalid group : " + group); return -1; // error } @@ -124,7 +124,7 @@ RADIUS2000.cue = function (channel, control, value, status, group) { } RADIUS2000.keylock = function (channel, control, value, status, group) { - var keylockStat = engine.getValue(RADIUS2000.currentDeck2(group),"keylock"); + var keylockStat = engine.getValue(RADIUS2000.currentDeck2(group),"keylock"); if (value == 0x7F & keylockStat == 1) { engine.setValue(RADIUS2000.currentDeck2(group),"keylock",0); midi.sendShortMsg(0x90,0x06,0x00); diff --git a/res/controllers/American-Audio-VMS4-scripts.js b/res/controllers/American-Audio-VMS4-scripts.js index 3e9cb49f7a..07dbdb209d 100644 --- a/res/controllers/American-Audio-VMS4-scripts.js +++ b/res/controllers/American-Audio-VMS4-scripts.js @@ -7,12 +7,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -92,7 +92,7 @@ VMS4.init = function (id) { // called when the MIDI device is opened & set up engine.softTakeover("[EffectRack1_EffectUnit4]","super1",true); engine.softTakeover("[EffectRack1_EffectUnit4]","mix",true); engine.softTakeover("[EffectRack1_EffectUnit4]","super1",true); - + print("American Audio "+VMS4.id+" initialized."); } @@ -229,7 +229,7 @@ VMS4.Deck.prototype.keyLockButtonHandler = function(value) { VMS4.Deck.prototype.effectParamButtonHandler = function(value) { // Couldn't get this to work. The buttons are mapped instead to VMS4.effectParameterButton - + // if(value == ButtonState.pressed) { // this.controlEffectParameter=!this.controlEffectParameter; // if (this.controlEffectParameter) { @@ -306,19 +306,19 @@ VMS4.pitchCenter = function(channel, control, value, status, group) { VMS4.effectSelect = function(channel, control, value, status, group) { var deck = VMS4.GetDeck(group); - + if (deck.effectSelect == -1 || isNaN(deck.effectSelect)) deck.effectSelect = value; - + // Take wrap around into account var wrapCount = 0; if (value>=0 && value<10 && deck.effectSelect>117 && deck.effectSelect<=127) wrapCount+=1; if (value>117 && value<=127 && deck.effectSelect>=0 && deck.effectSelect<10) wrapCount-=1; - + var diff = value - deck.effectSelect; deck.effectSelect=value; - + diff += wrapCount*128; - + engine.setValue("[EffectRack1_EffectUnit"+VMS4.GetDeckNum(group)+"_Effect1]", "effect_selector",diff); } @@ -366,17 +366,17 @@ VMS4.effectParameterButton = function(channel, control, value, status, group) { VMS4.sampleSelect = function(channel, control, value, status, group) { var deck = VMS4.GetDeck(group); if (deck.sampleSelect == -1) deck.sampleSelect = value; - + // Take wrap around into account var wrapCount = 0; if (value>=0 && value<10 && deck.sampleSelect>117 && deck.sampleSelect<=127) wrapCount+=1; if (value>117 && value<=127 && deck.sampleSelect>=0 && deck.sampleSelect<10) wrapCount-=1; - + var diff = value - deck.sampleSelect; deck.sampleSelect=value; - + diff += wrapCount*128; - + engine.setValue("[Playlist]","SelectTrackKnob",diff); } @@ -424,10 +424,10 @@ VMS4.strip_scroll = function(channel, control, value, status, group) { // Higher on the strip gives a higher value, and up is negative on Library // scroll controls if (side === "Left") { - engine.setValue("[Playlist]", "SelectPlaylist", + engine.setValue("[Playlist]", "SelectPlaylist", VMS4.touchStripPos[side] - value); } else { - engine.setValue("[Playlist]", "SelectTrackKnob", + engine.setValue("[Playlist]", "SelectTrackKnob", VMS4.touchStripPos[side] - value); } } diff --git a/res/controllers/Behringer-BCD3000-Advanced-scripts.js b/res/controllers/Behringer-BCD3000-Advanced-scripts.js index 1b92e7d7da..8e0757bbfc 100644 --- a/res/controllers/Behringer-BCD3000-Advanced-scripts.js +++ b/res/controllers/Behringer-BCD3000-Advanced-scripts.js @@ -5,7 +5,7 @@ BehringerBCD3000.UseAcceleration = true; BehringerBCD3000.JogSensitivity = 0.5; BehringerBCD3000.init = function (id) { // called when the device is opened & set up - + BehringerBCD3000.reset(); // Ask BCD to send the current values of all rotary knobs and sliders @@ -22,7 +22,7 @@ BehringerBCD3000.shutdown = function () { BehringerBCD3000.reset(); - // Reenable jog acceleration + // Reenable jog acceleration if (!BehringerBCD3000.UseAcceleration) midi.sendShortMsg(0xB0, 0x63, 0x7F); }; @@ -51,7 +51,7 @@ BehringerBCD3000.getDeck = function (group) { return 0; else if (group == "[Channel2]") return 1; - + print("Invalid group : " + group); return -1; // error } @@ -114,7 +114,7 @@ BehringerBCD3000.scratchButton = function (channel, control, value, status, grou midi.sendShortMsg(0xB0, 0x0B, 0x7F); } else { // Turn off the scratch light - if (!deck) + if (!deck) midi.sendShortMsg(0xB0, 0x13, 0x00); else midi.sendShortMsg(0xB0, 0x0B, 0x00); @@ -129,7 +129,7 @@ BehringerBCD3000.stopScratch = function(deck) { } -//Set loop function +//Set loop function BehringerBCD3000.loop = function (channel, control, value, status, group) { if (value) action = "loop_in"; @@ -138,7 +138,7 @@ BehringerBCD3000.loop = function (channel, control, value, status, group) { engine.setValue(group, action, 1); }; -//On button function +//On button function BehringerBCD3000.On = function (channel, control, value, status, group) { if (BehringerBCD3000.actionKey){ @@ -158,7 +158,7 @@ BehringerBCD3000.On = function (channel, control, value, status, group) { }; }; -//Action button function +//Action button function BehringerBCD3000.Action = function (channel, control, value, status, group) { if (BehringerBCD3000.onKey){ BehringerBCD3000.onKey = false; @@ -179,7 +179,7 @@ BehringerBCD3000.Action = function (channel, control, value, status, group) { } }; -//Key button function +//Key button function BehringerBCD3000.keykey = function (channel, control, value, status, group) { // toggle "alt" flag if (value) BehringerBCD3000.alt = !BehringerBCD3000.alt; @@ -198,7 +198,7 @@ BehringerBCD3000.keykey = function (channel, control, value, status, group) { }; -//Ext-A button function +//Ext-A button function //BehringerBCD3000.extakey = function (channel, control, value, status, group) { // // toggle inputA flag // if (value) BehringerBCD3000.inputA = !BehringerBCD3000.inputA; @@ -211,7 +211,7 @@ BehringerBCD3000.keykey = function (channel, control, value, status, group) { // } //}; -//Ext-B button function +//Ext-B button function //BehringerBCD3000.extbkey = function (channel, control, value, status, group) { // // toggle inputB flag // if (value) BehringerBCD3000.inputB = !BehringerBCD3000.inputB; diff --git a/res/controllers/Behringer-BCD3000-scripts.js b/res/controllers/Behringer-BCD3000-scripts.js index d6098e50bf..044f566234 100644 --- a/res/controllers/Behringer-BCD3000-scripts.js +++ b/res/controllers/Behringer-BCD3000-scripts.js @@ -7,7 +7,7 @@ BehringerBCD3000.UseAcceleration = true; BehringerBCD3000.JogSensitivity = 0.5; BehringerBCD3000.init = function (id) { // called when the device is opened & set up - + BehringerBCD3000.reset(); // Ask BCD to send the current values of all rotary knobs and sliders @@ -24,7 +24,7 @@ BehringerBCD3000.shutdown = function () { BehringerBCD3000.reset(); - // Reenable jog acceleration + // Reenable jog acceleration if (!BehringerBCD3000.UseAcceleration) midi.sendShortMsg(0xB0, 0x63, 0x7F); }; @@ -43,7 +43,7 @@ BehringerBCD3000.getDeck = function (group) { return 0; else if (group == "[Channel2]") return 1; - + print("Invalid group : " + group); return -1; // error } @@ -74,7 +74,7 @@ BehringerBCD3000.jogWheel = function (channel, control, value, status, group) { } }; -//Scratch button function +//Scratch button function BehringerBCD3000.scratchButton = function (channel, control, value, status, group) { if (value != 0x7F) @@ -99,7 +99,7 @@ BehringerBCD3000.scratchButton = function (channel, control, value, status, grou } else { // Turn off the scratch light - if (!deck) + if (!deck) midi.sendShortMsg(0xB0, 0x13, 0x00); else midi.sendShortMsg(0xB0, 0x0B, 0x00); @@ -109,7 +109,7 @@ BehringerBCD3000.scratchButton = function (channel, control, value, status, grou } }; -//Set loop function +//Set loop function BehringerBCD3000.loop = function (channel, control, value, status, group) { if (value) action = "loop_in"; diff --git a/res/controllers/Behringer-CMDStudio4a-scripts.js b/res/controllers/Behringer-CMDStudio4a-scripts.js index 54046b8cf7..211bf30491 100644 --- a/res/controllers/Behringer-CMDStudio4a-scripts.js +++ b/res/controllers/Behringer-CMDStudio4a-scripts.js @@ -1,274 +1,274 @@ -// **************************************************************************** -// * Mixxx mapping script file for the Behringer CMD Studio 4a. -// * Author: Craig Easton -// * Version 1.4 (Jan 2016) -// * Forum: http://www.mixxx.org/forums/viewtopic.php?f=7&t=7868 -// * Wiki: http://www.mixxx.org/wiki/doku.php/behringer_cmd_studio_4a -// **************************************************************************** - -//////////////////////////////////////////////////////////////////////// -// JSHint configuration // -//////////////////////////////////////////////////////////////////////// -/* global engine */ -/* global script */ -/* global print */ -/* global midi */ -//////////////////////////////////////////////////////////////////////// - -// Master function definition. -function BehringerCMDStudio4a() {} - - -// ***************************** Global Vars ********************************** - -// Shift/mode state variables. -BehringerCMDStudio4a.delButtonState = [false,false,false,false]; -BehringerCMDStudio4a.scratchButtonState = [false,false,false,false]; - -// Button push/release state variables. -BehringerCMDStudio4a.pitchPushed = [[false,false,false,false], [false,false,false,false]]; -BehringerCMDStudio4a.delPushed = false; -BehringerCMDStudio4a.delShiftUsed = false; -BehringerCMDStudio4a.fxAssignPushed = false; -BehringerCMDStudio4a.fxAssignShiftUsed = false; -BehringerCMDStudio4a.fxAssignLastGroup = ""; - -// ************************ Initialisation stuff. ***************************** - -BehringerCMDStudio4a.vuMeterUpdate = function (value, group, control){ - value = (value*15)+48; - switch(control) { - case "VuMeterL": - midi.sendShortMsg(0xB0, 0x7E, value); - break; - case "VuMeterR": - midi.sendShortMsg(0xB0, 0x7F, value); - break; - } -} - -BehringerCMDStudio4a.initLEDs = function () { - // (re)Initialise any LEDs that are direcctly controlled by this script. - // DEL buttons (one for each virtual deck). - midi.sendShortMsg(0x90, 0x2A, 0x00); - midi.sendShortMsg(0x91, 0x4A, 0x00); - midi.sendShortMsg(0x92, 0x2A, 0x00); - midi.sendShortMsg(0x93, 0x4A, 0x00); - // Scratch buttons (one for each virtual deck). - midi.sendShortMsg(0x90, 0x16, 0x00); - midi.sendShortMsg(0x91, 0x36, 0x00); - midi.sendShortMsg(0x92, 0x16, 0x00); - midi.sendShortMsg(0x93, 0x36, 0x00); -} - -BehringerCMDStudio4a.init = function () { - // Initialise anything that might not be in the correct state. - BehringerCMDStudio4a.initLEDs(); - // Connect the VUMeters - engine.connectControl("[Master]","VuMeterL","BehringerCMDStudio4a.vuMeterUpdate"); - engine.connectControl("[Master]","VuMeterR","BehringerCMDStudio4a.vuMeterUpdate"); -} - -BehringerCMDStudio4a.shutdown = function() { - // Leave the deck in a properly initialised state. - BehringerCMDStudio4a.initLEDs(); - - // Disconnect the VUMeters. -// Maybe not! It seems you don't have to do this even though the connection -// in done in init(), in fact if you try it throws an error. -// engine.connectControl("[Master]","VuMeterL","BehringerCMDStudio4a.vuMeterUpdate",true); -// engine.connectControl("[Master]","VuMeterR","BehringerCMDStudio4a.vuMeterUpdate",true); -} - - -// *************************** Control Stuff. ********************************* -// The code below is primarily "shift/mode" key functionality as there is no -// native support for this in Mixxx at the moment. -// I suspect that the vast majority of controller mappings could be completed -// with little or no scripting if Mixxx supported shift/mode buttons in the -// XML (together with standard wheel/scratching functionality). - -// Function to deal with the DEL "shift/mode" buttons. -BehringerCMDStudio4a.del = function (channel, control, value, status, group) { - if (value == 127) { - // Button pushed. - BehringerCMDStudio4a.delPushed = true; - BehringerCMDStudio4a.delShiftUsed = false; - } else { - // Button released. - BehringerCMDStudio4a.delPushed = false; - // Only toggle the DEL-mode if the "shift" function wasn't used. - if (!BehringerCMDStudio4a.delShiftUsed) { - BehringerCMDStudio4a.delButtonState[channel] = !BehringerCMDStudio4a.delButtonState[channel]; - midi.sendShortMsg(0x90 + channel, control, BehringerCMDStudio4a.delButtonState[channel] ? 0x01 : 0x00); - } - } -} - -// Function to deal with the play buttons, (because they have a DEL-mode behaviour). -BehringerCMDStudio4a.play = function (channel, control, value, status, group) { - if (BehringerCMDStudio4a.delButtonState[channel]) { - // DEL-mode is active, do reverse-roll (slip). - engine.setValue(group, "reverseroll", (value == 127) ? 1 : 0); - } else { - // DEL-mode is not active, just toggle play (on push only). - if (value == 127) { - script.toggleControl(group,"play"); - } - } -} - -// Function to deal with the cue buttons, (because they have a DEL-mode behaviour). -BehringerCMDStudio4a.cue = function (channel, control, value, status, group) { - if (BehringerCMDStudio4a.delButtonState[channel]) { - // DEL-mode is active, do reverse play. - engine.setValue(group, "reverse", (value == 127) ? 1 : 0); - } else { - // DEL-mode is not active so just cue. - engine.setValue(group, "cue_default", (value == 127) ? 1 : 0); - } -} - -// Function to deal with the scratch mode buttons. -BehringerCMDStudio4a.scratch = function (channel, control, value, status, group) { - BehringerCMDStudio4a.scratchButtonState[channel] = !BehringerCMDStudio4a.scratchButtonState[channel]; - midi.sendShortMsg(status, control, BehringerCMDStudio4a.scratchButtonState[channel] ? 0x01 : 0x00); -} - -// Function to deal with the FX Assign buttons, (because they also act as "shift" buttons). -BehringerCMDStudio4a.fxAssign = function (channel, control, value, status, group) { - // FX Assign buttons start at 0x52. - var fxAssignButton = (control - 0x52) & 1; // Either 0 or 1 depending on button (1 or 2). - if (value == 127) { - // Button pushed. - BehringerCMDStudio4a.fxAssignPushed = true; - BehringerCMDStudio4a.fxAssignShiftUsed = false; - BehringerCMDStudio4a.fxAssignLastGroup = group; - } - else - { - // Button released. - BehringerCMDStudio4a.fxAssignPushed = false; - // Only toggle the effect on release if the "shift" function wasn't used. - if (!BehringerCMDStudio4a.fxAssignShiftUsed) { - script.toggleControl(group,"group_[Channel"+(channel+1)+"]_enable"); - } - } -} - -// Function to deal with the browse left/right buttons, (because they have an "FX Assign mode" behaviour). -BehringerCMDStudio4a.browseLR = function (channel, control, value, status, group) { - if (BehringerCMDStudio4a.fxAssignPushed) { - BehringerCMDStudio4a.fxAssignShiftUsed = true; - if (control == 0x2) { - // Left. - engine.setValue(BehringerCMDStudio4a.fxAssignLastGroup,"prev_chain", 1); - } else { - // Right. - engine.setValue(BehringerCMDStudio4a.fxAssignLastGroup,"next_chain", 1); - } - } else { - if (control == 0x2) { - // Left. - engine.setValue(group, "SelectPrevPlaylist",1) - } else { - // Right. - engine.setValue(group, "SelectNextPlaylist",1) - } - } -} - -// Functions to deal with the hot-cue buttons, (because they have a DEL-mode behaviour). -BehringerCMDStudio4a.hotcue = function (channel, control, value, status, group) { - // Translate the button to the actual hotcue. - var hotcue = control-0x21; // Hotcue buttons on left deck go from 0x22 to 0x29 - if (hotcue>8) { - // Right deck, buttons are 0x20 higher so we need to compensate. - hotcue = hotcue-0x20; - } - if (BehringerCMDStudio4a.delPushed) { - // DEL button is being held so delete the hotcue. - engine.setValue(group, "hotcue_"+hotcue+"_clear", 1); - BehringerCMDStudio4a.delShiftUsed = true; - } else { - // DEL button is not being held down. - if (BehringerCMDStudio4a.delButtonState[channel]) { - // DEL-mode is active, lets do auto-loops. - engine.setValue(group, "beatloop_"+(1/8)*Math.pow(2,hotcue-1)+"_toggle", 1); - if (value == 0) { - // Button is being released. Disable then re-enable slip if it - // is active. This "re-syncs" the playback after every - // auto-loop in slip-mode which is a nice effect and probably - // what you want most of the time if slip is on. - if (engine.getValue(group, "slip_enabled") == 1) { - engine.setValue(group, "slip_enabled", 0); - // It seems we can't just flip a param off and on in the - // same call! Since we've just turned slip off, I can't now - // turn it on directly here, the only work-around I could - // think of was to create a (very short) timed call-back - // to turn it off! - // Raised bug about this: - // https://bugs.launchpad.net/mixxx/+bug/1538200 - // Changed timer from 50 to 100 after the pathology of this - // bug was explined in the bug report. - engine.beginTimer(100, function() { engine.setValue(group, "slip_enabled", 1); }, 1); - } - } - } else { - // DEL-mode is not active so do the set/jump-to hotcue function as normal. - engine.setValue(group, "hotcue_"+hotcue+"_activate", (value == 127) ? 1 : 0); - } - } -} - -// Functions to deal with the pitch inc/dec buttons, (because they have a DEL-mode behaviour). -BehringerCMDStudio4a.pitch = function (channel, control, value, status, group) { - // Work out the direction. - var direction = ((control & 0x01) == 0) ? "down" : "up"; - // Work out the type (and join) by looking at the DEL button state. - var type = BehringerCMDStudio4a.delButtonState[channel] ? "pitch" : "rate"; - var join = BehringerCMDStudio4a.delButtonState[channel] ? "" : "_perm"; - // Pushed or released? - if (value == 127) { - // Button pushed. - BehringerCMDStudio4a.pitchPushed[control & 0x01][channel] = true; - // Is the other button pushed too? - if (BehringerCMDStudio4a.pitchPushed[(~control) & 0x01][channel]) { - engine.setValue(group, type, 0); // Yep! reset the control. - } else { - engine.setValue(group, type+join+"_"+direction, 1); - } - } else { - // Button released. - BehringerCMDStudio4a.pitchPushed[control & 0x01][channel] = false; - engine.setValue(group, "rate_perm_"+direction, 0); // Keeps the UI in sync with the button state. - } -} - -// Functions to deal with the wheel (i.e. scratcing and jog). -// Why is there no (XML) support in Mixxx for this most basic of functions? -// I suspect the vast majority of controller mappings use the same code -// (provided in the Wiki). -BehringerCMDStudio4a.wheelTouch = function (channel, control, value, status, group) { - channel = channel+1; - if (value > 0) { - // We're touching the wheel. - var alpha = 1.0/8; - var beta = alpha/32; - engine.scratchEnable(channel, 600, 33+1/3, alpha, beta); - } else { - // We've released the wheel. - engine.scratchDisable(channel); - } -}; -BehringerCMDStudio4a.wheelTurn = function (channel, control, value, status, group) { - var deck = channel+1; - var newValue = value-64; - if (BehringerCMDStudio4a.scratchButtonState[channel]){ - if (engine.isScratching(deck)){ - engine.scratchTick(deck,newValue); // Scratch! - } - } else { - engine.setValue(group, "jog", newValue); // Jog. - } -}; +// **************************************************************************** +// * Mixxx mapping script file for the Behringer CMD Studio 4a. +// * Author: Craig Easton +// * Version 1.4 (Jan 2016) +// * Forum: http://www.mixxx.org/forums/viewtopic.php?f=7&t=7868 +// * Wiki: http://www.mixxx.org/wiki/doku.php/behringer_cmd_studio_4a +// **************************************************************************** + +//////////////////////////////////////////////////////////////////////// +// JSHint configuration // +//////////////////////////////////////////////////////////////////////// +/* global engine */ +/* global script */ +/* global print */ +/* global midi */ +//////////////////////////////////////////////////////////////////////// + +// Master function definition. +function BehringerCMDStudio4a() {} + + +// ***************************** Global Vars ********************************** + +// Shift/mode state variables. +BehringerCMDStudio4a.delButtonState = [false,false,false,false]; +BehringerCMDStudio4a.scratchButtonState = [false,false,false,false]; + +// Button push/release state variables. +BehringerCMDStudio4a.pitchPushed = [[false,false,false,false], [false,false,false,false]]; +BehringerCMDStudio4a.delPushed = false; +BehringerCMDStudio4a.delShiftUsed = false; +BehringerCMDStudio4a.fxAssignPushed = false; +BehringerCMDStudio4a.fxAssignShiftUsed = false; +BehringerCMDStudio4a.fxAssignLastGroup = ""; + +// ************************ Initialisation stuff. ***************************** + +BehringerCMDStudio4a.vuMeterUpdate = function (value, group, control){ + value = (value*15)+48; + switch(control) { + case "VuMeterL": + midi.sendShortMsg(0xB0, 0x7E, value); + break; + case "VuMeterR": + midi.sendShortMsg(0xB0, 0x7F, value); + break; + } +} + +BehringerCMDStudio4a.initLEDs = function () { + // (re)Initialise any LEDs that are direcctly controlled by this script. + // DEL buttons (one for each virtual deck). + midi.sendShortMsg(0x90, 0x2A, 0x00); + midi.sendShortMsg(0x91, 0x4A, 0x00); + midi.sendShortMsg(0x92, 0x2A, 0x00); + midi.sendShortMsg(0x93, 0x4A, 0x00); + // Scratch buttons (one for each virtual deck). + midi.sendShortMsg(0x90, 0x16, 0x00); + midi.sendShortMsg(0x91, 0x36, 0x00); + midi.sendShortMsg(0x92, 0x16, 0x00); + midi.sendShortMsg(0x93, 0x36, 0x00); +} + +BehringerCMDStudio4a.init = function () { + // Initialise anything that might not be in the correct state. + BehringerCMDStudio4a.initLEDs(); + // Connect the VUMeters + engine.connectControl("[Master]","VuMeterL","BehringerCMDStudio4a.vuMeterUpdate"); + engine.connectControl("[Master]","VuMeterR","BehringerCMDStudio4a.vuMeterUpdate"); +} + +BehringerCMDStudio4a.shutdown = function() { + // Leave the deck in a properly initialised state. + BehringerCMDStudio4a.initLEDs(); + + // Disconnect the VUMeters. +// Maybe not! It seems you don't have to do this even though the connection +// in done in init(), in fact if you try it throws an error. +// engine.connectControl("[Master]","VuMeterL","BehringerCMDStudio4a.vuMeterUpdate",true); +// engine.connectControl("[Master]","VuMeterR","BehringerCMDStudio4a.vuMeterUpdate",true); +} + + +// *************************** Control Stuff. ********************************* +// The code below is primarily "shift/mode" key functionality as there is no +// native support for this in Mixxx at the moment. +// I suspect that the vast majority of controller mappings could be completed +// with little or no scripting if Mixxx supported shift/mode buttons in the +// XML (together with standard wheel/scratching functionality). + +// Function to deal with the DEL "shift/mode" buttons. +BehringerCMDStudio4a.del = function (channel, control, value, status, group) { + if (value == 127) { + // Button pushed. + BehringerCMDStudio4a.delPushed = true; + BehringerCMDStudio4a.delShiftUsed = false; + } else { + // Button released. + BehringerCMDStudio4a.delPushed = false; + // Only toggle the DEL-mode if the "shift" function wasn't used. + if (!BehringerCMDStudio4a.delShiftUsed) { + BehringerCMDStudio4a.delButtonState[channel] = !BehringerCMDStudio4a.delButtonState[channel]; + midi.sendShortMsg(0x90 + channel, control, BehringerCMDStudio4a.delButtonState[channel] ? 0x01 : 0x00); + } + } +} + +// Function to deal with the play buttons, (because they have a DEL-mode behaviour). +BehringerCMDStudio4a.play = function (channel, control, value, status, group) { + if (BehringerCMDStudio4a.delButtonState[channel]) { + // DEL-mode is active, do reverse-roll (slip). + engine.setValue(group, "reverseroll", (value == 127) ? 1 : 0); + } else { + // DEL-mode is not active, just toggle play (on push only). + if (value == 127) { + script.toggleControl(group,"play"); + } + } +} + +// Function to deal with the cue buttons, (because they have a DEL-mode behaviour). +BehringerCMDStudio4a.cue = function (channel, control, value, status, group) { + if (BehringerCMDStudio4a.delButtonState[channel]) { + // DEL-mode is active, do reverse play. + engine.setValue(group, "reverse", (value == 127) ? 1 : 0); + } else { + // DEL-mode is not active so just cue. + engine.setValue(group, "cue_default", (value == 127) ? 1 : 0); + } +} + +// Function to deal with the scratch mode buttons. +BehringerCMDStudio4a.scratch = function (channel, control, value, status, group) { + BehringerCMDStudio4a.scratchButtonState[channel] = !BehringerCMDStudio4a.scratchButtonState[channel]; + midi.sendShortMsg(status, control, BehringerCMDStudio4a.scratchButtonState[channel] ? 0x01 : 0x00); +} + +// Function to deal with the FX Assign buttons, (because they also act as "shift" buttons). +BehringerCMDStudio4a.fxAssign = function (channel, control, value, status, group) { + // FX Assign buttons start at 0x52. + var fxAssignButton = (control - 0x52) & 1; // Either 0 or 1 depending on button (1 or 2). + if (value == 127) { + // Button pushed. + BehringerCMDStudio4a.fxAssignPushed = true; + BehringerCMDStudio4a.fxAssignShiftUsed = false; + BehringerCMDStudio4a.fxAssignLastGroup = group; + } + else + { + // Button released. + BehringerCMDStudio4a.fxAssignPushed = false; + // Only toggle the effect on release if the "shift" function wasn't used. + if (!BehringerCMDStudio4a.fxAssignShiftUsed) { + script.toggleControl(group,"group_[Channel"+(channel+1)+"]_enable"); + } + } +} + +// Function to deal with the browse left/right buttons, (because they have an "FX Assign mode" behaviour). +BehringerCMDStudio4a.browseLR = function (channel, control, value, status, group) { + if (BehringerCMDStudio4a.fxAssignPushed) { + BehringerCMDStudio4a.fxAssignShiftUsed = true; + if (control == 0x2) { + // Left. + engine.setValue(BehringerCMDStudio4a.fxAssignLastGroup,"prev_chain", 1); + } else { + // Right. + engine.setValue(BehringerCMDStudio4a.fxAssignLastGroup,"next_chain", 1); + } + } else { + if (control == 0x2) { + // Left. + engine.setValue(group, "SelectPrevPlaylist",1) + } else { + // Right. + engine.setValue(group, "SelectNextPlaylist",1) + } + } +} + +// Functions to deal with the hot-cue buttons, (because they have a DEL-mode behaviour). +BehringerCMDStudio4a.hotcue = function (channel, control, value, status, group) { + // Translate the button to the actual hotcue. + var hotcue = control-0x21; // Hotcue buttons on left deck go from 0x22 to 0x29 + if (hotcue>8) { + // Right deck, buttons are 0x20 higher so we need to compensate. + hotcue = hotcue-0x20; + } + if (BehringerCMDStudio4a.delPushed) { + // DEL button is being held so delete the hotcue. + engine.setValue(group, "hotcue_"+hotcue+"_clear", 1); + BehringerCMDStudio4a.delShiftUsed = true; + } else { + // DEL button is not being held down. + if (BehringerCMDStudio4a.delButtonState[channel]) { + // DEL-mode is active, lets do auto-loops. + engine.setValue(group, "beatloop_"+(1/8)*Math.pow(2,hotcue-1)+"_toggle", 1); + if (value == 0) { + // Button is being released. Disable then re-enable slip if it + // is active. This "re-syncs" the playback after every + // auto-loop in slip-mode which is a nice effect and probably + // what you want most of the time if slip is on. + if (engine.getValue(group, "slip_enabled") == 1) { + engine.setValue(group, "slip_enabled", 0); + // It seems we can't just flip a param off and on in the + // same call! Since we've just turned slip off, I can't now + // turn it on directly here, the only work-around I could + // think of was to create a (very short) timed call-back + // to turn it off! + // Raised bug about this: + // https://bugs.launchpad.net/mixxx/+bug/1538200 + // Changed timer from 50 to 100 after the pathology of this + // bug was explined in the bug report. + engine.beginTimer(100, function() { engine.setValue(group, "slip_enabled", 1); }, 1); + } + } + } else { + // DEL-mode is not active so do the set/jump-to hotcue function as normal. + engine.setValue(group, "hotcue_"+hotcue+"_activate", (value == 127) ? 1 : 0); + } + } +} + +// Functions to deal with the pitch inc/dec buttons, (because they have a DEL-mode behaviour). +BehringerCMDStudio4a.pitch = function (channel, control, value, status, group) { + // Work out the direction. + var direction = ((control & 0x01) == 0) ? "down" : "up"; + // Work out the type (and join) by looking at the DEL button state. + var type = BehringerCMDStudio4a.delButtonState[channel] ? "pitch" : "rate"; + var join = BehringerCMDStudio4a.delButtonState[channel] ? "" : "_perm"; + // Pushed or released? + if (value == 127) { + // Button pushed. + BehringerCMDStudio4a.pitchPushed[control & 0x01][channel] = true; + // Is the other button pushed too? + if (BehringerCMDStudio4a.pitchPushed[(~control) & 0x01][channel]) { + engine.setValue(group, type, 0); // Yep! reset the control. + } else { + engine.setValue(group, type+join+"_"+direction, 1); + } + } else { + // Button released. + BehringerCMDStudio4a.pitchPushed[control & 0x01][channel] = false; + engine.setValue(group, "rate_perm_"+direction, 0); // Keeps the UI in sync with the button state. + } +} + +// Functions to deal with the wheel (i.e. scratcing and jog). +// Why is there no (XML) support in Mixxx for this most basic of functions? +// I suspect the vast majority of controller mappings use the same code +// (provided in the Wiki). +BehringerCMDStudio4a.wheelTouch = function (channel, control, value, status, group) { + channel = channel+1; + if (value > 0) { + // We're touching the wheel. + var alpha = 1.0/8; + var beta = alpha/32; + engine.scratchEnable(channel, 600, 33+1/3, alpha, beta); + } else { + // We've released the wheel. + engine.scratchDisable(channel); + } +}; +BehringerCMDStudio4a.wheelTurn = function (channel, control, value, status, group) { + var deck = channel+1; + var newValue = value-64; + if (BehringerCMDStudio4a.scratchButtonState[channel]){ + if (engine.isScratching(deck)){ + engine.scratchTick(deck,newValue); // Scratch! + } + } else { + engine.setValue(group, "jog", newValue); // Jog. + } +}; diff --git a/res/controllers/DJ-Tech-CDJ-101-scripts.js b/res/controllers/DJ-Tech-CDJ-101-scripts.js index 386308110a..fcaff8a7ab 100644 --- a/res/controllers/DJ-Tech-CDJ-101-scripts.js +++ b/res/controllers/DJ-Tech-CDJ-101-scripts.js @@ -29,7 +29,7 @@ // * cue button: default cue behaviour // * play: toggle play // * shift + play: sync -// +// DJTechCDJ101 = {}; DJTechCDJ101.pushmaxtime = 200; @@ -51,7 +51,7 @@ DJTechCDJ101.shutdown = function() {} // utility function // -DJTechCDJ101.mtime = function() +DJTechCDJ101.mtime = function() { var t = new Date(); return t.getTime(); @@ -85,7 +85,7 @@ DJTechCDJ101.cue_feedback_deck2 = function(value) // translate 14bit pitchbend message into pitch control // -DJTechCDJ101.pitch = function(channel, lsb, msb, status, group) +DJTechCDJ101.pitch = function(channel, lsb, msb, status, group) { engine.setValue(group, "rate", script.pitch(lsb, msb, status)); // not working for some reason //engine.setValue(group, "rate", (8192 - (msb << 7 | lsb)) / 8192); @@ -103,7 +103,7 @@ DJTechCDJ101.beatjump = function(group, jump) // click to load track // -DJTechCDJ101.browse = function(channel, control, value, status, group) +DJTechCDJ101.browse = function(channel, control, value, status, group) { if (DJTechCDJ101.pushed) { engine.setValue("[Playlist]", value == 0x41 ? "SelectNextPlaylist" : "SelectPrevPlaylist", 1); @@ -113,7 +113,7 @@ DJTechCDJ101.browse = function(channel, control, value, status, group) } } -DJTechCDJ101.push = function(channel, control, value, status, group) +DJTechCDJ101.push = function(channel, control, value, status, group) { if (value > 0) { DJTechCDJ101.pushed = true; @@ -149,7 +149,7 @@ DJTechCDJ101.cue = function(channel, control, value, status, group) } // -// when the push button is held, pressing play will sync +// when the push button is held, pressing play will sync // DJTechCDJ101.play = function(channel, control, value, status, group) @@ -170,7 +170,7 @@ DJTechCDJ101.play = function(channel, control, value, status, group) // when deck is playing either enable or disable scratch mode, no action otherwise // -DJTechCDJ101.jogtouch = function(channel, control, value, status, group) +DJTechCDJ101.jogtouch = function(channel, control, value, status, group) { var deck = parseInt(group.substring(8,9)); @@ -180,7 +180,7 @@ DJTechCDJ101.jogtouch = function(channel, control, value, status, group) else { // // don't disable right away in case of spin backs if playing and also morph - // outer jog movements into top jog movements during this time + // outer jog movements into top jog movements during this time // if (!engine.getValue(group, "play")) { @@ -206,7 +206,7 @@ DJTechCDJ101.finishScratch = function(deck, stop_timer) // use outer part of jog to pitchbend when in play mode and fine track seek when not // -DJTechCDJ101.jogouter = function(channel, control, value, status, group) +DJTechCDJ101.jogouter = function(channel, control, value, status, group) { // // when touch surface has been release for a short time convert @@ -232,7 +232,7 @@ DJTechCDJ101.jogouter = function(channel, control, value, status, group) // track not playing: seek thru track (using same scratch ticks and gives more positive response) or seek faster through track when push button held down // -DJTechCDJ101.jogtop = function(channel, control, value, status, group) +DJTechCDJ101.jogtop = function(channel, control, value, status, group) { value -= 0x40; if (!engine.getValue(group, "play") && DJTechCDJ101.pushed) { diff --git a/res/controllers/DJ-Tech-Kontrol-One-scripts.js b/res/controllers/DJ-Tech-Kontrol-One-scripts.js index 99b24007b7..90332adafe 100644 --- a/res/controllers/DJ-Tech-Kontrol-One-scripts.js +++ b/res/controllers/DJ-Tech-Kontrol-One-scripts.js @@ -183,9 +183,9 @@ KONTROL1.modRelease = function modRelease(knobnum){ KONTROL1.cueMoveToNum=-1; KONTROL1.cuemoveLastIndicator=-1; } - + KONTROL1.mod[knobnum]["state"]="o";//turn mod off - + KONTROL1.updateLEDs(); } @@ -199,7 +199,7 @@ KONTROL1.doLEDs = function doLEDs() { if (KONTROL1.debug>2){print("##function: "+KONTROL1.getFunctionName())}; engine.stopTimer(KONTROL1.flashTimer); KONTROL1.flashTimer=engine.beginTimer(30, "KONTROL1.bankIndicators()"); - return; + return; }; KONTROL1.bankIndicators= function bankIndicators(){ @@ -240,13 +240,13 @@ KONTROL1.updateLEDs = function updateLEDs(knobsonly, force) { var control; var controllist=(knobsonly===true)?KONTROL1.knobLEDs:KONTROL1.allLEDs; var force=(force===true)?force:false; - + //clear hooks for (var key in controllist){ midino=controllist[key]; control = KONTROL1.getControl(midino); if ((control[2]==false || control[2]=='LEDstateType') && force !== true){continue;}//control has no LED, LED Type is not set, or LED doesn't change on this mod setting. skip to next control - + //clear hooks if (KONTROL1.controls[midino]["hookSet"]===true){ hookgroup=KONTROL1.getGroup(control[5]);//get mixxx control group @@ -260,7 +260,7 @@ KONTROL1.updateLEDs = function updateLEDs(knobsonly, force) { midino=controllist[key]; control = KONTROL1.getControl(midino); if ((control[2]==false || control[2]=='LEDstateType') && force !== true){continue;}//control has no LED, LED Type is not set, or LED doesn't change on this mod setting. skip to next control - + if (control[2]=="on"){//LED is always on state=127; @@ -305,7 +305,7 @@ KONTROL1.doLogKnobLEDs = function doLogKnobLEDs(value,group,control) { //show values of mixxx control on knob leds //logarithmic scale (0 min, 4 max) - used for pregain and lo mid hi filters, for example. //K = 4*(V)^2 - //V = (K/4)^0.5 -- K= value coming from prog (0-4, logarithmic scale), V=value adjusted to linear 0-1 + //V = (K/4)^0.5 -- K= value coming from prog (0-4, logarithmic scale), V=value adjusted to linear 0-1 if (KONTROL1.debug>2){print("unadjusted value: "+value)}; value=(Math.pow((value/4),.5))*127; if (value<70){value+=10;}//add a bit to center 50% mark @@ -320,10 +320,10 @@ KONTROL1.doLogKnobLEDs = function doLogKnobLEDs(value,group,control) { if (control=="filterHigh"){midino=0x36;} if (control=="filterMid"){midino=0x35;} if (control=="filterLow"){midino=0x34;} - + midi.sendShortMsg(ch, midino, value); } - + KONTROL1.doHotcueLEDs = function doHotcueLEDs(value,group,control) { if (KONTROL1.debug>2){print("##function: "+KONTROL1.getFunctionName())}; value=value*127; @@ -332,7 +332,7 @@ KONTROL1.doHotcueLEDs = function doHotcueLEDs(value,group,control) { var hotcuenum=hotcuenum.replace("_enabled", ""); var ch=KONTROL1.channels[KONTROL1.curChannel]['noteon']; var midino=KONTROL1.hotcueLEDs[hotcuenum]; - + midi.sendShortMsg(ch, midino, value); } @@ -340,9 +340,9 @@ KONTROL1.doFilterKillLEDs = function doFilterKillLEDs(value,group,control) { if (KONTROL1.debug>2){print("##function: "+KONTROL1.getFunctionName())}; value=value*127; ch=KONTROL1.channels[KONTROL1.curChannel]['cc']; - if (control=="filterHighKill"){midino=0x08} - if (control=="filterMidKill"){midino=0x07} - if (control=="filterLowKill"){midino=0x06} + if (control=="filterHighKill"){midino=0x08} + if (control=="filterMidKill"){midino=0x07} + if (control=="filterLowKill"){midino=0x06} midi.sendShortMsg(ch, midino, value); } @@ -496,12 +496,12 @@ KONTROL1.switchShift = function switchShift(bank){ KONTROL1.toggleBinaryControl = function toggleBinaryControl(control, newstate){//toggles a binary control. If newstate is provided, it will toggle to that state, otherwise it toggles on/off if (KONTROL1.debug>2){print("##function: "+KONTROL1.getFunctionName())}; - + deck=(typeof deck !== 'undefined')?deck:"default"; var group = KONTROL1.getGroup(deck); - + if (newstate!==1 && newstate!==0){var newstate = (engine.getValue(group, control)==0)?1:0;} - + engine.setValue(group, control, newstate); } @@ -511,7 +511,7 @@ KONTROL1.logKnobAdjust = function logKnobAdjust(group, control, minRange, maxRan //use a knob to adjust a mixxx control //on a logarithmic scale (0 min, 4 max) //K = 4*(V)^2 - //V = (K/4)^0.5 -- K= value coming from prog (0-4, logarithmic scale), V=value adjusted to linear 0-1 + //V = (K/4)^0.5 -- K= value coming from prog (0-4, logarithmic scale), V=value adjusted to linear 0-1 var curValue=engine.getValue(KONTROL1.getGroup(group), control); var adjustedValue=Math.pow((curValue/4),.5);//adjust range so it's on a scale of 0 to 1 - logarithmic @@ -550,13 +550,13 @@ KONTROL1.wheelTurn = function wheelTurn(channel, control, value, status, group) if (value>1){var newValue=1}else{var newValue=-1}; if (!KONTROL1.scratching[group]){//do jog or other functions (move loops, hotcues, etc.) if not scratching - + //check if a loop needs to be moved if (KONTROL1.loopbuttonDown === true || KONTROL1.loopinbuttonDown === true || KONTROL1.loopoutbuttonDown === true){ if (KONTROL1.wheelMoveLoop(value)===true){return true;}//function returns true if loop moved } - - engine.setValue(group, "jog", newValue); + + engine.setValue(group, "jog", newValue); return true; }; for (i=0; i2){print("##function: "+KONTROL1.getFunctionName())}; deck=(typeof deck !== 'undefined')?deck:"default"; var group = KONTROL1.getGroup(deck); - //activate + //activate if (KONTROL1.mod["p1"]["state"]=="I"){ engine.setValue(group, "hotcue_"+hotcuenum+"_clear", 1); if (KONTROL1.debug>2){print("cleared")}; @@ -585,26 +585,26 @@ KONTROL1.cueClear = function cueClear(cue, control, deck){//clear hotcue - OR mo deck=(typeof deck !== 'undefined')?deck:"default"; var group = KONTROL1.getGroup(deck); - + 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 return true; } - + if(KONTROL1.cueMoveToNum>0){//hotcue set, but we're moving it, not clearing it. engine.setValue(group, "hotcue_"+KONTROL1.cueMoveToNum+"_set", 1); - engine.setValue(group, "hotcue_"+KONTROL1.cueMoveToNum+"_position", engine.getValue(group, "hotcue_"+cue+"_position")); + engine.setValue(group, "hotcue_"+KONTROL1.cueMoveToNum+"_position", engine.getValue(group, "hotcue_"+cue+"_position")); engine.setValue(group, "hotcue_"+cue+"_clear", 1); engine.setValue(group, "hotcue_"+cue+"_clear", 0); - + engine.stopTimer(KONTROL1.cueMoveIndicator); KONTROL1.cueMoveToNum=-1;//reset KONTROL1.cuemoveLastIndicator=-1; return true; } - + engine.setValue(group, "hotcue_"+cue+"_clear", 1); engine.setValue(group, "hotcue_"+cue+"_clear", 0); } @@ -612,7 +612,7 @@ KONTROL1.cueClear = function cueClear(cue, control, deck){//clear hotcue - OR mo KONTROL1.cueMoveIndicatorLEDs = function cueMoveIndicatorLEDs(control){ if (KONTROL1.debug>2){print("##function: "+KONTROL1.getFunctionName())}; ch=KONTROL1.channels[KONTROL1.curChannel]['noteon']; - + KONTROL1.cuemovecontrol=control; if (KONTROL1.cuemoveLastIndicator!=-1){midi.sendShortMsg(ch, KONTROL1.cuemoveLastIndicator, 0);}//turn off last indicator in case timer was interrupted (keeps last led from being left on if you switch "move to" buttons. KONTROL1.cuemoveLastIndicator=control; @@ -639,7 +639,7 @@ KONTROL1.cueLoop = function cueLoop(cue, len){//jump to hotcue and start loop engine.setValue(group, "hotcue_"+cue+"_activate", 0); engine.setValue(group, "beatloop_"+len+"_activate", 1); }else{//jump to existing cue and loop - + //calculate start and end points var startpos=engine.getValue(group, "hotcue_"+cue+"_position"); var loopseconds = len*(1/(engine.getValue(group, "bpm")/60)); @@ -648,11 +648,11 @@ KONTROL1.cueLoop = function cueLoop(cue, len){//jump to hotcue and start loop //disable loop if currently enabled if (engine.getValue(group, "loop_enabled")==true){engine.setValue(group, "reloop_exit", 1);} - + //set start and endpoints engine.setValue(group, "loop_start_position", startpos); engine.setValue(group, "l