fixed midichannel, more optimizations in mainloop