Old 01-12-2018, 12:56 PM   #1
jrsmith8719
Human being with feelings
 
Join Date: May 2016
Posts: 3
Default Can extensions talk to USB?

Hey everyone. I am a software engineer but I do iOS and Android, never done any Windows programming. If I wanted to create a plugin that added integration with hardware over USB, can I do that by creating a DLL that links against the Reaper SDK?

I think I have an idea how this is done, so let me riff on that and can someone tell me if I am on the right track?

Reaper can load DLLs at startup.
I need to create a DLL that links against the Reaper API
From that DLL I can talk to Reaper through the Reaper API
DLLs can talk to other DLLs
My Reaper extension DLL can therefore talk to winusb DLL
So my extension DLL would need to use winusb (or a framework like libusb) to enumerate USB devices, find the hardware controller and start listening for packets
My extension would need to grab USB packets from my controller, parse them, then call some Reaper API method
If the hardware controller could receive data and do something with it, I would need to get data out of Reaper using the API then send it over USB to my hardware

Am I on the right track?

Obviously I would need to set up my environment and link against the Reaper SDK. I am assuming whatever environment I use to make a DLL will also have support for winusb? If I use a framework for USB like libusb do I simply grab that SDK and link against it? I would also need to know the packet structure for talking to my hardware. If I make the hardware, easy enough, but if I use hardware made by someone else I would need to know their packet structure or reverse engineer it?

Thanks!
jrsmith8719 is offline   Reply With Quote
Old 01-12-2018, 01:32 PM   #2
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 1,861
Default

Quote:
Originally Posted by jrsmith8719 View Post
I am on the right track?

Reaper can load DLLs at startup.
I need to create a DLL that links against the Reaper API
From that DLL I can talk to Reaper through the Reaper API
DLLs can talk to other DLLs
My Reaper extension DLL can therefore talk to winusb DLL
So my extension DLL would need to use winusb (or a framework like libusb) to enumerate USB devices, find the hardware controller and start listening for packets
Yes. A REAPER extension can do whatever it wants.

(There is no actual linking against the REAPER API though. Here's a minimal code example to make an extension: https://gist.github.com/cfillion/f32...63abb1eda41400)

Last edited by cfillion; 01-12-2018 at 01:40 PM.
cfillion is online now   Reply With Quote
Old 01-12-2018, 01:34 PM   #3
jrsmith8719
Human being with feelings
 
Join Date: May 2016
Posts: 3
Default

cool, thanks!
jrsmith8719 is offline   Reply With Quote
Old 01-12-2018, 03:10 PM   #4
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Germany
Posts: 4,725
Default

Quote:
Originally Posted by jrsmith8719 View Post
I wanted to create a plugin that added integration with hardware over USB,
If you want to use USB, you need to attach to a driver (which a Reaper extension can do).

Such an USB driver features a "family" definition (such as "setial port", "Midi", "Audio", ... for the protocol that is to be tunneled via USB. (Of course "propriety is also possible).

Do you have such a driver for the hardware in question ?

-Michael
__________________
www.boa-sorte.de
mschnell is offline   Reply With Quote
Old 01-12-2018, 03:12 PM   #5
jrsmith8719
Human being with feelings
 
Join Date: May 2016
Posts: 3
Default

I do not. I don't even have hardware, this was more of a high level question. If the hardware conforms to some generic USB protocol like HID would I still need a driver?
jrsmith8719 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:01 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.