[SOLVED] Defer your response, workarounds?
I’m trying to do the following;
When the selected track changes, change the colour of track 1 to yellow
Yes it’s just a test for now.
I’ve tried it several ways but I keep getting the error message
(nanoK Box) There's a problem with 'Action Block 1' in reaction 'Reaction Colour track' (from 'Song - selected track' listener) >>
>> Changes cannot be triggered by notifications. You will need to defer your response.
I’ve written the following Action block to try to work around it:
def set_song_track_color(song):
song().tracks[0].color = 1676960
self.schedule_message(1000, set_song_track_color(self.song))
But I still get the same error. Why isn’t self.schedule_message working?
Creating a reaction that sets a modifier and then a 2nd reaction that detects the changed modifier and sets the track colour results in the same error.
Hi guys,
Yes the ‘defer your response’ error is a pain, I did do some investigation on this a while back but couldn’t find a way around it.
If I remember right, I think clip actions might not get caught by this problem (i.e. when clip is triggered etc).
Hey Phil, thanks a lot for investigating and sharing this, I’ll test it out and hopefully we can roll this into Reactions!
While making a note of your comments Phil,
I just found a note to myself from a while ago:
A workaround of the defer issue is also to update a modifier value, then in a separate reaction, add a listener which waits for a change to that modifier and then update the UI in someway.
So it would look like this:
Reaction 1: – update ‘modifier 1’
Reaction 2: – do another UI event.
@fatphil, I’m not sure what happened to your message which you posted (below), if you purposefully took it down please let me know.
This is a possible solution to the ‘defer’ problem:
fatphil said:
I finally figured it out. I was previously using self.schedule_message incorrectly
I looked at the decompiled Framework ControlSurface script and found the definition for
schedule_message :
def schedule_message(self, delay_in_ticks, callback, parameter=None)
So if you want to have an action that is triggered by the Live Object Model and that affects the Live object model you can do it with schedule_message.
Here’s an example where I’m changing the first track’s colour to a random one each time I select a track:
def my_set_color(self,myColor): self.song().tracks[0].color = myColor def _mode1_self_song_view_add_selected_track_listener_id_2(self): try: reaction_listener_number = 1 loop_is_active = False loop_number = 0 loop_result_count = 0 self.schedule_message(1, self.my_set_color, random.randrange(0, 16581375)) except Exception as e: self.log_message("csslog:(Colour) There's a problem with 'Action Block 1' in reaction 'Reaction 1' (from 'Song - selected track' listener) >> ") self.log_message("csslog: >> " + str(e) )
Hope this helps someone!
Phil
And he has the code here:
Ableton Live Framework schedule_message usage
Yes this could be the case. thanks for letting me know Phil.
Sign up
User registration is currently not allowed.
Hey @JohnC I didn’t delete my message. Maybe it got lost in the switchover to the new site.