Open markusschloesser opened 3 years ago
I guess an implementation depends on the functionality you want to achieve. One of the more simple implementations would be to use a class level flag. When the Lock button LED is lit, whatever channel or device mode "page" you are looking at on the C4 can't be updated. I mean, I think, for example, if you just stop doing "reassign encoder parameters" stuff if DEVICE_IS_LOCKED == self.__lock_status
and also ignore changing modes when the Lock button is engaged, that would probably get you pretty far along toward the goal.
This is kind of based on the fact that our "big list db" has "DeviceParameter" objects that "show" the "midi feedback" data. I think those "DeviceParameter" objects are fixed in the sense that they are directly linked to the device instance within Live and its parameters. If you stop reassigning the encoders to different parameters, the encoders will continue their current assignments, even as you change selected tracks and/or do other stuff in Live, or maybe not, but I would think they should.
The danger of course would be where it always is, when objects are deleted. What if you are Locked to a device and "parameter page 2" and that device gets deleted? Would the C4 automatically "unlock" the view?
there's existing code for that, will try to implement. It's the difference between appointed and selected device (just now understood the purpose of "appointed device")
from https://github.com/xot/ElectraOne/blob/main/DOCUMENTATION.md
can_lock_to_devices(self)
to tell Live whether the remote script can be locked to devices (returned as a boolean).
lock_to_device(self, device)
tells the remote script to lock to a given device (passed as a reference of type Live.Device.Device).
unlock_from_device(self, device)
tells the remote script to unlock from the given device (passed as a reference of type Live.Device.Device).
toggle_lock(self)
tell the script to toggle whether it will lock to devices or not; this is a bit weird because you would expect Live itself to handle this (and there is a corresponding toggle_lock in c_instance to tell Live to toggle the lock...).
implement functionality to be able to lock the current device or track by pressing "Lock". Changing the device/track/chain in Live's GUI should not change the device (/ track) on the C4
possible Code