diff options
Diffstat (limited to 'sound/usb/caiaq/control.c')
-rw-r--r-- | sound/usb/caiaq/control.c | 99 |
1 files changed, 78 insertions, 21 deletions
diff --git a/sound/usb/caiaq/control.c b/sound/usb/caiaq/control.c index 537102ba6b9d..36ed703a7416 100644 --- a/sound/usb/caiaq/control.c +++ b/sound/usb/caiaq/control.c | |||
@@ -35,33 +35,41 @@ static int control_info(struct snd_kcontrol *kcontrol, | |||
35 | struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); | 35 | struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); |
36 | int pos = kcontrol->private_value; | 36 | int pos = kcontrol->private_value; |
37 | int is_intval = pos & CNT_INTVAL; | 37 | int is_intval = pos & CNT_INTVAL; |
38 | unsigned int id = dev->chip.usb_id; | 38 | int maxval = 63; |
39 | 39 | ||
40 | uinfo->count = 1; | 40 | uinfo->count = 1; |
41 | pos &= ~CNT_INTVAL; | 41 | pos &= ~CNT_INTVAL; |
42 | 42 | ||
43 | if (id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ) | 43 | switch (dev->chip.usb_id) { |
44 | && (pos == 0)) { | 44 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): |
45 | /* current input mode of A8DJ */ | 45 | if (pos == 0) { |
46 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 46 | /* current input mode of A8DJ */ |
47 | uinfo->value.integer.min = 0; | 47 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
48 | uinfo->value.integer.max = 2; | 48 | uinfo->value.integer.min = 0; |
49 | return 0; | 49 | uinfo->value.integer.max = 2; |
50 | } | 50 | return 0; |
51 | } | ||
52 | break; | ||
51 | 53 | ||
52 | if (id == USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ) | 54 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): |
53 | && (pos == 0)) { | 55 | if (pos == 0) { |
54 | /* current input mode of A4DJ */ | 56 | /* current input mode of A4DJ */ |
55 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 57 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
56 | uinfo->value.integer.min = 0; | 58 | uinfo->value.integer.min = 0; |
57 | uinfo->value.integer.max = 1; | 59 | uinfo->value.integer.max = 1; |
58 | return 0; | 60 | return 0; |
61 | } | ||
62 | break; | ||
63 | |||
64 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1): | ||
65 | maxval = 127; | ||
66 | break; | ||
59 | } | 67 | } |
60 | 68 | ||
61 | if (is_intval) { | 69 | if (is_intval) { |
62 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 70 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
63 | uinfo->value.integer.min = 0; | 71 | uinfo->value.integer.min = 0; |
64 | uinfo->value.integer.max = 64; | 72 | uinfo->value.integer.max = maxval; |
65 | } else { | 73 | } else { |
66 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | 74 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
67 | uinfo->value.integer.min = 0; | 75 | uinfo->value.integer.min = 0; |
@@ -102,9 +110,10 @@ static int control_put(struct snd_kcontrol *kcontrol, | |||
102 | struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol); | 110 | struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol); |
103 | struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); | 111 | struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); |
104 | int pos = kcontrol->private_value; | 112 | int pos = kcontrol->private_value; |
113 | unsigned char cmd = EP1_CMD_WRITE_IO; | ||
105 | 114 | ||
106 | if (dev->chip.usb_id == | 115 | switch (dev->chip.usb_id) { |
107 | USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ)) { | 116 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): { |
108 | /* A4DJ has only one control */ | 117 | /* A4DJ has only one control */ |
109 | /* do not expose hardware input mode 0 */ | 118 | /* do not expose hardware input mode 0 */ |
110 | dev->control_state[0] = ucontrol->value.integer.value[0] + 1; | 119 | dev->control_state[0] = ucontrol->value.integer.value[0] + 1; |
@@ -113,10 +122,15 @@ static int control_put(struct snd_kcontrol *kcontrol, | |||
113 | return 1; | 122 | return 1; |
114 | } | 123 | } |
115 | 124 | ||
125 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1): | ||
126 | cmd = EP1_CMD_DIMM_LEDS; | ||
127 | break; | ||
128 | } | ||
129 | |||
116 | if (pos & CNT_INTVAL) { | 130 | if (pos & CNT_INTVAL) { |
117 | dev->control_state[pos & ~CNT_INTVAL] | 131 | dev->control_state[pos & ~CNT_INTVAL] |
118 | = ucontrol->value.integer.value[0]; | 132 | = ucontrol->value.integer.value[0]; |
119 | snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, | 133 | snd_usb_caiaq_send_command(dev, cmd, |
120 | dev->control_state, sizeof(dev->control_state)); | 134 | dev->control_state, sizeof(dev->control_state)); |
121 | } else { | 135 | } else { |
122 | if (ucontrol->value.integer.value[0]) | 136 | if (ucontrol->value.integer.value[0]) |
@@ -124,7 +138,7 @@ static int control_put(struct snd_kcontrol *kcontrol, | |||
124 | else | 138 | else |
125 | dev->control_state[pos / 8] &= ~(1 << (pos % 8)); | 139 | dev->control_state[pos / 8] &= ~(1 << (pos % 8)); |
126 | 140 | ||
127 | snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, | 141 | snd_usb_caiaq_send_command(dev, cmd, |
128 | dev->control_state, sizeof(dev->control_state)); | 142 | dev->control_state, sizeof(dev->control_state)); |
129 | } | 143 | } |
130 | 144 | ||
@@ -273,6 +287,43 @@ static struct caiaq_controller a4dj_controller[] = { | |||
273 | { "Current input mode", 0 | CNT_INTVAL } | 287 | { "Current input mode", 0 | CNT_INTVAL } |
274 | }; | 288 | }; |
275 | 289 | ||
290 | static struct caiaq_controller kontrolx1_controller[] = { | ||
291 | { "LED FX A: ON", 7 | CNT_INTVAL }, | ||
292 | { "LED FX A: 1", 6 | CNT_INTVAL }, | ||
293 | { "LED FX A: 2", 5 | CNT_INTVAL }, | ||
294 | { "LED FX A: 3", 4 | CNT_INTVAL }, | ||
295 | { "LED FX B: ON", 3 | CNT_INTVAL }, | ||
296 | { "LED FX B: 1", 2 | CNT_INTVAL }, | ||
297 | { "LED FX B: 2", 1 | CNT_INTVAL }, | ||
298 | { "LED FX B: 3", 0 | CNT_INTVAL }, | ||
299 | |||
300 | { "LED Hotcue", 28 | CNT_INTVAL }, | ||
301 | { "LED Shift (white)", 29 | CNT_INTVAL }, | ||
302 | { "LED Shift (green)", 30 | CNT_INTVAL }, | ||
303 | |||
304 | { "LED Deck A: FX1", 24 | CNT_INTVAL }, | ||
305 | { "LED Deck A: FX2", 25 | CNT_INTVAL }, | ||
306 | { "LED Deck A: IN", 17 | CNT_INTVAL }, | ||
307 | { "LED Deck A: OUT", 16 | CNT_INTVAL }, | ||
308 | { "LED Deck A: < BEAT", 19 | CNT_INTVAL }, | ||
309 | { "LED Deck A: BEAT >", 18 | CNT_INTVAL }, | ||
310 | { "LED Deck A: CUE/ABS", 21 | CNT_INTVAL }, | ||
311 | { "LED Deck A: CUP/REL", 20 | CNT_INTVAL }, | ||
312 | { "LED Deck A: PLAY", 23 | CNT_INTVAL }, | ||
313 | { "LED Deck A: SYNC", 22 | CNT_INTVAL }, | ||
314 | |||
315 | { "LED Deck B: FX1", 26 | CNT_INTVAL }, | ||
316 | { "LED Deck B: FX2", 27 | CNT_INTVAL }, | ||
317 | { "LED Deck B: IN", 15 | CNT_INTVAL }, | ||
318 | { "LED Deck B: OUT", 14 | CNT_INTVAL }, | ||
319 | { "LED Deck B: < BEAT", 13 | CNT_INTVAL }, | ||
320 | { "LED Deck B: BEAT >", 12 | CNT_INTVAL }, | ||
321 | { "LED Deck B: CUE/ABS", 11 | CNT_INTVAL }, | ||
322 | { "LED Deck B: CUP/REL", 10 | CNT_INTVAL }, | ||
323 | { "LED Deck B: PLAY", 9 | CNT_INTVAL }, | ||
324 | { "LED Deck B: SYNC", 8 | CNT_INTVAL }, | ||
325 | }; | ||
326 | |||
276 | static int __devinit add_controls(struct caiaq_controller *c, int num, | 327 | static int __devinit add_controls(struct caiaq_controller *c, int num, |
277 | struct snd_usb_caiaqdev *dev) | 328 | struct snd_usb_caiaqdev *dev) |
278 | { | 329 | { |
@@ -321,10 +372,16 @@ int __devinit snd_usb_caiaq_control_init(struct snd_usb_caiaqdev *dev) | |||
321 | ret = add_controls(a8dj_controller, | 372 | ret = add_controls(a8dj_controller, |
322 | ARRAY_SIZE(a8dj_controller), dev); | 373 | ARRAY_SIZE(a8dj_controller), dev); |
323 | break; | 374 | break; |
375 | |||
324 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): | 376 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): |
325 | ret = add_controls(a4dj_controller, | 377 | ret = add_controls(a4dj_controller, |
326 | ARRAY_SIZE(a4dj_controller), dev); | 378 | ARRAY_SIZE(a4dj_controller), dev); |
327 | break; | 379 | break; |
380 | |||
381 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1): | ||
382 | ret = add_controls(kontrolx1_controller, | ||
383 | ARRAY_SIZE(kontrolx1_controller), dev); | ||
384 | break; | ||
328 | } | 385 | } |
329 | 386 | ||
330 | return ret; | 387 | return ret; |