2

I have a DJ controller which connects to the computer via USB. It consists of a number of buttons, rotary dials (that look like potentiometers), crossfader and of course a turntable for scratching. This controller is able to be used in popular DJ programs and works fine. In the DJ program I am able to map the different buttons and controls on the device to software functions in the DJ program. When mapping, the names of the buttons show up in the DJ program (names such as "FX1" - not simply mapped to keyboard buttons).

I would like to create an application which is able to take input from the USB DJ controller. No fancy audio processing or anything like that, all I want to do is be able to:

  1. Get a list of the buttons and controls available from the device
  2. Get values from these controls instead of from the keyboard

Because the buttons, sliders etc show up in the DJ controller as named controls, this leads me to believe that this information is accessible, perhaps in a similar way to how joysticks work (though I have not actually worked with joysticks in .NET).

How does one go about communicating with such a USB device generally speaking and in particular in C#?

ose
  • 4,065
  • 2
  • 24
  • 40

1 Answers1

0

This all depends on what the manufacturer of the controller has made available to you, and how the device enumerates.

Assuming the device is a generic bulk device (requires a third party driver) you could potentially install your own WinUSB driver on the VID/PID for that device. Then you can interface with the device through the WinUSB API. The problem here is that you will need to know the protocol for the device - it's possible that you can get this from the manufacturer, if they are willing to let it go. The other alternative here is to sniff the bus during normal operation (using a hardware analyzer such as an Ellisys).

If the device is enumerating as an HID device then it must conform to some HID standard (such as a Mouse, Keyboard, or maybe a MIDI controller). In this case the specification would be defined already and available outside of the manufacturer. In this case you could use hidapi to open and utilize the device, the same way your DJ application would.

Preston
  • 2,543
  • 1
  • 17
  • 26