diff options
Diffstat (limited to 'res/controllers/Novation-Dicer-scripts.js')
-rw-r--r-- | res/controllers/Novation-Dicer-scripts.js | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/res/controllers/Novation-Dicer-scripts.js b/res/controllers/Novation-Dicer-scripts.js index 22db8183ce..1034756abc 100644 --- a/res/controllers/Novation-Dicer-scripts.js +++ b/res/controllers/Novation-Dicer-scripts.js @@ -6,13 +6,13 @@ April 2012 Concept adapted from shyft's stutterHack Known issues: -Since loop rolls necessarily manipulate both the beatloop and loop states, triggering +Since loop rolls necessarily manipulate both the beatloop and loop states, triggering a loop roll will erase any ongoing loops or saved loop points for the channel. As longer effects are performed, it starts to drift slightly off of the correct place to resume playing. I try to compensate for this a bit, but couldn't make it perfect. Also, my compensation is based on trial and error, and may be incorrect -on other people's machines. YMMV. It would be better if this capability were +on other people's machines. YMMV. It would be better if this capability were implemented in Mixxx itself so as to keep the correct time. When an effect is released and pitch lock is on, there is a tiny silent pause @@ -34,7 +34,7 @@ NovationDicer.softOrange = 0x41;//"Off" state NovationDicer.init = function (id) { midi.sendShortMsg(0xBA,0x00,0x00); //Sets Dicers to known state - + midi.sendShortMsg(0x9B,0x3c,NovationDicer.softGreen); midi.sendShortMsg(0x9E,0x3c,NovationDicer.softGreen); midi.sendShortMsg(0x9B,0x3d,NovationDicer.softGreen); @@ -45,7 +45,7 @@ NovationDicer.init = function (id) midi.sendShortMsg(0x9E,0x3f,NovationDicer.softGreen); midi.sendShortMsg(0x9B,0x40,NovationDicer.softGreen); midi.sendShortMsg(0x9E,0x40,NovationDicer.softGreen); - + midi.sendShortMsg(0x9B,0x41,NovationDicer.softGreen); midi.sendShortMsg(0x9E,0x41,NovationDicer.softGreen); midi.sendShortMsg(0x9B,0x42,NovationDicer.softGreen); @@ -56,7 +56,7 @@ NovationDicer.init = function (id) midi.sendShortMsg(0x9E,0x44,NovationDicer.softGreen); midi.sendShortMsg(0x9B,0x45,NovationDicer.softGreen); midi.sendShortMsg(0x9E,0x45,NovationDicer.softGreen); - + midi.sendShortMsg(0x9c,0x3c,NovationDicer.softOrange); midi.sendShortMsg(0x9c,0x3d,NovationDicer.softOrange); midi.sendShortMsg(0x9c,0x3e,NovationDicer.softOrange); @@ -67,7 +67,7 @@ NovationDicer.init = function (id) midi.sendShortMsg(0x9f,0x3e,NovationDicer.softOrange); midi.sendShortMsg(0x9f,0x3f,NovationDicer.softOrange); midi.sendShortMsg(0x9f,0x40,NovationDicer.softOrange); - + midi.sendShortMsg(0x9c,0x41,NovationDicer.softOrange); midi.sendShortMsg(0x9c,0x42,NovationDicer.softOrange); midi.sendShortMsg(0x9c,0x43,NovationDicer.softOrange); @@ -78,7 +78,7 @@ NovationDicer.init = function (id) midi.sendShortMsg(0x9f,0x43,NovationDicer.softOrange); midi.sendShortMsg(0x9f,0x44,NovationDicer.softOrange); midi.sendShortMsg(0x9f,0x45,NovationDicer.softOrange); - + engine.setValue("[Flanger]", "lfoDepth", 1); //Crank up the depth so the flanger does something } @@ -90,31 +90,31 @@ NovationDicer.shutdown = function () NovationDicer.effectThenContinue = function (channel, control, value, status, group) -{ +{ if (value) //Button pressed { if ((NovationDicer.effectsCH1 == 0) && (group == "[Channel1]")) //Record the starting point of the CH1 first effect { NovationDicer.startTimeCH1 = new Date(); NovationDicer.startPlayPosCH1 = engine.getValue(group,"playposition"); - } - + } + if ((NovationDicer.effectsCH2 == 0) && (group == "[Channel2]")) //Record the starting point of the CH2 first effect { NovationDicer.startTimeCH2 = new Date(); NovationDicer.startPlayPosCH2 = engine.getValue(group,"playposition"); } - + NovationDicer.startEffect(channel, control, value, status, group); - + if (group == "[Channel1]") NovationDicer.effectsCH1++; else NovationDicer.effectsCH2++; - + }else //Button released { - + if (((NovationDicer.effectsCH1 == 1) && (group == "[Channel1]")) || ((NovationDicer.effectsCH2 == 1) && (group == "[Channel2]"))) //End the effect session and resume playing if it's the last effect running { if (group == "[Channel1]") @@ -129,20 +129,20 @@ NovationDicer.effectThenContinue = function (channel, control, value, status, gr var tDelta = new Date() - NovationDicer.startTimeCH2; tDelta = tDelta + 28 + (tDelta * 0.00065); //Compensate for wandering/delay tDelta = tDelta + (tDelta * (engine.getValue(group, "rate") * 0.1) * engine.getValue(group, "rate_dir")); //Compensate for pitch - var track2Ms = engine.getValue(group,"duration") * 1000; + var track2Ms = engine.getValue(group,"duration") * 1000; var newPlayPos = (NovationDicer.startPlayPosCH2 + (tDelta/track2Ms)); } - + NovationDicer.endEffect(channel, control, value, status, group); - + engine.setValue(group,"playposition",newPlayPos); //Resume playing } - + if (group == "[Channel1]") NovationDicer.effectsCH1--; else NovationDicer.effectsCH2--; - + NovationDicer.turnOffLEDs(channel, control, value, status, group); } } @@ -150,7 +150,7 @@ NovationDicer.effectThenContinue = function (channel, control, value, status, gr NovationDicer.startEffect = function(channel, control, value, status, group) //Start the effect and light the LED { - //----------Loop Rolls---------- + //----------Loop Rolls---------- if (channel == 0x0B && control == 0x3C) //ch1 { engine.setValue(group, "beatloop_0.0625", 1); @@ -201,7 +201,7 @@ NovationDicer.startEffect = function(channel, control, value, status, group) engine.setValue(group, "beatloop_1", 1); midi.sendShortMsg(0x9E,0x40,NovationDicer.green); } - + //----------Rewind/stutter/cue---------- if (channel == 0x0c && control == 0x3c) { @@ -223,7 +223,7 @@ NovationDicer.startEffect = function(channel, control, value, status, group) engine.setValue(group, "back", 1); midi.sendShortMsg(0x9f,0x40,NovationDicer.orange); } - + } @@ -231,27 +231,27 @@ NovationDicer.endEffect = function(channel, control, value, status, group) { //Make one test for each group of *all* effects that can possibly be triggered together //and disable them all at once - - //----------Loop Rolls---------- + + //----------Loop Rolls---------- if (engine.getValue(group, "loop_enabled")) { engine.setValue(group,"loop_start_position", -1); //Exit any loops engine.setValue(group,"loop_end_position", -1); } - + //----------Rewind/stutter/cue---------- if ((engine.getValue(group, "fwd")) || (engine.getValue(group, "back"))) { engine.setValue(group, "fwd", 0); engine.setValue(group, "back", 0); } - + } NovationDicer.turnOffLEDs = function(channel, control, value, status, group) { - //----------Loop Rolls---------- + //----------Loop Rolls---------- if (channel == 0x0B && control == 0x3C) //ch1 { midi.sendShortMsg(0x9B,0x3c,NovationDicer.softGreen); @@ -292,7 +292,7 @@ NovationDicer.turnOffLEDs = function(channel, control, value, status, group) { midi.sendShortMsg(0x9E,0x40,NovationDicer.softGreen); } - + //----------Rewind/stutter/cue---------- if (channel == 0x0c && control == 0x3c) //FF ch1 { @@ -355,11 +355,11 @@ NovationDicer.stutter = function(group) engine.setValue(group, "pregain", NovationDicer.gainCH1); else engine.setValue(group, "pregain", NovationDicer.gainCH2); - } + } } NovationDicer.flangeEffect = function(channel, control, value, status, group) -{ +{ if (value) //Button pressed { engine.setValue(group, "flanger", !engine.getValue(group, "flanger")); //Toggle the flanger @@ -374,7 +374,7 @@ NovationDicer.cueButton = function(channel, control, value, status, group) midi.sendShortMsg(0x9c,0x3d,NovationDicer.orange); else midi.sendShortMsg(0x9f,0x3d,NovationDicer.orange); - + engine.setValue(group, "cue_default", 1); }else { |