Last active
September 20, 2015 16:23
-
-
Save valsteen/29a22d6e7cd57360b174 to your computer and use it in GitHub Desktop.
how to keep python interpreter busy in ableton
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pause(self): | |
# helper for rconsole. This blocks ableton inside python on purpose, otherwise the console thread | |
# is super slow ( python interpreter is only active when needed ) | |
def lock(): | |
if self.console_event.isSet(): | |
return | |
# this trick works with Event and not with just time.sleep, because in python2 Event.wait is a loop+sleep, which keeps the interpreter busy | |
self.console_event.wait(0.1) | |
self.schedule_message(3, lock) | |
self.console_event.clear() # console_event is a threading.Event object | |
self.schedule_message(3, lock) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment