detecting when a M4L device has been moved from one track to another
Apr 16 2012 | 5:12 pm
I recently learned how a device can obtain the number of the track on which it is located, using [live.path this_device]
Here's the patcher example I originally found on the first reply on this forum post: https://cycling74.com/forums/how-to-get-track-number-from-inside-the-track
The problem with this patcher is that it does not update itself when you move the device from one track to another. It seems that while the [loadbang] object does bang when you first drop the device onto a track, it does not bang when the device has been moved to another track (it's not being 'loaded' in that sense) so the old track number is still shown.
I've tried setting up a live.observer object to monitor the device path for changes, but it seems that 'path' is not a property that can be observed in that way.
I can think of two options, neither of which seem very nice:
* replace the loadbang with a metro object that bangs once per second, so the track number will be regularly updated * set up an observer that monitors the number of devices on each track, and when any track loses/gains a device, send out a bang to start the process of getting the new track number
I'm hoping someone will be able to tell me a cleaner way :)