monome / norns

norns is many sound instruments.
http://monome.org
GNU General Public License v3.0
633 stars 147 forks source link

main event loop should pause during blocking operations in lua #461

Closed mhetrick closed 5 years ago

mhetrick commented 6 years ago

I'm experiencing weird behavior when performing a USB sync with the "wormhole" script open. As soon as the sync completes, there is a massive explosion of sound, as though the engine is attempting to catch up with a large queue of Lua messages. This slows norns down to a crawl. I can still navigate to SLEEP, but it takes many button presses until the machine responds.

catfact commented 6 years ago

renamed issue. more generally, the problem is that handling an event in lua blocks the main event loop.

unfortunately, i don't see a trivial solution for this.

tehn commented 6 years ago

other processes that block:

perhaps scripts/engines should just be shut down before any of these operations. this would require implementing engine.shutdown()

catfact commented 6 years ago

i don't think it's sufficient to stop scripts and engines. unhandled items in the main event queue need to be avoided entirely. (consider joystick, CC or midi clock input that can produce many events quickly / continuously.) i can make the necessary changes to events and weaver.

tehn commented 6 years ago

i meant running cleanup() which should null out any callbacks to norns.none

this seems sufficient to have the event loop continue but do nothing? or are you suggesting we'd overflow the event queue?

catfact commented 6 years ago

are you suggesting we'd overflow the event queue?

Yes that's what I mean. It's not a huge or mysterious problem but it needs attention

tehn commented 5 years ago

likely solution: https://github.com/monome/norns/issues/779