milkey-mouse / planets

A space game.
GNU General Public License v3.0
3 stars 1 forks source link

Raise audio thread priority #30

Open milkey-mouse opened 5 years ago

milkey-mouse commented 5 years ago

I (understandably) noticed some stuttering in the audio output when compiling rustc nightly, Chromium, and a release build of this project at the same time. Maybe this is unavoidable (especially in debug mode), but I bet upping the thread priority would help.

Fork thread-priority and "port" the Windows implementation from audio_thread_priority. Hopefully I can get my changes merged back into thread-priority; in the meantime, use cargo's dependency patch feature.

Note: RtPriorityHandleInternal might need #[repr(C)]. Carefully check unsafe code in rt_win.rs. There might be a better way to implement this for Windows.

I don't have a Mac for testing, but it would be nice to get a Mach implementation. The one from audio_thread_priority is kind of weird: there doesn't seem to be a straightforward "thread priority" value to twiddle.