mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-08 04:20:13 +02:00
Set realtime priorities if available
This significantly reduces the latency with no real drawbacks from what I've noticed. Wineserver is still run using the normal scheduling policies because from my testing running that with realtime priority that can actually increase latencies, although doing so will greatly reduce the variance in processing time.
This commit is contained in:
@@ -16,12 +16,13 @@
|
||||
|
||||
#include "plugin-bridge.h"
|
||||
|
||||
// Generated inside of build directory
|
||||
// Generated inside of the build directory
|
||||
#include <src/common/config/config.h>
|
||||
#include <src/common/config/version.h>
|
||||
|
||||
#include "../common/communication.h"
|
||||
#include "../common/events.h"
|
||||
#include "../common/utils.h"
|
||||
#include "utils.h"
|
||||
|
||||
namespace bp = boost::process;
|
||||
@@ -78,6 +79,7 @@ PluginBridge::PluginBridge(audioMasterCallback host_callback)
|
||||
logger,
|
||||
vst_plugin_path,
|
||||
socket_endpoint.path()))),
|
||||
has_realtime_priority(set_realtime_priority()),
|
||||
wine_io_handler([&]() { io_context.run(); }) {
|
||||
log_init_message();
|
||||
|
||||
@@ -598,6 +600,8 @@ void PluginBridge::log_init_message() {
|
||||
<< std::endl;
|
||||
init_msg << "plugin: '" << vst_plugin_path.string() << "'"
|
||||
<< std::endl;
|
||||
init_msg << "realtime: '" << (has_realtime_priority ? "yes" : "no")
|
||||
<< "'" << std::endl;
|
||||
init_msg << "socket: '" << socket_endpoint.path() << "'" << std::endl;
|
||||
init_msg << "wine prefix: '";
|
||||
|
||||
|
||||
@@ -183,6 +183,14 @@ class PluginBridge {
|
||||
* @see launch_vst_host
|
||||
*/
|
||||
std::unique_ptr<HostProcess> vst_host;
|
||||
|
||||
/**
|
||||
* Whether this process runs with realtime priority. We'll set this _after_
|
||||
* spawning the Wine process because from my testing running wineserver with
|
||||
* realtime priority can actually increase latency.
|
||||
*/
|
||||
bool has_realtime_priority;
|
||||
|
||||
/**
|
||||
* Runs the Boost.Asio `io_context` thread for logging the Wine process
|
||||
* STDOUT and STDERR messages.
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <random>
|
||||
#include <sstream>
|
||||
|
||||
// Generated inside of build directory
|
||||
// Generated inside of the build directory
|
||||
#include <src/common/config/config.h>
|
||||
|
||||
#include "../common/configuration.h"
|
||||
|
||||
Reference in New Issue
Block a user