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
|
/****************************************************************/
/* DJ-Tech DJM101 controller script */
/* For Mixxx version 1.11 */
/* Author: zestoi */
/****************************************************************/
DJTechDJM101 = {};
DJTechDJM101.vumeter = {};
DJTechDJM101.vumeter[1] = 0;
DJTechDJM101.vumeter[2] = 0;
DJTechDJM101.init = function(id) {
DJTechDJM101.vumeter_select(true);
engine.connectControl("[Master]", "VuMeterL", "DJTechDJM101.VuMeterMasterL");
engine.connectControl("[Master]", "VuMeterR", "DJTechDJM101.VuMeterMasterR");
engine.connectControl("[Channel1]", "VuMeter", "DJTechDJM101.VuMeterDeck1");
engine.connectControl("[Channel2]", "VuMeter", "DJTechDJM101.VuMeterDeck2");
engine.connectControl("[Channel1]", "pfl", "DJTechDJM101.pfl");
engine.connectControl("[Channel2]", "pfl", "DJTechDJM101.pfl");
}
DJTechDJM101.shutdown = function() {}
//
// change output to vumeter and reset
//
DJTechDJM101.vumeter_select = function(master)
{
DJTechDJM101.vumeter_master_mode = master;
DJTechDJM101.update_vumeter(1, 0);
DJTechDJM101.update_vumeter(2, 0);
}
//
// select what data is sent to the vumeter
//
DJTechDJM101.vumeter_select_master = function(channel, control, value, status, group)
{
if (value > 0) {
DJTechDJM101.vumeter_select(true);
}
}
DJTechDJM101.vumeter_select_pfl = function(channel, control, value, status, group)
{
if (value > 0) {
DJTechDJM101.vumeter_select(false);
}
}
//
// update a vumeter channel
//
DJTechDJM101.update_vumeter = function(channel, value)
{
var newval = parseInt(value * 0xf7);
if (DJTechDJM101.vumeter[channel] != newval) {
DJTechDJM101.vumeter[channel] = newval;
//
// a bit nasty - four different cc's depending on master/pfl mode and which channel
//
midi.sendShortMsg(0xb0, DJTechDJM101.vumeter_master_mode ? 0x4f + channel : 0x51 + channel, newval);
}
}
//
// only feed the correct levels to each channel of the vumeter
//
DJTechDJM101.VuMeterMasterL = function(value)
{
if (DJTechDJM101.vumeter_master_mode == false) return;
DJTechDJM101.update_vumeter(1, value);
}
DJTechDJM101.VuMeterMasterR = function(value)
{
if (DJTechDJM101.vumeter_master_mode == false) return;
DJTechDJM101.update_vumeter(2, value);
}
DJTechDJM101.VuMeterDeck1 = function(value)
{
if (DJTechDJM101.vumeter_master_mode == true) return;
DJTechDJM101.update_vumeter(1, value);
}
DJTechDJM101.VuMeterDeck2 = function(value)
{
if (DJTechDJM101.vumeter_master_mode == true) return;
DJTechDJM101.update_vumeter(2, value);
}
//
// led feedback for headphone cue buttons
//
DJTechDJM101.pfl = function(value, group)
{
// has to be a noteon msg in both case and seems more reliable issuing 0x7f for 'on' amd 0x0 for 'off'
midi.sendShortMsg(0x90, group == "[Channel1]" ? 0x21 : 0x22, value > 0 ? 0x7f : 0);
}
|