/usr/share/mixxx/controllers/Novation-Dicer-scripts.js is in mixxx-data 2.0.0~dfsg-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | /*
Novation Dicer mapping scripts for loop rolls
by Pandemonium (djpandemonium@gmail.com)
April 2012
Concept adapted from shyft's stutterHack
Known issues:
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
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
before it resumes playing. Once again, this doesn't appear to be fixable here.
*/
function NovationDicer() {}
NovationDicer.effectsCH1 = 0; //Record number of effect buttons pressed. Protects against multi-button mashing
NovationDicer.effectsCH2 = 0;
NovationDicer.gainCH1 = 0;
NovationDicer.gainCH2 = 0;
NovationDicer.green = 0x7F; //"On" state
NovationDicer.orange = 0x4F; //"On" state
NovationDicer.softGreen = 0x71; //"Off" state
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);
midi.sendShortMsg(0x9E,0x3d,NovationDicer.softGreen);
midi.sendShortMsg(0x9B,0x3e,NovationDicer.softGreen);
midi.sendShortMsg(0x9E,0x3e,NovationDicer.softGreen);
midi.sendShortMsg(0x9B,0x3f,NovationDicer.softGreen);
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);
midi.sendShortMsg(0x9E,0x42,NovationDicer.softGreen);
midi.sendShortMsg(0x9B,0x43,NovationDicer.softGreen);
midi.sendShortMsg(0x9E,0x43,NovationDicer.softGreen);
midi.sendShortMsg(0x9B,0x44,NovationDicer.softGreen);
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);
midi.sendShortMsg(0x9c,0x3f,NovationDicer.softOrange);
midi.sendShortMsg(0x9c,0x40,NovationDicer.softOrange);
midi.sendShortMsg(0x9f,0x3c,NovationDicer.softOrange);
midi.sendShortMsg(0x9f,0x3d,NovationDicer.softOrange);
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);
midi.sendShortMsg(0x9c,0x44,NovationDicer.softOrange);
midi.sendShortMsg(0x9c,0x45,NovationDicer.softOrange);
midi.sendShortMsg(0x9f,0x41,NovationDicer.softOrange);
midi.sendShortMsg(0x9f,0x42,NovationDicer.softOrange);
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
}
NovationDicer.shutdown = function ()
{
midi.sendShortMsg(0xBA,0x00,0x00); //Resets Dicers
}
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]")
{
var tDelta = new Date() - NovationDicer.startTimeCH1; // Duration of loop
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 track1Ms = engine.getValue(group,"duration") * 1000; // Convert seconds to MS
var newPlayPos = (NovationDicer.startPlayPosCH1 + (tDelta/track1Ms));
} else
{
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 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);
}
}
NovationDicer.startEffect = function(channel, control, value, status, group) //Start the effect and light the LED
{
//----------Loop Rolls----------
if (channel == 0x0B && control == 0x3C) //ch1
{
engine.setValue(group, "beatloop_0.0625", 1);
midi.sendShortMsg(0x9B,0x3c,NovationDicer.green);
}
if (channel == 0x0E && control == 0x3C) //ch2
{
engine.setValue(group, "beatloop_0.0625", 1);
midi.sendShortMsg(0x9E,0x3c,NovationDicer.green);
}
if (channel == 0x0B && control == 0x3D) //ch1
{
engine.setValue(group, "beatloop_0.125", 1);
midi.sendShortMsg(0x9B,0x3d,NovationDicer.green);
}
if (channel == 0x0E && control == 0x3D) //ch2
{
engine.setValue(group, "beatloop_0.125", 1);
midi.sendShortMsg(0x9E,0x3d,NovationDicer.green);
}
if (channel == 0x0B && control == 0x3E) //ch1
{
engine.setValue(group, "beatloop_0.25", 1);
midi.sendShortMsg(0x9B,0x3e,NovationDicer.green);
}
if (channel == 0x0E && control == 0x3E) //ch2
{
engine.setValue(group, "beatloop_0.25", 1);
midi.sendShortMsg(0x9E,0x3e,NovationDicer.green);
}
if (channel == 0x0B && control == 0x3F) //ch1
{
engine.setValue(group, "beatloop_0.5", 1);
midi.sendShortMsg(0x9B,0x3f,NovationDicer.green);
}
if (channel == 0x0E && control == 0x3F) //ch2
{
engine.setValue(group, "beatloop_0.5", 1);
midi.sendShortMsg(0x9E,0x3f,NovationDicer.green);
}
if (channel == 0x0B && control == 0x40) //ch1
{
engine.setValue(group, "beatloop_1", 1);
midi.sendShortMsg(0x9B,0x40,NovationDicer.green);
}
if (channel == 0x0E && control == 0x40) //ch2
{
engine.setValue(group, "beatloop_1", 1);
midi.sendShortMsg(0x9E,0x40,NovationDicer.green);
}
//----------Rewind/stutter/cue----------
if (channel == 0x0c && control == 0x3c)
{
engine.setValue(group, "fwd", 1);
midi.sendShortMsg(0x9c,0x3c,NovationDicer.orange);
}
if (channel == 0x0f && control == 0x3c)
{
engine.setValue(group, "fwd", 1);
midi.sendShortMsg(0x9f,0x3c,NovationDicer.orange);
}
if (channel == 0x0c && control == 0x40)
{
engine.setValue(group, "back", 1);
midi.sendShortMsg(0x9c,0x40,NovationDicer.orange);
}
if (channel == 0x0f && control == 0x40)
{
engine.setValue(group, "back", 1);
midi.sendShortMsg(0x9f,0x40,NovationDicer.orange);
}
}
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----------
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----------
if (channel == 0x0B && control == 0x3C) //ch1
{
midi.sendShortMsg(0x9B,0x3c,NovationDicer.softGreen);
}
if (channel == 0x0E && control == 0x3C) //ch2
{
midi.sendShortMsg(0x9E,0x3c,NovationDicer.softGreen);
}
if (channel == 0x0B && control == 0x3D) //ch1
{
midi.sendShortMsg(0x9B,0x3d,NovationDicer.softGreen);
}
if (channel == 0x0E && control == 0x3D) //ch2
{
midi.sendShortMsg(0x9E,0x3d,NovationDicer.softGreen);
}
if (channel == 0x0B && control == 0x3E) //ch1
{
midi.sendShortMsg(0x9B,0x3e,NovationDicer.softGreen);
}
if (channel == 0x0E && control == 0x3E) //ch2
{
midi.sendShortMsg(0x9E,0x3e,NovationDicer.softGreen);
}
if (channel == 0x0B && control == 0x3F) //ch1
{
midi.sendShortMsg(0x9B,0x3f,NovationDicer.softGreen);
}
if (channel == 0x0E && control == 0x3F) //ch2
{
midi.sendShortMsg(0x9E,0x3f,NovationDicer.softGreen);
}
if (channel == 0x0B && control == 0x40) //ch1
{
midi.sendShortMsg(0x9B,0x40,NovationDicer.softGreen);
}
if (channel == 0x0E && control == 0x40) //ch2
{
midi.sendShortMsg(0x9E,0x40,NovationDicer.softGreen);
}
//----------Rewind/stutter/cue----------
if (channel == 0x0c && control == 0x3c) //FF ch1
{
midi.sendShortMsg(0x9c,0x3c,NovationDicer.softOrange);
}
if (channel == 0x0f && control == 0x3c) //FF ch2
{
midi.sendShortMsg(0x9f,0x3c,NovationDicer.softOrange);
}
if (channel == 0x0c && control == 0x40)
{
midi.sendShortMsg(0x9c,0x40,NovationDicer.softOrange);
}
if (channel == 0x0f && control == 0x40)
{
midi.sendShortMsg(0x9f,0x40,NovationDicer.softOrange);
}
}
NovationDicer.transformer = function(channel, control, value, status, group)
{
if(value)
{
if(group == "[Channel1]")
{
NovationDicer.gainCH1 = engine.getValue(group, "pregain");
NovationDicer.timer1 = engine.beginTimer(((60000/engine.getValue(group,"bpm"))/8),"NovationDicer.stutter(\"[Channel1]\")");
midi.sendShortMsg(0x9c,0x3f,NovationDicer.orange);
} else
{
NovationDicer.gainCH2 = engine.getValue(group, "pregain");
NovationDicer.timer2 = engine.beginTimer(((60000/engine.getValue(group,"bpm"))/8),"NovationDicer.stutter(\"[Channel2]\")");
midi.sendShortMsg(0x9f,0x3f,NovationDicer.orange);
}
} else
{
if(group == "[Channel1]")
{
engine.stopTimer(NovationDicer.timer1);
engine.setValue(group, "pregain", NovationDicer.gainCH1);
midi.sendShortMsg(0x9c,0x3f,NovationDicer.softOrange);
}
if(group == "[Channel2]")
{
engine.stopTimer(NovationDicer.timer2);
engine.setValue(group, "pregain", NovationDicer.gainCH2);
midi.sendShortMsg(0x9f,0x3f,NovationDicer.softOrange);
}
}
}
NovationDicer.stutter = function(group)
{
if(engine.getValue(group,"pregain") != 0)
engine.setValue(group, "pregain", 0);
else
{
if(group == "[Channel1]")
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
}
}
NovationDicer.cueButton = function(channel, control, value, status, group)
{
if(value)
{
if (group == "[Channel1]")
midi.sendShortMsg(0x9c,0x3d,NovationDicer.orange);
else
midi.sendShortMsg(0x9f,0x3d,NovationDicer.orange);
engine.setValue(group, "cue_default", 1);
}else
{
if (group == "[Channel1]")
midi.sendShortMsg(0x9c,0x3d,NovationDicer.softOrange);
else
midi.sendShortMsg(0x9f,0x3d,NovationDicer.softOrange);
engine.setValue(group, "cue_default", 0);
}
}
|