I went looking at portaudio's alsa implementation and rtmidi's alsa implementation. Both use polling without burning up users' systems. They both do this by sleeping for a very short (1ms) amount of time when no data is available after a poll() call.
I went looking at portaudio's alsa implementation and rtmidi's alsa implementation. Both use polling without burning up users' systems. They both do this by sleeping for a very short (1ms) amount of time when no data is available after a poll() call.
I've implemented something similar to this at lp:~mixxxdevelopers/mixxx/fixes_midi_burnout. Results, in CPU usage:
Without sleep (current behavior) | 150% | 110% |
With sleep (as revised) | 70% | 35% |
I'll be doing a merge request shortly.