audio_thread_priority

Bump a thread to real-time priority, for audio work, on Linux, Windows and macOS

14 breaking releases

0.15.0 Jun 26, 2019
0.13.0 Jun 21, 2019
0.3.0 Jan 25, 2018

#59 in Audio

Download history 1/week @ 2019-03-13 16/week @ 2019-03-20 4/week @ 2019-03-27 3/week @ 2019-04-03 4/week @ 2019-04-10 3/week @ 2019-04-17 5/week @ 2019-04-24 50/week @ 2019-05-01 72/week @ 2019-05-08 39/week @ 2019-05-15 87/week @ 2019-05-22 70/week @ 2019-05-29 22/week @ 2019-06-05 32/week @ 2019-06-12 94/week @ 2019-06-19

163 downloads per month

MPL-2.0 license

24KB
414 lines

audio_thread_priority

Synopsis:

  // ... on a thread that will compute audio and has to be real-time:
  RtPriorityHandle handle;

  match promote_current_thread_to_real_time(512, 44100) {
    Ok(h) => {
      handle = h;
      println!("this thread is now bumped to real-time priority.") 
    }
    Err(...) => { println!("could not bump to real time.") }
  }

  // do some real-time work.

  match demote_current_thread_from_real_time(h) {
    Ok(...) => {
      println!("this thread is now bumped back to normal.")
    }
    Err(...) => {
      println!("Could not bring the thread back to normal priority.")
    }
  }

This library can also be used from C or C++ using the included header and compiling the rust code in the application. By default, a .a is compiled to ease linking.

License

MPL-2

Dependencies

~1MB