Windows: unconditionally request high timer resolution

Previously timeBeginPeriod() was only called when MIDI
system was set to WinMME. It was also possible that
it was never unset in case starting the engine failed.

This significantly speeds up freewheel export which uses
Glib::usleep(100) when MIDI is disabled.

see also: https://randomascii.wordpress.com/2020/10/04/windows-timer-resolution-the-great-rule-change/
This commit is contained in:
Robin Gareus 2023-06-05 00:02:54 +02:00
parent fbfeff4168
commit c24b456211
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
3 changed files with 10 additions and 4 deletions

View file

@ -681,12 +681,14 @@ PortAudioBackend::_start (bool for_latency_measurement)
if (!start_blocking_process_thread()) {
return ProcessThreadStartError;
}
PBD::MMTIMERS::set_min_resolution();
} else {
if (_pcmio->start_stream() != paNoError) {
DEBUG_AUDIO("Unable to start stream\n");
return AudioDeviceOpenError;
}
PBD::MMTIMERS::set_min_resolution();
if (!start_freewheel_process_thread()) {
DEBUG_AUDIO("Unable to start freewheel thread\n");
stop();
@ -833,6 +835,7 @@ PortAudioBackend::stop ()
}
_midiio->stop();
PBD::MMTIMERS::reset_resolution();
_run = false;