-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDJHERCULESMIX-Universal-DJ-scripts.js
81 lines (66 loc) · 2.07 KB
/
DJHERCULESMIX-Universal-DJ-scripts.js
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
function HCUniversalDJ() {};
// ---------- Global variables ----------
HCUniversalDJ.deck={
'[Channel1]': 1,
'[Channel2]': 2
};
// ---------- Functions ----------
// called when the MIDI device is opened & set up
HCUniversalDJ.init = function(id, debugging) {
HCUniversalDJ.id = id;
HCUniversalDJ.allLedOff();
HCUniversalDJ.readFaders();
// Switch-on some LEDs for improve the usability
// midi.sendShortMsg(0x90, 46, 0x7F); // Automix LED
// midi.sendShortMsg(0x90, 14, 0x7F); // Cue deck A LED
// midi.sendShortMsg(0x90, 34, 0x7F); // Cue deck B LED
print ("***** Hercules Universal DJ Control id: \""+id+"\" initialized.");
};
// Called when the MIDI device is closed
HCUniversalDJ.shutdown = function(id) {
HCUniversalDJ.allLedOff();
print ("***** Hercules Universal DJ Control id: \""+id+"\" shutdown.");
};
HCUniversalDJ.allLedOff = function () {
// Switch off all LEDs
// All deck A + 9 generic
for(led=1;led<95;led++) {
midi.sendShortMsg(0x90,led,0);
}
// All deck B
for(led=1;led<86;led++) {
midi.sendShortMsg(0x91,led,0);
}
// Deck A and B total VU meter off
midi.sendShortMsg(0x90,105,0);
midi.sendShortMsg(0x91,105,0);
};
HCUniversalDJ.readFaders = function () {
// reset/resend all fader values
midi.sendShortMsg(0xB0,127,00);
};
HCUniversalDJ.wheelTouch = function (channel, control, value, status,group) {
var deck=HCUniversalDJ.deck[group];
if (value == 0x7F && !engine.isScratching(deck)) {
var alpha = 1.0/8;
var beta = alpha/32;
engine.scratchEnable(deck, 128, 33+1/3, alpha, beta);
print ("start scratch on "+deck);
} else {
engine.scratchDisable(deck);
print ("stop scratch on "+deck);
}
};
HCUniversalDJ.wheelScratch = function (channel, control, value, status,group) {
var deck=HCUniversalDJ.deck[group];
if(!engine.isScratching(deck)) return;
var newValue;
if (value-64 > 0)
newValue = value-128;
else
newValue = value;
engine.scratchTick(deck,newValue);
};
HCUniversalDJ.setMode = function (channel, control, value, status,group) {
print ("setmode on "+group);
};