aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/caiaq/control.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/usb/caiaq/control.c')
-rw-r--r--sound/usb/caiaq/control.c208
1 files changed, 203 insertions, 5 deletions
diff --git a/sound/usb/caiaq/control.c b/sound/usb/caiaq/control.c
index 91c804cd2782..00e5d0a469e1 100644
--- a/sound/usb/caiaq/control.c
+++ b/sound/usb/caiaq/control.c
@@ -55,6 +55,10 @@ static int control_info(struct snd_kcontrol *kcontrol,
55 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1): 55 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1):
56 maxval = 127; 56 maxval = 127;
57 break; 57 break;
58
59 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLS4):
60 maxval = 31;
61 break;
58 } 62 }
59 63
60 if (is_intval) { 64 if (is_intval) {
@@ -93,6 +97,7 @@ static int control_put(struct snd_kcontrol *kcontrol,
93 struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol); 97 struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol);
94 struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); 98 struct snd_usb_caiaqdev *dev = caiaqdev(chip->card);
95 int pos = kcontrol->private_value; 99 int pos = kcontrol->private_value;
100 int v = ucontrol->value.integer.value[0];
96 unsigned char cmd = EP1_CMD_WRITE_IO; 101 unsigned char cmd = EP1_CMD_WRITE_IO;
97 102
98 if (dev->chip.usb_id == 103 if (dev->chip.usb_id ==
@@ -100,12 +105,27 @@ static int control_put(struct snd_kcontrol *kcontrol,
100 cmd = EP1_CMD_DIMM_LEDS; 105 cmd = EP1_CMD_DIMM_LEDS;
101 106
102 if (pos & CNT_INTVAL) { 107 if (pos & CNT_INTVAL) {
103 dev->control_state[pos & ~CNT_INTVAL] 108 int i = pos & ~CNT_INTVAL;
104 = ucontrol->value.integer.value[0]; 109
105 snd_usb_caiaq_send_command(dev, cmd, 110 dev->control_state[i] = v;
106 dev->control_state, sizeof(dev->control_state)); 111
112 if (dev->chip.usb_id ==
113 USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLS4)) {
114 int actual_len;
115
116 dev->ep8_out_buf[0] = i;
117 dev->ep8_out_buf[1] = v;
118
119 usb_bulk_msg(dev->chip.dev,
120 usb_sndbulkpipe(dev->chip.dev, 8),
121 dev->ep8_out_buf, sizeof(dev->ep8_out_buf),
122 &actual_len, 200);
123 } else {
124 snd_usb_caiaq_send_command(dev, cmd,
125 dev->control_state, sizeof(dev->control_state));
126 }
107 } else { 127 } else {
108 if (ucontrol->value.integer.value[0]) 128 if (v)
109 dev->control_state[pos / 8] |= 1 << (pos % 8); 129 dev->control_state[pos / 8] |= 1 << (pos % 8);
110 else 130 else
111 dev->control_state[pos / 8] &= ~(1 << (pos % 8)); 131 dev->control_state[pos / 8] &= ~(1 << (pos % 8));
@@ -296,6 +316,179 @@ static struct caiaq_controller kontrolx1_controller[] = {
296 { "LED Deck B: SYNC", 8 | CNT_INTVAL }, 316 { "LED Deck B: SYNC", 8 | CNT_INTVAL },
297}; 317};
298 318
319static struct caiaq_controller kontrols4_controller[] = {
320 { "LED: Master: Quant", 10 | CNT_INTVAL },
321 { "LED: Master: Headphone", 11 | CNT_INTVAL },
322 { "LED: Master: Master", 12 | CNT_INTVAL },
323 { "LED: Master: Snap", 14 | CNT_INTVAL },
324 { "LED: Master: Warning", 15 | CNT_INTVAL },
325 { "LED: Master: Master button", 112 | CNT_INTVAL },
326 { "LED: Master: Snap button", 113 | CNT_INTVAL },
327 { "LED: Master: Rec", 118 | CNT_INTVAL },
328 { "LED: Master: Size", 119 | CNT_INTVAL },
329 { "LED: Master: Quant button", 120 | CNT_INTVAL },
330 { "LED: Master: Browser button", 121 | CNT_INTVAL },
331 { "LED: Master: Play button", 126 | CNT_INTVAL },
332 { "LED: Master: Undo button", 127 | CNT_INTVAL },
333
334 { "LED: Channel A: >", 4 | CNT_INTVAL },
335 { "LED: Channel A: <", 5 | CNT_INTVAL },
336 { "LED: Channel A: Meter 1", 97 | CNT_INTVAL },
337 { "LED: Channel A: Meter 2", 98 | CNT_INTVAL },
338 { "LED: Channel A: Meter 3", 99 | CNT_INTVAL },
339 { "LED: Channel A: Meter 4", 100 | CNT_INTVAL },
340 { "LED: Channel A: Meter 5", 101 | CNT_INTVAL },
341 { "LED: Channel A: Meter 6", 102 | CNT_INTVAL },
342 { "LED: Channel A: Meter clip", 103 | CNT_INTVAL },
343 { "LED: Channel A: Active", 114 | CNT_INTVAL },
344 { "LED: Channel A: Cue", 116 | CNT_INTVAL },
345 { "LED: Channel A: FX1", 149 | CNT_INTVAL },
346 { "LED: Channel A: FX2", 148 | CNT_INTVAL },
347
348 { "LED: Channel B: >", 2 | CNT_INTVAL },
349 { "LED: Channel B: <", 3 | CNT_INTVAL },
350 { "LED: Channel B: Meter 1", 89 | CNT_INTVAL },
351 { "LED: Channel B: Meter 2", 90 | CNT_INTVAL },
352 { "LED: Channel B: Meter 3", 91 | CNT_INTVAL },
353 { "LED: Channel B: Meter 4", 92 | CNT_INTVAL },
354 { "LED: Channel B: Meter 5", 93 | CNT_INTVAL },
355 { "LED: Channel B: Meter 6", 94 | CNT_INTVAL },
356 { "LED: Channel B: Meter clip", 95 | CNT_INTVAL },
357 { "LED: Channel B: Active", 122 | CNT_INTVAL },
358 { "LED: Channel B: Cue", 125 | CNT_INTVAL },
359 { "LED: Channel B: FX1", 147 | CNT_INTVAL },
360 { "LED: Channel B: FX2", 146 | CNT_INTVAL },
361
362 { "LED: Channel C: >", 6 | CNT_INTVAL },
363 { "LED: Channel C: <", 7 | CNT_INTVAL },
364 { "LED: Channel C: Meter 1", 105 | CNT_INTVAL },
365 { "LED: Channel C: Meter 2", 106 | CNT_INTVAL },
366 { "LED: Channel C: Meter 3", 107 | CNT_INTVAL },
367 { "LED: Channel C: Meter 4", 108 | CNT_INTVAL },
368 { "LED: Channel C: Meter 5", 109 | CNT_INTVAL },
369 { "LED: Channel C: Meter 6", 110 | CNT_INTVAL },
370 { "LED: Channel C: Meter clip", 111 | CNT_INTVAL },
371 { "LED: Channel C: Active", 115 | CNT_INTVAL },
372 { "LED: Channel C: Cue", 117 | CNT_INTVAL },
373 { "LED: Channel C: FX1", 151 | CNT_INTVAL },
374 { "LED: Channel C: FX2", 150 | CNT_INTVAL },
375
376 { "LED: Channel D: >", 0 | CNT_INTVAL },
377 { "LED: Channel D: <", 1 | CNT_INTVAL },
378 { "LED: Channel D: Meter 1", 81 | CNT_INTVAL },
379 { "LED: Channel D: Meter 2", 82 | CNT_INTVAL },
380 { "LED: Channel D: Meter 3", 83 | CNT_INTVAL },
381 { "LED: Channel D: Meter 4", 84 | CNT_INTVAL },
382 { "LED: Channel D: Meter 5", 85 | CNT_INTVAL },
383 { "LED: Channel D: Meter 6", 86 | CNT_INTVAL },
384 { "LED: Channel D: Meter clip", 87 | CNT_INTVAL },
385 { "LED: Channel D: Active", 123 | CNT_INTVAL },
386 { "LED: Channel D: Cue", 124 | CNT_INTVAL },
387 { "LED: Channel D: FX1", 145 | CNT_INTVAL },
388 { "LED: Channel D: FX2", 144 | CNT_INTVAL },
389
390 { "LED: Deck A: 1 (blue)", 22 | CNT_INTVAL },
391 { "LED: Deck A: 1 (green)", 23 | CNT_INTVAL },
392 { "LED: Deck A: 2 (blue)", 20 | CNT_INTVAL },
393 { "LED: Deck A: 2 (green)", 21 | CNT_INTVAL },
394 { "LED: Deck A: 3 (blue)", 18 | CNT_INTVAL },
395 { "LED: Deck A: 3 (green)", 19 | CNT_INTVAL },
396 { "LED: Deck A: 4 (blue)", 16 | CNT_INTVAL },
397 { "LED: Deck A: 4 (green)", 17 | CNT_INTVAL },
398 { "LED: Deck A: Load", 44 | CNT_INTVAL },
399 { "LED: Deck A: Deck C button", 45 | CNT_INTVAL },
400 { "LED: Deck A: In", 47 | CNT_INTVAL },
401 { "LED: Deck A: Out", 46 | CNT_INTVAL },
402 { "LED: Deck A: Shift", 24 | CNT_INTVAL },
403 { "LED: Deck A: Sync", 27 | CNT_INTVAL },
404 { "LED: Deck A: Cue", 26 | CNT_INTVAL },
405 { "LED: Deck A: Play", 25 | CNT_INTVAL },
406 { "LED: Deck A: Tempo up", 33 | CNT_INTVAL },
407 { "LED: Deck A: Tempo down", 32 | CNT_INTVAL },
408 { "LED: Deck A: Master", 34 | CNT_INTVAL },
409 { "LED: Deck A: Keylock", 35 | CNT_INTVAL },
410 { "LED: Deck A: Deck A", 37 | CNT_INTVAL },
411 { "LED: Deck A: Deck C", 36 | CNT_INTVAL },
412 { "LED: Deck A: Samples", 38 | CNT_INTVAL },
413 { "LED: Deck A: On Air", 39 | CNT_INTVAL },
414 { "LED: Deck A: Sample 1", 31 | CNT_INTVAL },
415 { "LED: Deck A: Sample 2", 30 | CNT_INTVAL },
416 { "LED: Deck A: Sample 3", 29 | CNT_INTVAL },
417 { "LED: Deck A: Sample 4", 28 | CNT_INTVAL },
418 { "LED: Deck A: Digit 1 - A", 55 | CNT_INTVAL },
419 { "LED: Deck A: Digit 1 - B", 54 | CNT_INTVAL },
420 { "LED: Deck A: Digit 1 - C", 53 | CNT_INTVAL },
421 { "LED: Deck A: Digit 1 - D", 52 | CNT_INTVAL },
422 { "LED: Deck A: Digit 1 - E", 51 | CNT_INTVAL },
423 { "LED: Deck A: Digit 1 - F", 50 | CNT_INTVAL },
424 { "LED: Deck A: Digit 1 - G", 49 | CNT_INTVAL },
425 { "LED: Deck A: Digit 1 - dot", 48 | CNT_INTVAL },
426 { "LED: Deck A: Digit 2 - A", 63 | CNT_INTVAL },
427 { "LED: Deck A: Digit 2 - B", 62 | CNT_INTVAL },
428 { "LED: Deck A: Digit 2 - C", 61 | CNT_INTVAL },
429 { "LED: Deck A: Digit 2 - D", 60 | CNT_INTVAL },
430 { "LED: Deck A: Digit 2 - E", 59 | CNT_INTVAL },
431 { "LED: Deck A: Digit 2 - F", 58 | CNT_INTVAL },
432 { "LED: Deck A: Digit 2 - G", 57 | CNT_INTVAL },
433 { "LED: Deck A: Digit 2 - dot", 56 | CNT_INTVAL },
434
435 { "LED: Deck B: 1 (blue)", 78 | CNT_INTVAL },
436 { "LED: Deck B: 1 (green)", 79 | CNT_INTVAL },
437 { "LED: Deck B: 2 (blue)", 76 | CNT_INTVAL },
438 { "LED: Deck B: 2 (green)", 77 | CNT_INTVAL },
439 { "LED: Deck B: 3 (blue)", 74 | CNT_INTVAL },
440 { "LED: Deck B: 3 (green)", 75 | CNT_INTVAL },
441 { "LED: Deck B: 4 (blue)", 72 | CNT_INTVAL },
442 { "LED: Deck B: 4 (green)", 73 | CNT_INTVAL },
443 { "LED: Deck B: Load", 180 | CNT_INTVAL },
444 { "LED: Deck B: Deck D button", 181 | CNT_INTVAL },
445 { "LED: Deck B: In", 183 | CNT_INTVAL },
446 { "LED: Deck B: Out", 182 | CNT_INTVAL },
447 { "LED: Deck B: Shift", 64 | CNT_INTVAL },
448 { "LED: Deck B: Sync", 67 | CNT_INTVAL },
449 { "LED: Deck B: Cue", 66 | CNT_INTVAL },
450 { "LED: Deck B: Play", 65 | CNT_INTVAL },
451 { "LED: Deck B: Tempo up", 185 | CNT_INTVAL },
452 { "LED: Deck B: Tempo down", 184 | CNT_INTVAL },
453 { "LED: Deck B: Master", 186 | CNT_INTVAL },
454 { "LED: Deck B: Keylock", 187 | CNT_INTVAL },
455 { "LED: Deck B: Deck B", 189 | CNT_INTVAL },
456 { "LED: Deck B: Deck D", 188 | CNT_INTVAL },
457 { "LED: Deck B: Samples", 190 | CNT_INTVAL },
458 { "LED: Deck B: On Air", 191 | CNT_INTVAL },
459 { "LED: Deck B: Sample 1", 71 | CNT_INTVAL },
460 { "LED: Deck B: Sample 2", 70 | CNT_INTVAL },
461 { "LED: Deck B: Sample 3", 69 | CNT_INTVAL },
462 { "LED: Deck B: Sample 4", 68 | CNT_INTVAL },
463 { "LED: Deck B: Digit 1 - A", 175 | CNT_INTVAL },
464 { "LED: Deck B: Digit 1 - B", 174 | CNT_INTVAL },
465 { "LED: Deck B: Digit 1 - C", 173 | CNT_INTVAL },
466 { "LED: Deck B: Digit 1 - D", 172 | CNT_INTVAL },
467 { "LED: Deck B: Digit 1 - E", 171 | CNT_INTVAL },
468 { "LED: Deck B: Digit 1 - F", 170 | CNT_INTVAL },
469 { "LED: Deck B: Digit 1 - G", 169 | CNT_INTVAL },
470 { "LED: Deck B: Digit 1 - dot", 168 | CNT_INTVAL },
471 { "LED: Deck B: Digit 2 - A", 167 | CNT_INTVAL },
472 { "LED: Deck B: Digit 2 - B", 166 | CNT_INTVAL },
473 { "LED: Deck B: Digit 2 - C", 165 | CNT_INTVAL },
474 { "LED: Deck B: Digit 2 - D", 164 | CNT_INTVAL },
475 { "LED: Deck B: Digit 2 - E", 163 | CNT_INTVAL },
476 { "LED: Deck B: Digit 2 - F", 162 | CNT_INTVAL },
477 { "LED: Deck B: Digit 2 - G", 161 | CNT_INTVAL },
478 { "LED: Deck B: Digit 2 - dot", 160 | CNT_INTVAL },
479
480 { "LED: FX1: dry/wet", 153 | CNT_INTVAL },
481 { "LED: FX1: 1", 154 | CNT_INTVAL },
482 { "LED: FX1: 2", 155 | CNT_INTVAL },
483 { "LED: FX1: 3", 156 | CNT_INTVAL },
484 { "LED: FX1: Mode", 157 | CNT_INTVAL },
485 { "LED: FX2: dry/wet", 129 | CNT_INTVAL },
486 { "LED: FX2: 1", 130 | CNT_INTVAL },
487 { "LED: FX2: 2", 131 | CNT_INTVAL },
488 { "LED: FX2: 3", 132 | CNT_INTVAL },
489 { "LED: FX2: Mode", 133 | CNT_INTVAL },
490};
491
299static int __devinit add_controls(struct caiaq_controller *c, int num, 492static int __devinit add_controls(struct caiaq_controller *c, int num,
300 struct snd_usb_caiaqdev *dev) 493 struct snd_usb_caiaqdev *dev)
301{ 494{
@@ -354,6 +547,11 @@ int __devinit snd_usb_caiaq_control_init(struct snd_usb_caiaqdev *dev)
354 ret = add_controls(kontrolx1_controller, 547 ret = add_controls(kontrolx1_controller,
355 ARRAY_SIZE(kontrolx1_controller), dev); 548 ARRAY_SIZE(kontrolx1_controller), dev);
356 break; 549 break;
550
551 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLS4):
552 ret = add_controls(kontrols4_controller,
553 ARRAY_SIZE(kontrols4_controller), dev);
554 break;
357 } 555 }
358 556
359 return ret; 557 return ret;