Forums > Max For Live

Number of LiveAPI control_surfaces

August 31, 2011 | 7:36 pm

Does anyone know a simple way to get the number of LiveAPI control_surfaces? To use the getcount message we need some parent, but it appears control_surfaces is the root itself, so this doesn’t work.


September 3, 2011 | 5:18 am

There can only be six, so I use an iteration and check type usually (in js). But yeah, it would be much better if control_surfaces didn’t just return the __class__ builtins.


September 13, 2011 | 3:51 pm

Interestingly there can be a lot more than six control_surfaces, but only six can be seen in the Preferences window. When setting a control_surface to none and then to some other surface not all previous surfaces are deleted, due to bad disconnect functions and Ableton Live not always calling the disconnect function.

I found iterating until I get an ‘id 0′ is a good solution. I have to iterate all surfaces anyway.


September 13, 2011 | 8:16 pm

LOL yeah, now that I think about it I can confirm that. You’re work around seems like a good idea, I think I’ll implement the same.

a


October 19, 2011 | 9:13 pm

I stumbled upon a way to get the control_surfaces count.

It’s here.

[attachment=173533,2740]

– Pasted Max Patch, click to expand. –

But I like to iterate control_surfaces until I get an ‘id 0′ more.

[attachment=173533,2741]

– Pasted Max Patch, click to expand. –
Attachments:
  1. Iteratecontrolsurfaces.jpg

Viewing 5 posts - 1 through 5 (of 5 total)