How to detect connected control_surface

Learn about building and using Max for Live devices.
Post Reply
amounra93
Posts: 432
Joined: Sat Jan 24, 2009 8:16 pm
Location: Arcata, CA
Contact:

How to detect connected control_surface

Post by amounra93 » Mon Aug 30, 2010 8:54 am

I've just noticed (don't know why it didn't occur to me before....probably because I wasn't trying to make a single patch that connected to three different types of control surface):

There doesn't appear to be any way of querying whether or not a control surface is actually physically connected and communicating with Live. I've been looking through all the control surface components and have skimmed through the python scripts....I can't find a way. This is a serious PITA when trying to restore a Live set that utilizes a control surface that is no longer connected when you reload the file.

I was hoping someone had an idea of how to do what I'm trying, or some helpful input. If there's no way to get this, it seems like a good (and necessary) feature to add.

Cheers :)
http://www.aumhaa.com for Monomod and other m4l goodies.

Hanz_Petrov
Posts: 119
Joined: Sat Feb 06, 2010 2:39 pm
Contact:

Re: How to detect connected control_surface

Post by Hanz_Petrov » Mon Aug 30, 2010 4:21 pm

Hey amounra,

I don't think that Live ever really knows which, if any, control surfaces are physically connected at any one time.

In order to detect a control surface, you'd need to query it, then look for a response - typically done via Universal System Exclusive Device Inquiry (and I am not convinced that all control surfaces even support that). For those that do, you'd need to handle the sysex response (and compare with expected values, if you want to know for sure what kind of controller is actually connected). Even if you're only checking for any response at all (and not bothering to look up manufacturer's ID for example), you'd need to make sure that the the python scripts are not swallowing the sysex. (You might want to have a look at the handle_sysex method from the APC scripts, if you want to start down that road...)

Best,

Hanz
http://remotescripts.blogspot.com/ - an introduction to the Framework classes

amounra93
Posts: 432
Joined: Sat Jan 24, 2009 8:16 pm
Location: Arcata, CA
Contact:

Re: How to detect connected control_surface

Post by amounra93 » Mon Aug 30, 2010 5:58 pm

Yeah, that's pretty much what I'm thinking.

What about the navigation box, though. It doesn't seem to initiate until the APC has actually done something (same with the launchpad)...I was thinking I could query that maybe....I'll take a look at your Framework page, I seem to remember you mentioning something about that....

Basically, I'm just trying to prevent a script from loading if the surface isn't connected (APC40 and Launchpad).

Thanks as always :)
http://www.aumhaa.com for Monomod and other m4l goodies.

Hanz_Petrov
Posts: 119
Joined: Sat Feb 06, 2010 2:39 pm
Contact:

Re: How to detect connected control_surface

Post by Hanz_Petrov » Mon Aug 30, 2010 6:28 pm

If it's just APC40 and Launchpad you're checking for, then handle_sysex should get you there, script-wise. Otherwise, I seem to recall that there is a CS step sequencer included with the M4L examples, which only works with the APC40 and/or Launchpad - perhaps they have a hardware check in there which you could copy?

Best,

Hanz
http://remotescripts.blogspot.com/ - an introduction to the Framework classes

Post Reply