This file is indexed.

/usr/share/mixxx/controllers/Gemini-CDMP-7000-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
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
/**
 * Gemini CDMP-7000 controller script v1.2
 * For Mixxx 1.11.0
 * Written by djtrinidad
 * Copyright 2014
**/

// Changelog v1.2
// Fixed clearing/lighting leds for hotcues if song has them set or not
// Incorporated Pitch Ranges into Button/LCD
// Incorprated BPM in LCD (may still not happen on first load)
// Updates LCD with Vinyl and Hotcue messages

// ---- remaining issues
// slip mode doesn't work unless you manually turn it off (disable needs to be called on wheel hand lift)
// no flashing play buttons, they turn off after first use (need to turn back on after track stop)
// auto cue button doesn't do anything, easy fix
// back button does't toggle directory mode
// Set Master Tempo to Keylock, not sure what it is now 
// many more bug fixes where found
// every once in a while scratch mode ignores vinyl button, hard to respoduce it's intermitent


// Todo:
// Song title to LCD (doesn't look possible with 1.11)
// Elapsed time to LCD
// implement engine connects
// Work towards port to Mixxx 1.12 later


// ------------------------------------------
// ---    Initialization Functions    ---
// ------------------------------------------

function cdmp7000() {}


// Initialize variables
//
cdmp7000.reverse_play_d1 = false;
cdmp7000.reverse_play_d2 = false;
directoryactive = false;

// Global variables
//

cdmp7000.pitchRanges = [ 0.08, 0.16, 0.25, 0.5, 0.100 ];   // Available pitch ranges
cdmp7000.sysex = [0xF0, 0x7D, 0x01];  // Preamble for all SysEx messages and song info for this device
cdmp7000.LCD_CUE = [ 0x3C, 0x74, 0x69, 0x6D, 0x65, 0x3E, 0x3C, 0x63, 0x75, 0x65, 0x30, 0x3E ];
cdmp7000.LCD_CUE1 = [ 0x3C, 0x74, 0x69, 0x6D, 0x65, 0x3E, 0x3C, 0x63, 0x75, 0x65, 0x31, 0x3E ];
cdmp7000.LCD_CUE2 = [ 0x3C, 0x74, 0x69, 0x6D, 0x65, 0x3E, 0x3C, 0x63, 0x75, 0x65, 0x32, 0x3E ];
cdmp7000.LCD_CUE3 = [ 0x3C, 0x74, 0x69, 0x6D, 0x65, 0x3E, 0x3C, 0x63, 0x75, 0x65, 0x33, 0x3E ];
cdmp7000.LCD_LOOP_IN = [ 0x3C, 0x74, 0x69, 0x6D, 0x65, 0x3E, 0x3C, 0x6C, 0x69, 0x6E, 0x3E ];
cdmp7000.LCD_LOOP_OUT = [ 0x3C, 0x74, 0x69, 0x6D, 0x65, 0x3E, 0x3C, 0x6C, 0x6F, 0x75, 0x74, 0x3E ];
//cdmp7000.LCD_PLAY_POS = [0xF0, 0x7D, 0x01, 0x3C, 0x74, 0x69, 0x6D, 0x65, 0x3E, 0x3C, 0x70, 0x6C, 0x61, 0x79, 0x3E];
cdmp7000.LCD_PLAY_POS = [0xF0, 0x7D, 0x01, 0x3C, 0x74, 0x69, 0x6D, 0x65, 0x3E];
cdmp7000.LCD_PAUSE_POS = [ 0x3C, 0x74, 0x69, 0x6D, 0x65, 0x3E, 0x3C, 0x70, 0x61, 0x75, 0x73, 0x65, 0x3E];
cdmp7000.LCD_BPM = [0xF0, 0x7D, 0x01, 0x3C, 0x62, 0x70, 0x6D, 0x3E];
cdmp7000.LCD_PITCH = [0xF0, 0x7D, 0x01, 0x3C, 0x70, 0x69, 0x74, 0x63, 0x68, 0x3E];
cdmp7000.LCD_RANGE = [0xF0, 0x7D, 0x01, 0x3C, 0x72, 0x61, 0x6E, 0x67, 0x65, 0x3E ];
cdmp7000.LCD_FX_PARAM = [ 0x3C, 0x65, 0x66, 0x78, 0x3E ];

// Format!
// may be midi.sendSysexMsg(cdmp7000.sysex.concat([cdmp7000.LCD_BPM],message.toInt(), 0xF7),7+message.length);
// var message = "Whatever";
// length can be adjusted, preamble is 3 bytes, plus close byte is 4


//   Functions - init & shutdown
// 

cdmp7000.init = function (channel, control, value, status, group) {

cdmp7000.vinylButton_d1 = false;
cdmp7000.memoButton_d1 = false;
cdmp7000.fx1_state_d1 = false; 
cdmp7000.fx2_state_d1 = false; 
cdmp7000.fx3_state_d1 = false;
cdmp7000.slip_state_d1 = false;

cdmp7000.vinylButton_d2 = false;
cdmp7000.memoButton_d2 = false;
cdmp7000.fx1_state_d2 = false; 
cdmp7000.fx2_state_d2 = false; 
cdmp7000.fx3_state_d2 = false;
cdmp7000.slip_state_d2 = false;

cdmp7000.firstDeckGroup = "[Channel1]";
cdmp7000.secondDeckGroup = "[Channel2]";

engine.setValue(cdmp7000.firstDeckGroup,'rateRange', 0.08);
engine.setValue(cdmp7000.secondDeckGroup,'rateRange', 0.08);


engine.connectControl(cdmp7000.firstDeckGroup,"rate","cdmp7000.rate_d1");
engine.connectControl(cdmp7000.secondDeckGroup,"rate","cdmp7000.rate_d2");
// may need to add a connect here to turn play led on when stop is pressed

// Turn off all leds to begin with
    for (i=0x01; i<=0x60; i++) midi.sendShortMsg(0x90,i,0x00); 

// Factory lcd clear method
    midi.sendSysexMsg(cdmp7000.sysex.concat([0x3C, 0x62, 0x79, 0x65, 0x3E, 0xF7]),9);

// send welcome message
    message = "<artist><title>MIXXX<album><genre><length>20<index>0";
    midi.sendSysexMsg(cdmp7000.sysex.concat(message.toInt(), 0xF7),4+message.length);   // sendto lcd song name slot

} 

// Shutdown Function

cdmp7000.shutdown = function() {

    for (i=0x01; i<=0x60; i++) midi.sendShortMsg(0x90,i,0x00);  // Turn off all LEDs

    // lcd clear method
    midi.sendSysexMsg(cdmp7000.sysex.concat([0x3C, 0x62, 0x79, 0x65, 0x3E, 0xF7]),9);

}

/// ----- End of Init/Shutdown & Initialization section


cdmp7000.playPositionChanged = function (channel, control, value, status, group) {

var currentValue2 = engine.getValue(group,"playposition");
print ("Play Pos:"+currentValue2);
}


// ------------------------------------------
// ---    Vinyl/Reverse/Slip Functions    ---
// ------------------------------------------


// Toggle vinyl mode deck 1
cdmp7000.vinyl_toggle_d1 = function (channel, control, value, status, group) {
    
    if ((value == 0x7f) && (cdmp7000.vinylButton_d1 == false)) {
        
        cdmp7000.vinylButton_d1 = true;
        midi.sendShortMsg(0x90,0x0E,0x7F);
        cdmp7000.setSongLcd("vinyl", 1);
    }
    else if ((value == 0x7f) && (cdmp7000.vinylButton_d1 == true)) {
        
        cdmp7000.vinylButton_d1 = false;
        midi.sendShortMsg(0x90,0x0E,0x00);
        cdmp7000.setSongLcd("vinyl", 0);
    }
}

// Toggle vinyl mode deck 2
cdmp7000.vinyl_toggle_d2 = function (channel, control, value, status, group) {
    
    if ((value == 0x7f) && (cdmp7000.vinylButton_d2 == false)) {
        
        cdmp7000.vinylButton_d2 = true;
        midi.sendShortMsg(0x90,0x0E,0x7F);
        cdmp7000.setSongLcd("vinyl", 1);
    }
    else if ((value == 0x7f) && (cdmp7000.vinylButton_d2 == true)) {
        
        cdmp7000.vinylButton_d2 = false;
        midi.sendShortMsg(0x90,0x0E,0x00);
        cdmp7000.setSongLcd("vinyl", 0);
    }
}


// Toggle reverse for deck 1, not sure if this works right 
cdmp7000.reverse_toggle_d1 = function(channel, control, value, status, group) {
    if (value == 0) {
        return;
    }
    if (cdmp7000.reverse_play_d1){
       cdmp7000.reverse_play_d1 = false;
       midi.sendShortMsg(0x90,0x1E,0x00);
   } else if (!cdmp7000.reverse_play_d1){
    cdmp7000.reverse_play_d1 = true;
    midi.sendShortMsg(0x90,0x1E,0x7F);
    }
   engine.setValue(group,'reverse',cdmp7000.reverse_play_d1);
}


// Toggle reverse for deck 2, not sure if this works right 
cdmp7000.reverse_toggle_d2 = function(channel, control, value, status, group) {
    if (value == 0) {
        return;
    }
    if (cdmp7000.reverse_play_d2){
       cdmp7000.reverse_play_d2 = false;
       midi.sendShortMsg(0x90,0x1E,0x00);
   } else if (!cdmp7000.reverse_play_d2){
    cdmp7000.reverse_play_d2 = true;
    midi.sendShortMsg(0x90,0x1E,0x7F);
    }
   engine.setValue(group,'reverse',cdmp7000.reverse_play_d2);
}

// slip mode (doesn't work, unless you press again to disable. Disable should occur on wheel touch disable)

cdmp7000.slip_enabled_d1 = function(channel, control, value, status, group) {


    if ((value == 0x7f) && (cdmp7000.slip_state_d1 == false)) {
        
        cdmp7000.slip_state_d1 = true;
        midi.sendShortMsg(0x90,0x1F,0x7F);
        engine.setValue(group, 'slip_enabled', 1);
    }
    else if ((value == 0x7f) && (cdmp7000.slip_state_d1 == true)) {
        
        cdmp7000.slip_state_d1 = false;
        midi.sendShortMsg(0x90,0x1F,0x00);
        engine.setValue(group, 'slip_enabled', 0);
    }
}

cdmp7000.slip_enabled_d2 = function(channel, control, value, status, group) {


    if ((value == 0x7f) && (cdmp7000.slip_state_d2 == false)) {
        
        cdmp7000.slip_state_d2 = true;
        midi.sendShortMsg(0x90,0x1F,0x7F);
        engine.setValue(group, 'slip_enabled', 1);
    }
    else if ((value == 0x7f) && (cdmp7000.slip_state_d2 == true)) {
        
        cdmp7000.slip_state_d2 = false;
        midi.sendShortMsg(0x90,0x1F,0x00);
        engine.setValue(group, 'slip_enabled', 0);
    }
}


// ------------------------------------------
// --------    Jog Wheel Functions   --------
// ------------------------------------------

// Deck 1 - Step 1 If wheels are touched and vinyl is on, then scratch is enabled
cdmp7000.wheelTouch_d1 = function (channel, control, value, status) {

    if ((value == 0x7f) && (cdmp7000.vinylButton_d1 == true)) {
    var alpha = 1.0/8;
    var beta = alpha/32;
    engine.scratchEnable(1, 128, 33+1/3, alpha,beta);
    } else {
            engine.scratchDisable(1);
   }

}

// Deck 1 - Step 2 If scratch is enabled by wheelTouch_d1 then scratch on wheel turn, otherwise jog
cdmp7000.wheelTurn_d1 = function (channel, control, value, status, group) {

  var newValue=(value-64);

  if (!engine.isScratching(1)) {   
    
        engine.setValue(group, "jog", newValue);
        return;

         }

         engine.scratchTick(1,newValue);

}


// Deck 2 - Step 1 If wheels are touched and vinyl is on, then scratch  is enabled
cdmp7000.wheelTouch_d2 = function (channel, control, value, status) {

    if ((value == 0x7f) && (cdmp7000.vinylButton_d2 == true)) {
    var alpha = 1.0/8;
    var beta = alpha/32;
    engine.scratchEnable(2, 128, 33+1/3, alpha,beta);
  } else {
           engine.scratchDisable(2);
   }
}


// Deck 2 - Step 2 If scratch is enabled by wheelTouch_d2 then scratch on wheel turn, otherwise jog
cdmp7000.wheelTurn_d2 = function (channel, control, value, status, group) {

var newValue=(value-64);

// if vinyl mode isn't on then just jog
if (!engine.isScratching(2)) {

engine.setValue(group, "jog", newValue);
return;

   }
     engine.scratchTick(2,newValue);
}


// ------------------------------------------
// -----    Track Selection Functions   -----
// ------------------------------------------

// Back button - Directory/File future code

// Select Track knob - goes positive and negative
cdmp7000.select_track_knob_pos = function(channel, control, value, status, group) {  // The encoder goes positive and negative
    if (value >= 0x01 && value <= 0x1e) {
        value = value;
    } else if (value >= 0x62 && value <= 0x7f) {
        value = 0 - (0x7f-value+1);
    } else {
        return;
    }
    engine.setValue(group,'SelectTrackKnob',value);
};

cdmp7000.select_track_knob_neg = function(channel, control, value, status, group) {
    if (value >= 0x01 && value <= 0x1e) {
        value = value;
    } else if (value >= 0x62 && value <= 0x7f) {
        value = 0 - (0x7f-value-1);
    } else {
        return;
    }
    engine.setValue(group,'SelectTrackKnob',value);
};

cdmp7000.ToggleDirectory = function(channel, control, value, status, group) {

      if (value == 0x7f)  {
           
        print( "Directory Mode!: Coming soon!");

         }

 }

// ------------------------------------------
// ------   Hotcue/Loops Functions   --------
// ------------------------------------------

// Toggle memo mode deck 1 - next hotcue pushed is deleted if on, if false no action
cdmp7000.memoActive_d1 = function (channel, control, value, status, group) {

 
    if ((value == 0x7f) && (cdmp7000.memoButton_d1 == false)) {
        
        cdmp7000.memoButton_d1 = true;
        midi.sendShortMsg(0x90,0x08,0x7F);
    }
    else if ((value == 0x7f) && (cdmp7000.memoButton_d1 == true)) {
        
        cdmp7000.memoButton_d1 = false;
        midi.sendShortMsg(0x90,0x08,0x00);
    }
}


// Toggle memo mode deck 2 - next hotcue pushed is deleted if on, if false no action
cdmp7000.memoActive_d2 = function (channel, control, value, status, group) {

    
    if ((value == 0x7f) && (cdmp7000.memoButton_d2 == false)) {
        
        cdmp7000.memoButton_d2 = true;
        midi.sendShortMsg(0x90,0x08,0x7F);
    }
    else if ((value == 0x7f) && (cdmp7000.memoButton_d2 == true)) {
        
        cdmp7000.memoButton_d2 = false;
        midi.sendShortMsg(0x90,0x08,0x00);
    }
}

// Deck 1 - HotCues - Checks for memo button active to delete hotcue and turn off LED

cdmp7000.hotcue_activate_d1 = function(group,hotcue,value,led) {

    hotcue_state_d1 = 'hotcue_' + hotcue + '_enabled';
    result = engine.getValue("[Channel1]", hotcue_state_d1);
    

    if ((value == 0x7f) && (cdmp7000.memoButton_d1 == true))  {
        key = 'hotcue_' + hotcue + '_clear';

        engine.setValue(group,key,value);
        midi.sendShortMsg(0x90,0x08,0x00); // turn off memo led
        midi.sendShortMsg(0x90,led,0x00); // turn off efx led

       cdmp7000.memoButton_d1 = false;
       cdmp7000.setSongLcd(key, 1);

      } else if ((value == 0x7f) && (cdmp7000.memoButton_d1 == false) && (result == 0))  {

    key = 'hotcue_' + hotcue + '_set';
    engine.setValue(group,key,value);
    midi.sendShortMsg(0x90,led,0x7F);
    cdmp7000.setSongLcd(key, 1);

   } else {

     key = 'hotcue_' + hotcue + '_gotoandplay';
     engine.setValue(group,key,value);

   }
}

// Deck 1 - Hotcues - Actually does the work and calls cdmp7000.hotcue_activate_d1
 
cdmp7000.hotcue_1_activate_d1 = function(channel, control, value, status, group) {

    cdmp7000.hotcue_activate_d1(group,1,value, 0x05);

}
cdmp7000.hotcue_2_activate_d1 = function(channel, control, value, status, group) {
    cdmp7000.hotcue_activate_d1(group,2,value, 0x06);
  
}
cdmp7000.hotcue_3_activate_d1 = function(channel, control, value, status, group) {
    cdmp7000.hotcue_activate_d1(group,3,value, 0x07);
  
}


// Deck 2 - HotCues - Checks for memo button active to delete hotcue and turn off LED
cdmp7000.hotcue_activate_d2 = function(group,hotcue,value,led) {

    hotcue_state_d2 = 'hotcue_' + hotcue + '_enabled';
    result = engine.getValue("[Channel2]", hotcue_state_d2);
    

    if ((value == 0x7f) && (cdmp7000.memoButton_d2 == true))  {
        key = 'hotcue_' + hotcue + '_clear';
        engine.setValue(group,key,value);
        midi.sendShortMsg(0x90,0x08,0x00); // turn off memo led
        midi.sendShortMsg(0x90,led,0x00); // turn off efx led
       cdmp7000.memoButton_d2 = false;
       cdmp7000.setSongLcd(key, 1);
        
    } else if ((value == 0x7f) && (cdmp7000.memoButton_d2 == false) && (result == 0))  {

    key = 'hotcue_' + hotcue + '_set';
    engine.setValue(group,key,value);
    midi.sendShortMsg(0x90,led,0x7F);
    cdmp7000.setSongLcd(key, 1);

   } else {

     key = 'hotcue_' + hotcue + '_gotoandplay';
     engine.setValue(group,key,value);

   }
}

// Deck 2 - Hotcues - Actually does the work and calls cdmp7000.hotcue_activate_d2
cdmp7000.hotcue_1_activate_d2 = function(channel, control, value, status, group) {

    cdmp7000.hotcue_activate_d2(group,1,value, 0x05);
   
    
}
cdmp7000.hotcue_2_activate_d2 = function(channel, control, value, status, group) {
    cdmp7000.hotcue_activate_d2(group,2,value, 0x06);
  
}
cdmp7000.hotcue_3_activate_d2 = function(channel, control, value, status, group) {
    cdmp7000.hotcue_activate_d2(group,3,value, 0x07);
  
}

// Loop functions
cdmp7000.loopIn = function(channel, control, value, status, group) {

     if (!value) return;

     engine.setValue(group, "loop_in", status?1:0);
     midi.sendShortMsg(0x90,0x10,0x7F);  // turn on the loop_in led
     return;

}

cdmp7000.loopOut = function(channel, control, value, status, group) {

    if (!value) return;

       engine.setValue(group, "loop_out", status?1:0);
       midi.sendShortMsg(0x90,0x11,0x7F);  // turn on the loop_out led
       return;

}

cdmp7000.loopExit = function(channel, control, value, status, group) {

    if (!value) return;
       engine.setValue(group, "reloop_exit", status?1:0);
       midi.sendShortMsg(0x90,0x10,0x00);  // turn off the loop_in led
       midi.sendShortMsg(0x90,0x11,0x00);  // turn off the loop_out led
       return;
}


// ------------------------------------------
// --------   Effects Functions   -----------
// ------------------------------------------

// Need to add efx4,efx5,efx6 but what to do with them? also incorporate jog function for effect 

// Deck 1 efx
cdmp7000.fx1_enable_d1 = function (channel, control, value, status, group) {

    if ((value == 0x7f) && (cdmp7000.fx1_state_d1 == false)) {
        
        cdmp7000.fx1_state_d1 = true;
        midi.sendShortMsg(0x90, 0x14, 0x7F);
        engine.setValue(group, "filterHighKill", cdmp7000.fx1_state_d1);
        engine.setValue(group, "filterMidKill", cdmp7000.fx1_state_d1);
    }
    else if ((value == 0x7f) && (cdmp7000.fx1_state_d1 == true)) {
        
        cdmp7000.fx1_state_d1 = false;
        midi.sendShortMsg(0x90,0x14,0x00);
        engine.setValue(group, "filterHighKill", cdmp7000.fx1_state_d1);
        engine.setValue(group, "filterMidKill", cdmp7000.fx1_state_d1);
    }
}

cdmp7000.fx2_enable_d1 = function (channel, control, value, status, group) {

    if ((value == 0x7f) && (cdmp7000.fx2_state_d1 == false)) {
        
        cdmp7000.fx2_state_d1 = true;
        midi.sendShortMsg(0x90, 0x15, 0x7F);
        engine.setValue(group, "flanger", cdmp7000.fx2_state_d1);
    }
    else if ((value == 0x7f) && (cdmp7000.fx2_state_d1 == true)) {
        
        cdmp7000.fx2_state_d1 = false;
        midi.sendShortMsg(0x90,0x15,0x00);
        engine.setValue(group, "flanger", cdmp7000.fx2_state_d1);
    }
}

cdmp7000.fx3_enable_d1 = function (channel, control, value, status, group) {

    if ((value == 0x7f) && (cdmp7000.fx3_state_d1 == false)) {
        
        cdmp7000.fx3_state_d1 = true;
        midi.sendShortMsg(0x90, 0x16, 0x7F);
        engine.brake(1, true);
    }
    else if ((value == 0x7f) && (cdmp7000.fx3_state_d1 == true)) {
        
        cdmp7000.fx3_state_d1 = false;
        midi.sendShortMsg(0x90,0x16,0x00);
        engine.brake(1, false);
    }
}

// Deck 2 efx

cdmp7000.fx1_enable_d2 = function (channel, control, value, status, group) {

    if ((value == 0x7f) && (cdmp7000.fx1_state_d2 == false)) {
        
        cdmp7000.fx1_state_d2 = true;
        midi.sendShortMsg(0x90, 0x14, 0x7F);
        engine.setValue(group, "filterHighKill", cdmp7000.fx1_state_d2);
        engine.setValue(group, "filterMidKill", cdmp7000.fx1_state_d2);
    }
    else if ((value == 0x7f) && (cdmp7000.fx1_state_d2 == true)) {
        
        cdmp7000.fx1_state_d2 = false;
        midi.sendShortMsg(0x90,0x14,0x00);
        engine.setValue(group, "filterHighKill", cdmp7000.fx1_state_d2);
        engine.setValue(group, "filterMidKill", cdmp7000.fx1_state_d2);
    }
}

cdmp7000.fx2_enable_d2 = function (channel, control, value, status, group) {

    if ((value == 0x7f) && (cdmp7000.fx2_state_d2 == false)) {
        
        cdmp7000.fx2_state_d2 = true;
        midi.sendShortMsg(0x90, 0x15, 0x7F);
        engine.setValue(group, "flanger", cdmp7000.fx2_state_d2);
    }
    else if ((value == 0x7f) && (cdmp7000.fx2_state_d2 == true)) {
        
        cdmp7000.fx2_state_d2 = false;
        midi.sendShortMsg(0x90,0x15,0x00);
        engine.setValue(group, "flanger", cdmp7000.fx2_state_d2);
    }
}

cdmp7000.fx3_enable_d2 = function (channel, control, value, status, group) {

    if ((value == 0x7f) && (cdmp7000.fx3_state_d2 == false)) {
        
        cdmp7000.fx3_state_d2 = true;
        midi.sendShortMsg(0x90, 0x16, 0x7F);
        engine.brake(1, true);
    }
    else if ((value == 0x7f) && (cdmp7000.fx3_state_d2 == true)) {
        
        cdmp7000.fx3_state_d2 = false;
        midi.sendShortMsg(0x90,0x16,0x00);
        engine.brake(1, false);
    }
}


// ------------------------------------------
// ---  Load Track - Cue/Play LED Functions   ---
// ------------------------------------------


cdmp7000.LoadTrack = function(channel, control, value, status, group) {

    // Load the selected track in the corresponding deck only if the track is paused

    if(value && engine.getValue(group, "play") != 1)
    {
        engine.setValue(group, "LoadSelectedTrack", 1);

        // Turn on Cue led solid & flash play button (this doesn't flash maybe a connect?)
                       // cue
                       midi.sendShortMsg(0x90,0x01,0x7F);
                       // play
                       midi.sendShortMsg(0x90,0x02,0x7F);

    }
    else engine.setValue(group, "LoadSelectedTrack", 0);

    // (NEW) check song for hotcues set, turn on appropriate led if needed or turn off from previous song
    if(engine.getValue(group, "hotcue_1_enabled") == 1)
    {
     midi.sendShortMsg(0x90,0x05,0x7F);
    } else {
     midi.sendShortMsg(0x90,0x05,0x00);
    }

    if(engine.getValue(group, "hotcue_2_enabled") == 1)
    {
     midi.sendShortMsg(0x90,0x06,0x7F);
    } else {
     midi.sendShortMsg(0x90,0x06,0x00);
    }

    if(engine.getValue(group, "hotcue_3_enabled") == 1)
    {
     midi.sendShortMsg(0x90,0x07,0x7F);
    } else {
     midi.sendShortMsg(0x90,0x07,0x00);
    }

    var currentBpm = engine.getValue(group,'bpm');           
    var currentRange = engine.getValue(group,'rateRange');
    var currentDur = engine.getValue(group,'duration');

    // convert decimal to real number
    currentRange = currentRange*100
    currentRange = Math.round(currentRange);

    currentDur = currentDur*312       // this is inaccurate, varies by 10 seconds or so and never updates

    print( "BPM!:"+currentBpm);  // for debug
    print( "Range!:"+currentRange);  // for debug
    print( "Duration!:"+currentDur);  // for debug
 
        // convert int to string otherwise toInt() will not work
        currentBpm += ''  
        currentRange += ''
        currentDur += ''

        midi.sendSysexMsg(cdmp7000.LCD_BPM.concat(currentBpm.toInt(), 0xF7),9+currentBpm.length); 
        midi.sendSysexMsg(cdmp7000.LCD_RANGE.concat(currentRange.toInt(), 0xF7),11+currentRange.length);
 midi.sendSysexMsg(cdmp7000.LCD_PLAY_POS.concat(currentDur.toInt(), 0x3C, 0x70, 0x6C, 0x61, 0x79, 0x3E, 0xF7),16+currentDur.length);

  
}

// ------------------------------------------
// ---------   Rate Functions   -------------
// ------------------------------------------


cdmp7000.rate_d1 = function (channel, control, value, status, group) {
    var pitchValue = engine.getValue(cdmp7000.firstDeckGroup,'rate');
    var currentBpm = engine.getValue(cdmp7000.firstDeckGroup,'bpm');
        
        pitchValue = pitchValue*10
        pitchValue.toFixed(0)
        pitchValue += '' 
        print( "Deck 1 rate:"+pitchValue);  // for debug    
        midi.sendSysexMsg(cdmp7000.LCD_PITCH.concat(pitchValue.toInt(), 0xF7),11+pitchValue.length);
        // when the pitch slider is changed, we update the bpm as well
        currentBpm += '' 
        midi.sendSysexMsg(cdmp7000.LCD_BPM.concat(currentBpm.toInt(), 0xF7),9+currentBpm.length);
}

cdmp7000.rate_d2 = function (channel, control, value, status, group) {
    var pitchValue = engine.getValue(cdmp7000.secondDeckGroup,'rate');
    var currentBpm = engine.getValue(cdmp7000.secondDeckGroup,'bpm');

        pitchValue = pitchValue*10
        pitchValue.toFixed(0)
        pitchValue += '' 
        print( "Deck 2 rate:"+pitchValue);  // for debug    
        midi.sendSysexMsg(cdmp7000.LCD_PITCH.concat(pitchValue.toInt(), 0xF7),11+pitchValue.length); 
        // when the pitch slider is changed, we update the bpm as well!
        currentBpm += '' 
        midi.sendSysexMsg(cdmp7000.LCD_BPM.concat(currentBpm.toInt(), 0xF7),9+currentBpm.length);
}

cdmp7000.rateRange = function (channel, control, value, status, group) {
   if (value == 0x7f) {
  var currentRange = engine.getValue(group,'rateRange');
  currentRange = currentRange*100;
  currentRange = Math.round(currentRange);


// code to toggle between 8 - 100 range
// there has to be a more efficient way of doing this, maybe external lcd update function
// set, then get, then update
  if (currentRange == "4") {
     engine.setValue(group,'rateRange', 0.08);
     var newRange = engine.getValue(group,'rateRange');
     newRange += ''
     midi.sendSysexMsg(cdmp7000.LCD_RANGE.concat(newRange.toInt(), 0xF7),11+newRange.length);
  }
  if (currentRange == "8") {
     engine.setValue(group,'rateRange', 0.16);
     var newRange = engine.getValue(group,'rateRange');
     newRange += ''
     midi.sendSysexMsg(cdmp7000.LCD_RANGE.concat(newRange.toInt(), 0xF7),11+newRange.length);
  }
  if (currentRange == "16") {
     engine.setValue(group,'rateRange', 0.24);
     var newRange = engine.getValue(group,'rateRange');
     newRange += ''
     midi.sendSysexMsg(cdmp7000.LCD_RANGE.concat(newRange.toInt(), 0xF7),11+newRange.length);
  }
  if (currentRange == "24") {
    engine.setValue(group,'rateRange', 0.50);
     var newRange = engine.getValue(group,'rateRange');
     newRange += ''
    midi.sendSysexMsg(cdmp7000.LCD_RANGE.concat(newRange.toInt(), 0xF7),11+newRange.length);
  }
  if (currentRange == 50) {
    engine.setValue(group,'rateRange', 1.00);
     var newRange = engine.getValue(group,'rateRange');
     newRange += ''
    midi.sendSysexMsg(cdmp7000.LCD_RANGE.concat(newRange.toInt(), 0xF7),11+newRange.length);
  }
  if (currentRange == 100) {
    engine.setValue(group,'rateRange', 0.04);
     var newRange = engine.getValue(group,'rateRange');
     newRange += ''
    midi.sendSysexMsg(cdmp7000.LCD_RANGE.concat(newRange.toInt(), 0xF7),11+newRange.length);
  }


    } // end if val = 0x7f
}



// Reproduces features of Gemini firmware
cdmp7000.setSongLcd = function (control, value) {

if ((control == "hotcue_1_set") && (value == true)) {
       
    message = "<artist><title>Hot Cue 1 is set<album><genre><length>20<index>0";
    midi.sendSysexMsg(cdmp7000.sysex.concat(message.toInt(), 0xF7),4+message.length);
}

if ((control == "hotcue_1_clear") && (value == true)) {
    message = "<artist><title>Hot Cue 1 is clear<album><genre><length>20<index>0";
    midi.sendSysexMsg(cdmp7000.sysex.concat(message.toInt(), 0xF7),4+message.length); 
}

if ((control == "hotcue_2_set") && (value == true)) {
    message = "<artist><title>Hot Cue 2 is set<album><genre><length>20<index>0";
    midi.sendSysexMsg(cdmp7000.sysex.concat(message.toInt(), 0xF7),4+message.length);
}

if ((control == "hotcue_2_clear") && (value == true)) {
    message = "<artist><title>Hot Cue 2 is clear<album><genre><length>20<index>0";
    midi.sendSysexMsg(cdmp7000.sysex.concat(message.toInt(), 0xF7),4+message.length);
}

if ((control == "hotcue_3_set") && (value == true)) {
    message = "<artist><title>Hot Cue 3 is set<album><genre><length>20<index>0";
    midi.sendSysexMsg(cdmp7000.sysex.concat(message.toInt(), 0xF7),4+message.length);
}

if ((control == "hotcue_3_clear") && (value == true)) {
    message = "<artist><title>Hot Cue 3 is clear<album><genre><length>20<index>0";
    midi.sendSysexMsg(cdmp7000.sysex.concat(message.toInt(), 0xF7),4+message.length);
}

if ((control == "vinyl") && (value == true)) {
    message = "<artist><title>Vinyl On<album><genre><length>20<index>0";
    midi.sendSysexMsg(cdmp7000.sysex.concat(message.toInt(), 0xF7),4+message.length);
}

if ((control == "vinyl") && (value == false)) {
    message = "<artist><title>Vinyl Off<album><genre><length>20<index>0";
    midi.sendSysexMsg(cdmp7000.sysex.concat(message.toInt(), 0xF7),4+message.length); 
    }



} // end lcdupdates