PortAudio option to choose from different sample rates in QComboBox

• May 18, 2017 - 09:35
Reported version
S5 - Suggestion

I'm finding that on some dense scores that the paCallback (that is the function which PortAudio calls when it needs to render audio) can saturate the CPU usage of one core, even on my reasonably decent windows machine, because it simply cannot render the audio as fast as playback demands. This produces audible glitches and takes cpu usage. I found that when on a low-end linux machine, I can deliberately set my audio device to have a low sample in order to have MuseScore's built-in fluid synth render in a reasonable amount of time. But MuseScore's PortAudio init code currently just uses the selected audio device's default sampleRate, and doesn't let me lower the rate. So this feature request is for me to add a QComboBox in preferences I/O .ui for PortAudio to select from a list of sample rates. The default value of this QComboBox shall be the devices default, but will provide a few other standard ones.

Note: Although PortAudio doesn't provide a way to query for available sample rates, they provide instructions for how to query a device to ask whether it supports a particular sample rate . So what I'll do is query for a few standard rates: 8,000 Hz, 11,025 Hz, 22,050 Hz, 32,000 Hz, 37,800 Hz, 44,100 Hz, 48,000 Hz, 64,000 Hz, 88,200 Hz, 96,000 Hz, 192,000 Hz and list the ones available.