mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 23:05:04 +01:00
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
3 changed files with 10 additions and 4 deletions
|
|
@ -932,6 +932,10 @@ DummyAudioBackend::main_process_thread ()
|
||||||
manager.registration_callback();
|
manager.registration_callback();
|
||||||
manager.graph_order_callback();
|
manager.graph_order_callback();
|
||||||
|
|
||||||
|
#ifdef PLATFORM_WINDOWS
|
||||||
|
PBD::MMTIMERS::set_min_resolution();
|
||||||
|
#endif
|
||||||
|
|
||||||
int64_t clock1;
|
int64_t clock1;
|
||||||
clock1 = -1;
|
clock1 = -1;
|
||||||
while (_running) {
|
while (_running) {
|
||||||
|
|
@ -1036,6 +1040,9 @@ DummyAudioBackend::main_process_thread ()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#ifdef PLATFORM_WINDOWS
|
||||||
|
PBD::MMTIMERS::reset_resolution();
|
||||||
|
#endif
|
||||||
_running = false;
|
_running = false;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -681,12 +681,14 @@ PortAudioBackend::_start (bool for_latency_measurement)
|
||||||
if (!start_blocking_process_thread()) {
|
if (!start_blocking_process_thread()) {
|
||||||
return ProcessThreadStartError;
|
return ProcessThreadStartError;
|
||||||
}
|
}
|
||||||
|
PBD::MMTIMERS::set_min_resolution();
|
||||||
} else {
|
} else {
|
||||||
if (_pcmio->start_stream() != paNoError) {
|
if (_pcmio->start_stream() != paNoError) {
|
||||||
DEBUG_AUDIO("Unable to start stream\n");
|
DEBUG_AUDIO("Unable to start stream\n");
|
||||||
return AudioDeviceOpenError;
|
return AudioDeviceOpenError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PBD::MMTIMERS::set_min_resolution();
|
||||||
if (!start_freewheel_process_thread()) {
|
if (!start_freewheel_process_thread()) {
|
||||||
DEBUG_AUDIO("Unable to start freewheel thread\n");
|
DEBUG_AUDIO("Unable to start freewheel thread\n");
|
||||||
stop();
|
stop();
|
||||||
|
|
@ -833,6 +835,7 @@ PortAudioBackend::stop ()
|
||||||
}
|
}
|
||||||
|
|
||||||
_midiio->stop();
|
_midiio->stop();
|
||||||
|
PBD::MMTIMERS::reset_resolution();
|
||||||
|
|
||||||
_run = false;
|
_run = false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@
|
||||||
|
|
||||||
#include "pbd/error.h"
|
#include "pbd/error.h"
|
||||||
#include "pbd/compose.h"
|
#include "pbd/compose.h"
|
||||||
#include "pbd/windows_timer_utils.h"
|
|
||||||
|
|
||||||
#include "winmmemidi_io.h"
|
#include "winmmemidi_io.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
@ -137,7 +136,6 @@ WinMMEMidiIO::start ()
|
||||||
m_run = true;
|
m_run = true;
|
||||||
DEBUG_MIDI ("Starting MIDI driver\n");
|
DEBUG_MIDI ("Starting MIDI driver\n");
|
||||||
|
|
||||||
PBD::MMTIMERS::set_min_resolution();
|
|
||||||
discover();
|
discover();
|
||||||
start_devices ();
|
start_devices ();
|
||||||
}
|
}
|
||||||
|
|
@ -156,8 +154,6 @@ WinMMEMidiIO::stop ()
|
||||||
pthread_mutex_lock (&m_device_lock);
|
pthread_mutex_lock (&m_device_lock);
|
||||||
cleanup ();
|
cleanup ();
|
||||||
pthread_mutex_unlock (&m_device_lock);
|
pthread_mutex_unlock (&m_device_lock);
|
||||||
|
|
||||||
PBD::MMTIMERS::reset_resolution();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue