49
47
engine.connectControl("[Channel1]","loop_enabled","DigitalJockey2Controller.LoopActiveLED1");
50
engine.connectControl("[Channel2]","loop_enabled","DigitalJockey2Controller.LoopActiveLED2");
48
engine.connectControl("[Channel2]","loop_enabled","DigitalJockey2Controller.LoopActiveLED2");
53
50
engine.connectControl("[Channel1]","keylock","DigitalJockey2Controller.OnKeyLockChange1");
54
51
engine.connectControl("[Channel2]","keylock","DigitalJockey2Controller.OnKeyLockChange2");
53
engine.connectControl("[Channel1]","flanger","DigitalJockey2Controller.OnFlangerChange1");
54
engine.connectControl("[Channel2]","flanger","DigitalJockey2Controller.OnFlangerChange2");
56
56
DigitalJockey2Controller.resetLEDs = function(){
59
59
midi.sendShortMsg(0x90, 0x19, DigitalJockey2Controller.ledOff); // Turn on the Play LED1 off
60
60
midi.sendShortMsg(0x90, 0x17, DigitalJockey2Controller.ledOff); //Turn CUP LED1 off
61
61
midi.sendShortMsg(0x90, 0x18, DigitalJockey2Controller.ledOff); //Turn CUE LED1 off
62
midi.sendShortMsg(0x90, 0x5, DigitalJockey2Controller.ledOff); //Turn PFL LED off
62
midi.sendShortMsg(0x90, 0x05, DigitalJockey2Controller.ledOff); //Turn PFL LED off
63
63
midi.sendShortMsg(0x90, 0x14, DigitalJockey2Controller.ledOff); //HighFilterKill
64
64
midi.sendShortMsg(0x90, 0x15, DigitalJockey2Controller.ledOff); //MidFilterKill
65
65
midi.sendShortMsg(0x90, 0x16, DigitalJockey2Controller.ledOff); //LowFilterKill
66
66
midi.sendShortMsg(0x90, 0x1B, DigitalJockey2Controller.ledOff); //disable scratch control
67
67
midi.sendShortMsg(0x90, 0x1A, DigitalJockey2Controller.ledOff); //disable search control
68
midi.sendShortMsg(0x90, 0x1C, DigitalJockey2Controller.ledOff); //disable fx dry/wet control
69
midi.sendShortMsg(0x90, 0x02, DigitalJockey2Controller.ledOff); //Turn KeyLock off
70
midi.sendShortMsg(0x90, 0x12, DigitalJockey2Controller.ledOff); //Turn LED off
71
midi.sendShortMsg(0x90, 0xe, DigitalJockey2Controller.ledOff); //Flanger
72
midi.sendShortMsg(0x90, 0x1A, DigitalJockey2Controller.ledOff); //Search
68
midi.sendShortMsg(0x90, 0x1C, DigitalJockey2Controller.ledOff); //disable fx dry/wet control
69
midi.sendShortMsg(0x90, 0x02, DigitalJockey2Controller.ledOff); //Turn KeyLock off
70
midi.sendShortMsg(0x90, 0x12, DigitalJockey2Controller.ledOff); //Loop1 LED Off
71
midi.sendShortMsg(0x90, 0x0e, DigitalJockey2Controller.ledOff); //Flanger
72
midi.sendShortMsg(0x90, 0x1A, DigitalJockey2Controller.ledOff); //Search
73
73
midi.sendShortMsg(0x90, 0x1b, DigitalJockey2Controller.ledOff);//Scratch
82
82
midi.sendShortMsg(0x90, 0x52, DigitalJockey2Controller.ledOff); //LowFilterKill
83
83
midi.sendShortMsg(0x90, 0x57, DigitalJockey2Controller.ledOff); //disable scratch control
84
84
midi.sendShortMsg(0x90, 0x56, DigitalJockey2Controller.ledOff); //disable search control
85
midi.sendShortMsg(0x90, 0x58, DigitalJockey2Controller.ledOff); //disable fx dry/wet control
86
midi.sendShortMsg(0x90, 0x3E, DigitalJockey2Controller.ledOff); //Turn KeyLock2 off
87
midi.sendShortMsg(0x90, 0x4E, DigitalJockey2Controller.ledOff); //Loop2 LE
88
midi.sendShortMsg(0x90, 0x45, DigitalJockey2Controller.ledOff); //Flanger
89
midi.sendShortMsg(0x90, 0x56, DigitalJockey2Controller.ledOff); //Search
90
midi.sendShortMsg(0x90, 0x57, DigitalJockey2Controller.ledOff);//Scratch
85
midi.sendShortMsg(0x90, 0x58, DigitalJockey2Controller.ledOff); //disable fx dry/wet control
86
midi.sendShortMsg(0x90, 0x3E, DigitalJockey2Controller.ledOff); //Turn KeyLock2 off
87
midi.sendShortMsg(0x90, 0x4E, DigitalJockey2Controller.ledOff); //Loop2 LED Off
88
midi.sendShortMsg(0x90, 0x45, DigitalJockey2Controller.ledOff); //Flanger
89
midi.sendShortMsg(0x90, 0x56, DigitalJockey2Controller.ledOff); //Search
90
midi.sendShortMsg(0x90, 0x57, DigitalJockey2Controller.ledOff);//Scratch
93
92
DigitalJockey2Controller.shutdown = function(id){
94
93
//Turn all LEDs off by using init function
95
94
DigitalJockey2Controller.resetLEDs();
98
98
DigitalJockey2Controller.playButton1 = function (channel, control, value) {
99
99
DigitalJockey2Controller.playTrack(1, control, value);
102
102
DigitalJockey2Controller.playButton2 = function (channel, control, value) {
103
103
DigitalJockey2Controller.playTrack(2, control, value);
105
106
DigitalJockey2Controller.playTrack = function (channel, control, value) {
106
//If no song is loaded
107
if (engine.getValue("[Channel"+channel+"]", "duration") == 0) {
110
//If a CUP is active, PlayButtons are disabled
111
var isCupActive = engine.getValue("[Channel"+channel+"]","cue_default");
112
if(isCupActive == true)
115
var currentlyPlaying = engine.getValue("[Channel"+channel+"]","play");
117
108
* We immediately want to start and stop playing as soon as play button has been pressed
118
109
* KeyUp events are out of interest in this case
120
111
if(value == DigitalJockey2Controller.keyPressed){
112
//If no song is loaded
113
if (engine.getValue("[Channel"+channel+"]", "duration") == 0) {
116
var currentlyPlaying = engine.getValue("[Channel"+channel+"]","play");
122
117
if (currentlyPlaying == 1) { // If currently playing
123
118
engine.setValue("[Channel"+channel+"]","play",0); // Stop
124
midi.sendShortMsg(0x90, control, DigitalJockey2Controller.ledOff); // Turn off the Play LED
120
midi.sendShortMsg(0x90, 0x17, DigitalJockey2Controller.ledOff); //Turn CUP LED off
121
DigitalJockey2Controller.CUP_Button1_IsActive = false;
123
else if(channel == 2){
124
midi.sendShortMsg(0x90, 0x53, DigitalJockey2Controller.ledOff); //Turn CUP LED off
125
DigitalJockey2Controller.CUP_Button2_IsActive = false;
126
128
else { // If not currently playing,
127
129
engine.setValue("[Channel"+channel+"]","play",1); // Start
128
midi.sendShortMsg(0x90, control, DigitalJockey2Controller.ledOn); // Turn on the Play LED
132
134
DigitalJockey2Controller.CueButton1 = function (channel, control, value) {
133
135
DigitalJockey2Controller.Cue(1, control, value);
149
150
midi.sendShortMsg(0x90, 0x17, DigitalJockey2Controller.ledOff); //Turn CUP LED off
150
151
DigitalJockey2Controller.CUP_Button1_IsActive = false;
153
else if(channel == 2){
153
154
midi.sendShortMsg(0x90, 0x55, DigitalJockey2Controller.ledOff); // Turn on the Play LED off
154
155
midi.sendShortMsg(0x90, 0x53, DigitalJockey2Controller.ledOff); //Turn CUP LED off
155
156
DigitalJockey2Controller.CUP_Button2_IsActive = false;
159
midi.sendShortMsg(0x90, control, DigitalJockey2Controller.ledOn);
162
if(value == DigitalJockey2Controller.keyUp){
160
else if(value == DigitalJockey2Controller.keyUp){
163
161
engine.setValue("[Channel"+channel+"]","cue_default",0);
165
midi.sendShortMsg(0x90, control, DigitalJockey2Controller.ledOff);
173
168
DigitalJockey2Controller.CuePlayButton2 = function (channel, control, value) {
174
169
DigitalJockey2Controller.CuePlay(2, control, value);
172
DigitalJockey2Controller.CuePlayButton1 = function (channel, control, value) {
173
DigitalJockey2Controller.CuePlay(1, control, value);
175
DigitalJockey2Controller.CuePlayButton2 = function (channel, control, value) {
176
DigitalJockey2Controller.CuePlay(2, control, value);
176
178
DigitalJockey2Controller.CuePlay = function (channel, control, value) {
177
//If no song is loaded
178
if (engine.getValue("[Channel"+channel+"]", "duration") == 0) {
181
var isCupActive = engine.getValue("[Channel"+channel+"]","cue_default");
182
var currentlyPlaying = engine.getValue("[Channel"+channel+"]","play");
184
179
// As soon as we press CUP, execute CUP Logic
185
180
if(value == DigitalJockey2Controller.keyPressed){
186
//If CUP is active, we disable and enable CUP in sequence as a user would do
187
if(isCupActive == 1 || currentlyPlaying == 0){
188
//print ("isCUPActive" + isCupActive);
189
//print ("isPlaying" + currentlyPlaying);
191
if(isCupActive == 1){ //diable CUP
192
engine.setValue("[Channel"+channel+"]","cue_default",0);
194
midi.sendShortMsg(0x90, control, DigitalJockey2Controller.ledOff);
195
midi.sendShortMsg(0x90, 0x55, DigitalJockey2Controller.ledOff); // Turn on the Play LED off
197
DigitalJockey2Controller.CUP_Button1_IsActive = false;
199
DigitalJockey2Controller.CUP_Button2_IsActive = false;
201
if(currentlyPlaying == 0){
202
engine.setValue("[Channel"+channel+"]","cue_default",1);
203
midi.sendShortMsg(0x90, 0x55, DigitalJockey2Controller.ledOff); // Turn on the Play LED off
205
midi.sendShortMsg(0x90, control, DigitalJockey2Controller.ledOn);
207
DigitalJockey2Controller.CUP_Button1_IsActive = true;
209
DigitalJockey2Controller.CUP_Button2_IsActive = true;
213
//If track is playing, CUP = CUE
214
engine.setValue("[Channel"+channel+"]","cue_default",1);
215
engine.setValue("[Channel"+channel+"]","cue_default",0);
216
engine.setValue("[Channel"+channel+"]","player",0);
181
//If no song is loaded
182
if (engine.getValue("[Channel"+channel+"]", "duration") == 0) {
185
var currentlyPlaying = engine.getValue("[Channel"+channel+"]","play");
186
//print ("isPlaying" + currentlyPlaying);
187
if(currentlyPlaying == 1){
217
188
if(channel == 1) {
218
189
midi.sendShortMsg(0x90, 0x19, DigitalJockey2Controller.ledOff); // Turn on the Play LED off
219
midi.sendShortMsg(0x90, 0x17, DigitalJockey2Controller.ledOff); //Turn CUP LED off
220
DigitalJockey2Controller.CUP_Button1_IsActive = false;
191
else if(channel == 2){
223
192
midi.sendShortMsg(0x90, 0x55, DigitalJockey2Controller.ledOff); // Turn on the Play LED off
224
midi.sendShortMsg(0x90, 0x53, DigitalJockey2Controller.ledOff); //Turn CUP LED off
225
DigitalJockey2Controller.CUP_Button2_IsActive = false;
196
engine.setValue("[Channel"+channel+"]","cue_default",1);
197
engine.setValue("[Channel"+channel+"]","cue_default",0);
198
engine.setValue("[Channel"+channel+"]","play",1);
201
DigitalJockey2Controller.CUP_Button1_IsActive = true;
203
else if(channel == 2){
204
DigitalJockey2Controller.CUP_Button2_IsActive = true;
781
745
engine.setValue(group,"reloop_exit",0);
747
var actBeatLoop = engine.getValue(group, "beatloop");
748
print("ReloopExit.actBeatLoop=" + actBeatLoop);
749
if (actBeatLoop != "0") {
750
print("Set BeatLoop To Zero");
751
engine.setValue(group,"beatloop","0");
784
754
DigitalJockey2Controller.BeatLoop = function (channel, control, value, status, group) {
785
755
if(value == DigitalJockey2Controller.keyPressed){
786
midi.sendShortMsg(status, control, DigitalJockey2Controller.ledOn); //Turn LED on
788
engine.setValue(group,"beatloop_4",1);
790
engine.setValue(group,"beatloop_4",1);
756
midi.sendShortMsg(status, control, DigitalJockey2Controller.ledOn); //Turn LED on
757
engine.setValue(group,"beatloop","4");
793
midi.sendShortMsg(status, control, DigitalJockey2Controller.ledOff); //Turn LED on
760
midi.sendShortMsg(status, control, DigitalJockey2Controller.ledOff); //Turn LED off
797
763
DigitalJockey2Controller.LoopActiveLED1 = function (value){
798
764
//if loop is active, we exit the loop
800
766
midi.sendShortMsg(0x90, 0x12, DigitalJockey2Controller.ledOn); //Turn LED on
803
midi.sendShortMsg(0x90, 0x12, DigitalJockey2Controller.ledOff); //Turn LED on
769
midi.sendShortMsg(0x90, 0x12, DigitalJockey2Controller.ledOff); //Turn LED off
905
865
midi.sendShortMsg(0x90, 0x3E, DigitalJockey2Controller.ledOff); //Turn KeyLock off
869
DigitalJockey2Controller.OnFlangerChange1 = function(value){
871
midi.sendShortMsg(0x90, 0x0e, DigitalJockey2Controller.ledOn); //Turn LED on
874
midi.sendShortMsg(0x90, 0x0e, DigitalJockey2Controller.ledOff); //Turn LED off
877
DigitalJockey2Controller.OnFlangerChange2 = function(value){
879
midi.sendShortMsg(0x90, 0x45, DigitalJockey2Controller.ledOn); //Turn LED on
882
midi.sendShortMsg(0x90, 0x45, DigitalJockey2Controller.ledOff); //Turn LED off
886
DigitalJockey2Controller.LoopPlusMinusChannel1 = function (channel, control, value, status, group) {
887
DigitalJockey2Controller.LoopPlusMinus(channel, control, value, status, group);
889
DigitalJockey2Controller.LoopPlusMinusChannel2 = function (channel, control, value, status, group) {
890
DigitalJockey2Controller.LoopPlusMinus(channel, control, value, status, group);
893
DigitalJockey2Controller.beatloops = ["0.125", "0.25", "0.5", "1", "2", "4", "8", "16"];
895
DigitalJockey2Controller.getPrevBeatLoop = function (beatloop) {
897
for (i = 0; i < DigitalJockey2Controller.beatloops.length; i++) {
898
if (DigitalJockey2Controller.beatloops[i] == beatloop) {
900
return DigitalJockey2Controller.beatloops[i - 1];
902
return DigitalJockey2Controller.beatloops[0];
908
DigitalJockey2Controller.getNextBeatLoop = function (beatloop) {
910
for (i = 0; i < DigitalJockey2Controller.beatloops.length; i++) {
911
if (DigitalJockey2Controller.beatloops[i] == beatloop) {
912
if (i < DigitalJockey2Controller.beatloops.length - 1)
913
return DigitalJockey2Controller.beatloops[i + 1];
915
return DigitalJockey2Controller.beatloops[DigitalJockey2Controller.beatloops.length - 1];
921
DigitalJockey2Controller.LoopPlusMinus = function (channel, control, value, status, group) {
922
var actBeatLoop = engine.getValue(group, "beatloop");
923
print("LoopPlusMinus.actBeatLoop=" + actBeatLoop);
924
if (actBeatLoop != "0") {
926
var prevBeatLoop = DigitalJockey2Controller.getPrevBeatLoop(actBeatLoop);
927
print("LoopPlusMinus.prevBeatLoop=" + prevBeatLoop);
928
engine.setValue(group,"beatloop",prevBeatLoop);
930
else if (value == 0x41) {
931
var nextBeatLoop = DigitalJockey2Controller.getNextBeatLoop(actBeatLoop);
932
print("LoopPlusMinus.nextBeatLoop=" + nextBeatLoop );
933
engine.setValue(group,"beatloop",nextBeatLoop);
b'\\ No newline at end of file'