Your shopping cart is empty.
Most of the problems i have so far with trying to do my template for touchosc with CSS comes from the fact that when i try to use "selected_track" to create a listener in a reaction it seems that it only works for the currently selected track when the script is initialized.
For exemple creating a reaction with "Track's name value has changed" (self.song().view.selected_track.add_name_listener) works fine but only for the track selected on init().
Is this a bug or the intented behaviour ?
would like to know.
Thanks!
Comments
If I understand you correctly, you're saying that only the track which is selected when the script is initialised is classed as the selected track (changing the selected track has no effect)?
If you add a new track to the session, does it update?
Hi John!
Selected track works for all the controls i use in my template (volumes, mutes, sends...) but not when used as a listener for example when the selected track name has changed.
It works only for 1 track, the one selected on init() and if i add a new track to the session like you said it updates but then it only works for the newly created track.
Something like that would work i think :
def set_selected_track_listeners(self):
if(self.song().view.selected_track.name_has_listener(self.custom_listener)):
self.song().view.selected_track.remove_name_listener(self.custom_listener)
self.song().view.selected_track.add_name_listener(self.custom_listener)
Also when trying to get the id of the selected track (get_selected_track_num) it does not work for return tracks, your script returns false because it cannot find it.
You may want to add a function to check if the selected track is a return track before :
def is_return_track(self, track):
rt = self.song().return_tracks
for i in range(0, len(rt)):
if (rt[i] == track):
return(True)
return(False)
maybe there's a better way but that's what i've done so far.
Same issue is being discussed in this topic: https://remotify.io/community/question/selected-track-listener-reactions
Same problem here :)