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:
parent
fbfeff4168
commit
c24b456211
@ -932,6 +932,10 @@ DummyAudioBackend::main_process_thread ()
|
||||
manager.registration_callback();
|
||||
manager.graph_order_callback();
|
||||
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
PBD::MMTIMERS::set_min_resolution();
|
||||
#endif
|
||||
|
||||
int64_t clock1;
|
||||
clock1 = -1;
|
||||
while (_running) {
|
||||
@ -1036,6 +1040,9 @@ DummyAudioBackend::main_process_thread ()
|
||||
}
|
||||
|
||||
}
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
PBD::MMTIMERS::reset_resolution();
|
||||
#endif
|
||||
_running = false;
|
||||
return 0;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
|
||||
#include "pbd/error.h"
|
||||
#include "pbd/compose.h"
|
||||
#include "pbd/windows_timer_utils.h"
|
||||
|
||||
#include "winmmemidi_io.h"
|
||||
#include "debug.h"
|
||||
@ -137,7 +136,6 @@ WinMMEMidiIO::start ()
|
||||
m_run = true;
|
||||
DEBUG_MIDI ("Starting MIDI driver\n");
|
||||
|
||||
PBD::MMTIMERS::set_min_resolution();
|
||||
discover();
|
||||
start_devices ();
|
||||
}
|
||||
@ -156,8 +154,6 @@ WinMMEMidiIO::stop ()
|
||||
pthread_mutex_lock (&m_device_lock);
|
||||
cleanup ();
|
||||
pthread_mutex_unlock (&m_device_lock);
|
||||
|
||||
PBD::MMTIMERS::reset_resolution();
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user