Change layout dynamically?

Hi folks,

Is it possible to change the layout dynamically depending on received OSC messages?

For example, if i create a new project in Ableton, by default there are 4 tracks.

So then i want to see 4 faders in OSC.

But if i create a 5th track, this should automatically create a 5th fader .....etc etc.

Obviously this also depends on the capabilities of the sending application (in this case Ableton), but is this sort of thing possible in principal?

Thanks!

Yes, it is possible - I’m doing it for a project I’m working on. What I did was setup a variable to hold the array of tracks, and then use that variable’s count (i.e. “length” property) in the matrix’s quantity field to dynamically update the number of items. The props field gets all the actual data and creates the widget.

Great, thanks for the info!

Is the following also possible:

Say i have 4 tracks in Ableton, with random names.

Is it possible to display the faders (which are created dynamically) in the OStageC app in alphabetical order?

So say i say these tracks, from top / down in Ableton:

Vox
Drums
Bass
Synth

But i want them to display in the OStageC app as:

Bass
Drums
Synth
Vox

And if i add a new tracks in Ableton, it'll get added in the app in the right alphabetical place?

Thanks!

Yes - assuming it’s coming in as an array or you can get it into a JavaScript array, you can just use the sort() method:

// tracks = [“Vox”, “Drums”, “Bass”, “Synth”]
tracks.sort()
// tracks = [“Bass”, “Drums”, “Synth”, “Vox”]

OK, but does the first line of your code need to be in that order?

I mean, does it have to be the same order as the actual order in Ableton?

Because. if so, it kinda defeats the purpose!

Sorry, i'm a real noob with coding and such, perhaps this is a stupid question!

No that was just an arbitrary order I made up. The sort() function will sort any array into alphabetical order.