~ywwg/mixxx/features_library

« back to all changes in this revision

Viewing changes to mixxx/res/midi/M-Audio-Xponent-scripts.js

  • Committer: Owen Williams
  • Date: 2010-09-09 17:24:57 UTC
  • mfrom: (2438.2.5 mixxx-trunk)
  • Revision ID: owen@ywwg-20100909172457-1spfpj7rratdbjwt
* merge from trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function MaudioXponent () {}
 
2
 
 
3
// ----------   Global variables    ----------
 
4
 
 
5
MaudioXponent.id = "";   // The ID for the particular device being controlled for use in debugging, set at init time
 
6
MaudioXponent.off = 0x80;
 
7
MaudioXponent.on = 0x90;
 
8
MaudioXponent.mastermeter = 0;  //1 for master meter, 0 for channel meter
 
9
MaudioXponent.flashprogress = 8; //flash duration on progress meters
 
10
MaudioXponent.leds = {
 
11
  "play": 0x24,
 
12
  "cue": 0x23,
 
13
  "back": 0x21,
 
14
  "fwd": 0x22,
 
15
  "in": 0x29,
 
16
  "out": 0x2B,
 
17
  "loop": 0x2A,
 
18
  "loop1": 0x25,
 
19
  "loop2": 0x26,
 
20
  "loop4": 0x27,
 
21
  "loop8": 0x28,
 
22
  "leftkey": 0x1C,
 
23
  "rightkey": 0x1D,
 
24
  "key": 0x1E,
 
25
  "pluskey": 0x1F,
 
26
  "minkey": 0x20,
 
27
  "cue1": 0x17,
 
28
  "cue2": 0x18,
 
29
  "cue3": 0x19,
 
30
  "cue4": 0x1A,
 
31
  "cue5": 0x1B,
 
32
  "fx1": 0x0C,
 
33
  "fx2": 0x0D,
 
34
  "fx3": 0x0E,
 
35
  "fx4": 0x0F,
 
36
  "leftp": 0x10,
 
37
  "rightp": 0x11,
 
38
  "bigx": 0x12,
 
39
  "big-": 0x13,
 
40
  "head": 0x14,
 
41
  "scratch": 0x15,
 
42
  "fadarbutton": 0x07,
 
43
  "sync": 0x02,
 
44
  "low": 0x08,
 
45
  "middle": 0x09,
 
46
  "hight": 0x0A,
 
47
  "gain": 0x0B,
 
48
  "shift": 0x2C
 
49
};
 
50
MaudioXponent.binleds = {
 
51
  8: "filterLowKill",
 
52
  9: "filterMidKill",
 
53
  10: "filterHighKill",
 
54
  19: "reverse",
 
55
  20: "pfl",
 
56
  33: "back",
 
57
  34: "fwd",
 
58
  36: "play"
 
59
};
 
60
MaudioXponent.hotcues = {
 
61
  23: 1,
 
62
  24: 2,
 
63
  25: 3,
 
64
  26: 4,
 
65
  27: 5
 
66
};
 
67
MaudioXponent.timer = [-1];  // Temporary storage of timer IDs
 
68
MaudioXponent.state = { 
 
69
    "flashes" : 0, 
 
70
    "faderpos" : 0, 
 
71
    "shift1" : 0, 
 
72
    "shift2" : 0, 
 
73
    "scrmode1" : 0, 
 
74
    "scrmode2" : 0, 
 
75
    "plnumberpos" : 0, 
 
76
    "plnumberneg" : 0,
 
77
    "scratching1" : 0,
 
78
    "scratching2" : 0,
 
79
}; // Temporary state variables
 
80
 
 
81
// ----------   Functions    ----------
 
82
 
 
83
MaudioXponent.init = function (id) {    // called when the MIDI device is opened & set up
 
84
  
 
85
  //This code light on all leds and then light off
 
86
  midi.sendShortMsg(0xB3,0x14,0x00);
 
87
  midi.sendShortMsg(0xB3,0x15,0x00);
 
88
  for (var led in MaudioXponent.leds) {
 
89
    midi.sendShortMsg(MaudioXponent.on,MaudioXponent.leds[led],0x01);
 
90
    midi.sendShortMsg(MaudioXponent.on + 1,MaudioXponent.leds[led],0x01);
 
91
    MaudioXponent.pauseScript(15);
 
92
  }
 
93
  midi.sendShortMsg(0xB3,0x12,0x7F);
 
94
  midi.sendShortMsg(0xB3,0x13,0x7F);
 
95
  midi.sendShortMsg(0xB3,0x14,0x7F);
 
96
  midi.sendShortMsg(0xB3,0x15,0x7F);
 
97
  MaudioXponent.pauseScript(500);
 
98
  for (var led in MaudioXponent.leds) {
 
99
    midi.sendShortMsg(MaudioXponent.on,MaudioXponent.leds[led],0x00);
 
100
    midi.sendShortMsg(MaudioXponent.on + 1,MaudioXponent.leds[led],0x00);
 
101
    MaudioXponent.pauseScript(15);
 
102
  }
 
103
  midi.sendShortMsg(0xB3,0x14,0x00);
 
104
  midi.sendShortMsg(0xB3,0x15,0x00);
 
105
  //end of light on all leds
 
106
 
 
107
  MaudioXponent.flashdur1 = 0;
 
108
  MaudioXponent.flashdur2 = 0;
 
109
  engine.connectControl("[Channel1]","visual_playposition","MaudioXponent.playPositionMeter1");
 
110
  engine.connectControl("[Channel2]","visual_playposition","MaudioXponent.playPositionMeter2");
 
111
  if (MaudioXponent.mastermeter == 1) {
 
112
    engine.connectControl("[Master]","VuMeterL","MaudioXponent.volumeLEDs1");
 
113
    engine.connectControl("[Master]","VuMeterR","MaudioXponent.volumeLEDs2");
 
114
  } else {
 
115
    engine.connectControl("[Channel1]","VuMeter","MaudioXponent.volumeLEDs1");
 
116
    engine.connectControl("[Channel2]","VuMeter","MaudioXponent.volumeLEDs2");
 
117
  }
 
118
 
 
119
  engine.connectControl("[Channel1]","hotcue_1_enabled","MaudioXponent.hotcue");
 
120
  engine.connectControl("[Channel1]","hotcue_2_enabled","MaudioXponent.hotcue");
 
121
  engine.connectControl("[Channel1]","hotcue_3_enabled","MaudioXponent.hotcue");
 
122
  engine.connectControl("[Channel1]","hotcue_4_enabled","MaudioXponent.hotcue");
 
123
  engine.connectControl("[Channel1]","hotcue_5_enabled","MaudioXponent.hotcue");
 
124
  engine.connectControl("[Channel2]","hotcue_1_enabled","MaudioXponent.hotcue");
 
125
  engine.connectControl("[Channel2]","hotcue_2_enabled","MaudioXponent.hotcue");
 
126
  engine.connectControl("[Channel2]","hotcue_3_enabled","MaudioXponent.hotcue");
 
127
  engine.connectControl("[Channel2]","hotcue_4_enabled","MaudioXponent.hotcue");
 
128
  engine.connectControl("[Channel2]","hotcue_5_enabled","MaudioXponent.hotcue");
 
129
 
 
130
  //engine.connectControl("[Channel1]","bpm","MaudioXponent.bpmsync");
 
131
 
 
132
};
 
133
 
 
134
MaudioXponent.wheel = function (channel, control, value, status) {
 
135
    var currentdeck = channel+1;
 
136
        
 
137
    // In either case, register the movement
 
138
 
 
139
    if (MaudioXponent.state["shift"+currentdeck] == 1) {
 
140
        if (value > 64) {
 
141
            MaudioXponent.state["plnumberpos"]++;
 
142
            if (MaudioXponent.state["plnumberpos"] % 12 == 0) {
 
143
                engine.setValue("[Playlist]","SelectTrackKnob",1);
 
144
            }
 
145
        } else if (value < 64) {
 
146
            MaudioXponent.state["plnumberneg"]++;
 
147
            if (MaudioXponent.state["plnumberneg"] % 12 == 0) {
 
148
                engine.setValue("[Playlist]","SelectTrackKnob",-1);
 
149
            }  
 
150
        }
 
151
    }else{
 
152
        if (MaudioXponent.state["scratching"+currentdeck] == 1) { //scratch mode on
 
153
            engine.scratchTick(currentdeck, value-64);
 
154
        } else {  //normal wheel mode
 
155
            engine.setValue("[Channel"+currentdeck+"]", "jog", (value-64)*4);
 
156
        }
 
157
    }
 
158
};
 
159
 
 
160
MaudioXponent.wheelbuton = function(channel, control, value, status) {
 
161
    var currentdeck = channel+1;
 
162
    if (MaudioXponent.state["scrmode"+currentdeck] == 1) { //scratch mode on
 
163
        engine.scratchEnable(currentdeck, 3*128, 33+1/3, 1.0/8, (1.0/8)/32);
 
164
        MaudioXponent.state["scratching"+currentdeck] = true;
 
165
    }
 
166
};
 
167
 
 
168
MaudioXponent.wheelbutoff = function(channel, control, value, status) {
 
169
    var currentdeck = channel+1;
 
170
    engine.scratchDisable (currentdeck);
 
171
    MaudioXponent.state["scratching"+currentdeck] = false;
 
172
};
 
173
 
 
174
MaudioXponent.pauseScript = function(ms) {
 
175
    startDate = new Date();
 
176
    currentDate = null;
 
177
    while(currentDate-startDate < ms) currentDate = new Date();
 
178
};
 
179
 
 
180
MaudioXponent.playPositionMeter1 = function(value) {
 
181
  if (value >= 0.75) {
 
182
    MaudioXponent.flashdur1++;;
 
183
    if (MaudioXponent.flashdur1 == MaudioXponent.flashprogress) {
 
184
      midi.sendShortMsg(0xB3,0x14,0x00);
 
185
    }
 
186
    if (MaudioXponent.flashdur1 >= MaudioXponent.flashprogress*2) {
 
187
      midi.sendShortMsg(0xB3,0x14,MaudioXponent.convert(value));
 
188
      MaudioXponent.flashdur1 = 0;
 
189
    }
 
190
  }else{
 
191
    midi.sendShortMsg(0xB3,0x14,MaudioXponent.convert(value));
 
192
  }
 
193
};
 
194
 
 
195
MaudioXponent.playPositionMeter2 = function(value) {
 
196
  if (value >= 0.75) {
 
197
    MaudioXponent.flashdur2++;;
 
198
    if (MaudioXponent.flashdur2 == MaudioXponent.flashprogress) {
 
199
      midi.sendShortMsg(0xB3,0x15,0x00);
 
200
    }
 
201
    if (MaudioXponent.flashdur2 >= MaudioXponent.flashprogress*2) {
 
202
      midi.sendShortMsg(0xB3,0x15,MaudioXponent.convert(value));
 
203
      MaudioXponent.flashdur2 = 0;
 
204
    }
 
205
  }else{
 
206
    midi.sendShortMsg(0xB3,0x15,MaudioXponent.convert(value));
 
207
  }
 
208
};
 
209
 
 
210
MaudioXponent.volumeLEDs1 = function(value) {
 
211
  midi.sendShortMsg(0xB3,0x12,MaudioXponent.convert(value));
 
212
};
 
213
 
 
214
MaudioXponent.volumeLEDs2 = function(value) {
 
215
  midi.sendShortMsg(0xB3,0x13,MaudioXponent.convert(value));
 
216
};
 
217
 
 
218
MaudioXponent.convert = function(value) {
 
219
  value = value*127;
 
220
  value = value.toFixed(0);
 
221
  value = value.toString(16);
 
222
  return (value);
 
223
};
 
224
 
 
225
MaudioXponent.actbin = function(channel, control, value, status) {    // Generic binary button
 
226
    var currentdeck = channel+1;
 
227
    var activenow = engine.getValue("[Channel"+currentdeck+"]",MaudioXponent.binleds[control]);
 
228
    if (activenow == 1) {    // If currently active
 
229
        engine.setValue("[Channel"+currentdeck+"]",MaudioXponent.binleds[control],0);    // Stop
 
230
        midi.sendShortMsg(MaudioXponent.off + channel,control,0x00);    // Turn off the LED
 
231
    }else {    // If not currently active
 
232
        engine.setValue("[Channel"+currentdeck+"]",MaudioXponent.binleds[control],1);    // Start
 
233
        midi.sendShortMsg(MaudioXponent.on + channel,control,0x01);    // Turn on the LED
 
234
    }
 
235
};
 
236
 
 
237
MaudioXponent.actbinstop = function(channel, control, value, status) {    // Generic binary button
 
238
    print ("sono sulla stop");
 
239
    var currentdeck = channel+1;
 
240
    engine.setValue("[Channel"+currentdeck+"]",MaudioXponent.binleds[control],0);    // Stop
 
241
    midi.sendShortMsg(MaudioXponent.off + channel,control,0x00);    // Turn off the LED
 
242
};
 
243
 
 
244
MaudioXponent.hotcue = function(channel, control, value, status) {    // Generic binary button
 
245
    var channelnow = 0;
 
246
    if (control == "[Channel2]") {
 
247
      channelnow = 1;
 
248
    }
 
249
    switch (value) {
 
250
      case "hotcue_1_enabled":
 
251
          if (channel == 1){
 
252
              midi.sendShortMsg(MaudioXponent.on + channelnow,0x17,0x01);    // Turn on the LED
 
253
          }else{
 
254
              midi.sendShortMsg(MaudioXponent.on + channelnow,0x17,0x00);    // Turn off the LED
 
255
          }
 
256
      break;
 
257
      case "hotcue_2_enabled":
 
258
          if (channel == 1){
 
259
              midi.sendShortMsg(MaudioXponent.on + channelnow,0x18,0x01);    // Turn on the LED
 
260
          }else{
 
261
              midi.sendShortMsg(MaudioXponent.on + channelnow,0x18,0x00);    // Turn off the LED
 
262
          }
 
263
      break;
 
264
      case "hotcue_3_enabled":
 
265
          if (channel == 1){
 
266
              midi.sendShortMsg(MaudioXponent.on + channelnow,0x19,0x01);    // Turn on the LED
 
267
          }else{
 
268
              midi.sendShortMsg(MaudioXponent.on + channelnow,0x19,0x00);    // Turn off the LED
 
269
          }
 
270
      break;
 
271
      case "hotcue_4_enabled":
 
272
          if (channel == 1){
 
273
              midi.sendShortMsg(MaudioXponent.on + channelnow,0x1A,0x01);    // Turn on the LED
 
274
          }else{
 
275
              midi.sendShortMsg(MaudioXponent.on + channelnow,0x1A,0x00);    // Turn off the LED
 
276
          }
 
277
      break;
 
278
      case "hotcue_5_enabled":
 
279
          if (channel == 1){
 
280
              midi.sendShortMsg(MaudioXponent.on + channelnow,0x1B,0x01);    // Turn on the LED
 
281
          }else{
 
282
              midi.sendShortMsg(MaudioXponent.on + channelnow,0x1B,0x00);    // Turn off the LED
 
283
          }
 
284
      break;
 
285
    }
 
286
};
 
287
 
 
288
MaudioXponent.hotcueset = function(channel, control, value, status) {
 
289
    //MaudioXponent.debug(channel, control, value, status)
 
290
    var currentdeck = channel+1;
 
291
    if (MaudioXponent.state["shift"+currentdeck] == 1) {
 
292
        engine.setValue("[Channel"+currentdeck+"]","hotcue_"+MaudioXponent.hotcues[control]+"_clear",1);
 
293
    }else{
 
294
        engine.setValue("[Channel"+currentdeck+"]","hotcue_"+MaudioXponent.hotcues[control]+"_activate",1);
 
295
    }
 
296
};
 
297
 
 
298
MaudioXponent.loopin = function(channel, control, value, status) {
 
299
    //MaudioXponent.debug(channel, control, value, status)
 
300
    var currentdeck = channel+1;
 
301
    engine.setValue("[Channel"+currentdeck+"]","loop_in",1);
 
302
    midi.sendShortMsg(MaudioXponent.on + channel,0x29,0x01);
 
303
 
 
304
    MaudioXponent.state["flashes"] = 0;  // initialize number of flashes
 
305
    MaudioXponent.timer[0] = engine.beginTimer(250,"MaudioXponent.flashled("+ channel +",\"0x2B\")");
 
306
};
 
307
 
 
308
MaudioXponent.loopout = function(channel, control, value, status) {
 
309
    //MaudioXponent.debug(channel, control, value, status)
 
310
    var currentdeck = channel+1;
 
311
    engine.setValue("[Channel"+currentdeck+"]","loop_out",1);
 
312
    if (MaudioXponent.timer[0] != -1) engine.stopTimer(MaudioXponent.timer[0]);
 
313
    midi.sendShortMsg(MaudioXponent.on + channel,0x2B,0x01);    // Turn on the LED
 
314
    MaudioXponent.timer[1] = engine.beginTimer(250,"MaudioXponent.flashled("+ channel +",\"0x2A\")");
 
315
};
 
316
 
 
317
MaudioXponent.loopexit = function(channel, control, value, status) {
 
318
    var currentdeck = channel+1;
 
319
    var activenow = engine.getValue("[Channel"+currentdeck+"]","reloop_exit");
 
320
    if (activenow == 1) {    // If currently active
 
321
        print ("dentro loop");
 
322
    }else {    // If not currently active
 
323
        print ("fuori loop");
 
324
    }
 
325
    engine.setValue("[Channel"+currentdeck+"]","reloop_exit",1);
 
326
    //midi.sendShortMsg(MaudioXponent.on + channel,0x2A,0x01);    // Turn on the LED
 
327
};
 
328
 
 
329
MaudioXponent.flashled = function (channel, control) {
 
330
    MaudioXponent.state["flashes"]++;
 
331
    if (MaudioXponent.state["flashes"] % 2 == 0) {
 
332
        midi.sendShortMsg(MaudioXponent.on + channel,control,0x01);    // Turn on the LED
 
333
    }else {
 
334
        midi.sendShortMsg(MaudioXponent.on + channel,control,0x00);    // Turn off the LED
 
335
    }
 
336
};
 
337
 
 
338
MaudioXponent.faderbuttonon = function(channel, control, value, status) {
 
339
    //script.debug(channel, control, value, status);
 
340
    MaudioXponent.state["faderpos"] = engine.getValue("[Master]","crossfader");
 
341
    if (MaudioXponent.state["faderpos"] <= -0.90 && channel == 1) {
 
342
      midi.sendShortMsg(MaudioXponent.on + channel,control,0x01);    // Turn on the LED
 
343
      engine.setValue("[Master]","crossfader",0);
 
344
    }else if (MaudioXponent.state["faderpos"] >= 0.90 && channel == 0) {
 
345
      midi.sendShortMsg(MaudioXponent.on + channel,control,0x01);    // Turn on the LED
 
346
      engine.setValue("[Master]","crossfader",0);
 
347
    }
 
348
};
 
349
 
 
350
MaudioXponent.faderbuttonoff = function(channel, control, value, status) {
 
351
    //script.debug(channel, control, value, status);
 
352
    if (MaudioXponent.state["faderpos"] <= -0.90 && channel == 1) {
 
353
      midi.sendShortMsg(MaudioXponent.on + channel,control,0x00);    // Turn off the LED
 
354
      engine.setValue("[Master]","crossfader",MaudioXponent.state["faderpos"]);
 
355
    }else if (MaudioXponent.state["faderpos"] >= 0.90 && channel == 0) {
 
356
      midi.sendShortMsg(MaudioXponent.on + channel,control,0x00);    // Turn off the LED
 
357
      engine.setValue("[Master]","crossfader",MaudioXponent.state["faderpos"]);
 
358
    }
 
359
};
 
360
 
 
361
MaudioXponent.bpmsync = function(channel, control, value) {
 
362
    print (channel);
 
363
    print (control);
 
364
};
 
365
 
 
366
MaudioXponent.pitch = function(channel, control, value, status) {
 
367
    var currentdeck = channel+1;
 
368
    engine.setValue("[Channel"+currentdeck+"]","rate",script.pitch(control, value, status));
 
369
};
 
370
 
 
371
MaudioXponent.secondaryon = function(channel, control, value, status) {
 
372
    var currentdeck = channel+1;
 
373
    midi.sendShortMsg(MaudioXponent.on + channel,control,0x01);    // Turn on the LED
 
374
    MaudioXponent.state["shift"+currentdeck] = 1;
 
375
};
 
376
 
 
377
MaudioXponent.secondaryoff = function(channel, control, value, status) {
 
378
    var currentdeck = channel+1;
 
379
    midi.sendShortMsg(MaudioXponent.on + channel,control,0x00);    // Turn on the LED
 
380
    MaudioXponent.state["shift"+currentdeck] = 0;
 
381
};
 
382
 
 
383
MaudioXponent.flanger = function(channel, control, value, status) {
 
384
    script.debug(channel, control, value, status);
 
385
    if (control == 12) {
 
386
        var activenow = engine.getValue("[Channel1]","flanger");
 
387
        if (activenow == 1) {    // If currently active
 
388
            midi.sendShortMsg(MaudioXponent.on+1,control,0x00);    // Turn off the LED
 
389
            engine.setValue("[Channel1]","flanger",0);
 
390
        }else{
 
391
            midi.sendShortMsg(MaudioXponent.on+1,control,0x01);    // Turn on the LED
 
392
            engine.setValue("[Channel1]","flanger",1);
 
393
        }
 
394
    }else if (control == 13) {
 
395
        var activenow = engine.getValue("[Channel2]","flanger");
 
396
        if (activenow == 1) {    // If currently active
 
397
            midi.sendShortMsg(MaudioXponent.on+1,control,0x00);    // Turn off the LED
 
398
            engine.setValue("[Channel2]","flanger",0);
 
399
        }else{
 
400
            midi.sendShortMsg(MaudioXponent.on+1,control,0x01);    // Turn on the LED
 
401
            engine.setValue("[Channel2]","flanger",1);
 
402
        }
 
403
    }
 
404
};
 
405
 
 
406
MaudioXponent.scrmode = function(channel, control, value, status) {
 
407
    var currentdeck = channel+1;
 
408
    if (MaudioXponent.state["scrmode"+currentdeck] == 1) {
 
409
        midi.sendShortMsg(MaudioXponent.on + channel,control,0x00);    // Turn off the LED
 
410
        MaudioXponent.state["scrmode"+currentdeck] = 0;
 
411
    }else{
 
412
        midi.sendShortMsg(MaudioXponent.on + channel,control,0x01);    // Turn on the LED
 
413
        MaudioXponent.state["scrmode"+currentdeck] = 1;
 
414
    }
 
415
};
 
416
 
 
417
MaudioXponent.playlist = function(channel, control, value, status) {
 
418
    var currentdeck = channel+1;
 
419
    switch (control) {
 
420
      case 28:
 
421
          midi.sendShortMsg(MaudioXponent.on + channel,control,0x01);    // Turn on the LED
 
422
          engine.setValue("[Playlist]","SelectPrevTrack",1);
 
423
      break;
 
424
      case 29:
 
425
          midi.sendShortMsg(MaudioXponent.on + channel,control,0x01);    // Turn on the LED
 
426
          engine.setValue("[Playlist]","SelectNextTrack",1);
 
427
      break;
 
428
      case 30:
 
429
          midi.sendShortMsg(MaudioXponent.on + channel,control,0x01);    // Turn on the LED
 
430
          var activenow = engine.getValue("[Channel"+currentdeck+"]","play");
 
431
          if (activenow == 1) {    // If currently active
 
432
              engine.setValue("[Playlist]","LoadSelectedIntoFirstStopped",1);
 
433
          }else{
 
434
              engine.setValue("[Channel"+currentdeck+"]","LoadSelectedTrack",1);
 
435
          }
 
436
      break;
 
437
      case 31:
 
438
          midi.sendShortMsg(MaudioXponent.on + channel,control,0x01);    // Turn on the LED
 
439
          engine.setValue("[Playlist]","SelectPrevPlaylist",1);
 
440
      break;
 
441
      case 32:
 
442
          midi.sendShortMsg(MaudioXponent.on + channel,control,0x01);    // Turn on the LED
 
443
          engine.setValue("[Playlist]","SelectNextPlaylist",1);
 
444
      break;
 
445
    }
 
446
};
 
447
 
 
448
MaudioXponent.playlistoff = function(channel, control, value, status) {
 
449
      midi.sendShortMsg(MaudioXponent.off + channel,control,0x00);    // Turn off the LED
 
450
};
 
451
 
 
452
MaudioXponent.cuedefon = function(channel, control, value, status) {
 
453
    var currentdeck = channel+1;
 
454
    engine.setValue("[Channel"+currentdeck+"]","cue_default",1);
 
455
    midi.sendShortMsg(MaudioXponent.on + channel,control,0x01);    // Turn on the LED
 
456
};
 
457
 
 
458
MaudioXponent.cuedefoff = function(channel, control, value, status) {
 
459
    var currentdeck = channel+1;
 
460
    engine.setValue("[Channel"+currentdeck+"]","cue_default",0);
 
461
    midi.sendShortMsg(MaudioXponent.off + channel,control,0x00);    // Turn off the LED
 
462
};
 
463
 
 
464
MaudioXponent.volbuttonon = function(channel, control, value, status) {
 
465
    //script.debug(channel, control, value, status);
 
466
    var currentdeck = channel+1;
 
467
    engine.setValue("[Channel"+currentdeck+"]","volume",0);
 
468
    midi.sendShortMsg(MaudioXponent.on + channel,control,0x01);    // Turn on the LED
 
469
};
 
470
 
 
471
MaudioXponent.volbuttonoff = function(channel, control, value, status) {
 
472
    //script.debug(channel, control, value, status);
 
473
    var currentdeck = channel+1;
 
474
    engine.setValue("[Channel"+currentdeck+"]","volume",1);
 
475
    midi.sendShortMsg(MaudioXponent.off + channel,control,0x00);    // Turn off the LED
 
476
};
 
477
 
 
478
MaudioXponent.shutdown = function (id) {    // called when the MIDI device is closed
 
479
 
 
480
  for (var led in MaudioXponent.leds) {
 
481
    midi.sendShortMsg(MaudioXponent.on,MaudioXponent.leds[led],0x00); // Turn off deck 1 lights
 
482
    midi.sendShortMsg(MaudioXponent.on + 1,MaudioXponent.leds[led],0x00); // Turn off deck 2 lights
 
483
  }
 
484
  midi.sendShortMsg(0xB3,0x14,0x00);
 
485
  midi.sendShortMsg(0xB3,0x15,0x00);
 
486
 
 
487
};
 
488