is it possible to focus view on a Live Device using M4L/LOM

Mark's icon

i want to be able to swiftly bring my M4L device into view using a button from a controller, instead of navigating to it manually using the mouse.

i had the impression this was possible to do using the "select_device" command, but after trying it out (and reading the reference), it doesn't work like this.

anyone know if it is possible to do this in any way?

it could be possible by making my whole device into a Bpatcher and open it as a floating window, but i would prefer not to do it that way.

bringing into view the Track in which the device is contained would be acceptable but i think this is also not possible?

i am still using Live 9/max 7, and can't think of a way to do it, has anything changed for this in Live 10?

any feedback appreciated, even if it's just a confirmation that it's not possible.

thanks

Mark's icon

i just saw the "select_instrument" command which " Selects track's instrument or first device, makes it visible and focuses on it. "
i suppose this will work for my device even though it's a midi effect device?
if yes, this is good enough for the project i am currently making, although for the next project i still need a "focus on device" command since there will be multiple device's in a single track for efficiency reasons.

tyler mazaika's icon

I use select_device for this purpose, it’s just not a 1-stop shop in that you want to select its track first and possibly also make sure that the right Detail view (e.g not clip view) is showing.

Mark's icon

do you mean that if the right track is selected, "select_device" will bring the device into view?

tyler mazaika's icon

Right. And live_set view has a property “selected_tracks” and it is settable.

Mark's icon

i am having trouble getting the "select_instrument" to work.
it is selecting the device but not bringing it into view.
can anyone test the patch? i map a key to the button, i select a different track, i press the key (twice for it to work because it's on "toggle"), it does not bring the track or device into view, however when i manually select the right track, i can see that the device has been selected. so it seems the command is passing through to the right object, just not bringing it to view.

show_instrument_test.amxd
amxd 8.65 KB

in the meantime i will try Tylers approach to set "selected_tracks", but would be nice to have feedback if my patch is working for other users.
thanks

mothergarage's icon

Maybe I misunderstand , but can't you just midimap the title bar of the device to the button of the controller?

tyler mazaika's icon

Good point! I always forget you can do this, and it’s basically exactly the use case Mark described. (Though there are plenty of other cases programmatically revealing devices handy)

Mark's icon

@mothergarage
thanks for the tip, i hadn't thought about that, although i want to achieve this without manual midimaping for various reasons.
i'm still confused about why my patch is not bringing the device into view. The command seems to be passing through to the right object and selecting the right device, just not bringing it to view as stated by the LOM reference.
it would be nice if someone can test it out, or if someone could provide a working example of either "select_instrument", "select_device" or "selected_device" approach.
thanks

M4kI9H7  's icon

https://docs.cycling74.com/max7/vignettes/live_object_model
from this LOM Documentation, it mentions that "select_device" does not automatically show the tracks containing it.

However, property "selected_track" of Song.View can be set, meaning you can select the tracks you want, as long as you obtained ids.

I'd suggest using [live.observer], children "tracks" of Song to obtain all ids of tracks.
The ids [live.observer] prints out is always in order from left to right(top to bottom), maybe use coll&counter?

Edit: Think of it, using [coll] with [listfunnel] would be handy.

Valiumdupeuple's icon

It's not mentioned on the info, but you'll find an implementation of how to focus to different views in this device:
https://gumroad.com/l/ODGd

Mark's icon

i managed to do it by setting the selected_track, and thanks to crampe's suggestion it was easy to make it focus on the right view.
here is my working patch for anyone who might have the same trouble in the future

show_track_test.amxd
amxd 10.90 KB


thank's to all of you for your help!

Jay Walker's icon

OMG.. so not straight-forward, documentation needs to be updated ASAP! This is an example of how I select the first device on a specific track..

var liveSet = new LiveAPI('live_set view');
var targetTrackDevice = new LiveAPI("live_set tracks 1 devices 0");
liveSet.call('select_device', 'id ' + targetTrackDevice.id);