mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-09 20:29:10 +02:00
Allow an option set_realtime_priority() to revert
This commit is contained in:
@@ -31,7 +31,8 @@ fs::path get_temporary_directory() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool set_realtime_priority() {
|
bool set_realtime_priority(bool sched_fifo) {
|
||||||
sched_param params{.sched_priority = 5};
|
sched_param params{.sched_priority = 5};
|
||||||
return sched_setscheduler(0, SCHED_FIFO, ¶ms) == 0;
|
return sched_setscheduler(0, sched_fifo ? SCHED_FIFO : SCHED_OTHER,
|
||||||
|
¶ms) == 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -41,7 +41,10 @@ boost::filesystem::path get_temporary_directory();
|
|||||||
* We explicitly don't do this for wineserver itself since from my testing that
|
* We explicitly don't do this for wineserver itself since from my testing that
|
||||||
* can actually increase latencies.
|
* can actually increase latencies.
|
||||||
*
|
*
|
||||||
|
* @param sched_fifo If true, set the current process/thread's scheudling policy
|
||||||
|
* to `SCHED_FIFO`. Otherwise reset it back to `SCHWED_OTHER`.
|
||||||
|
*
|
||||||
* @return Whether the operation was successful or not. This will fail if the
|
* @return Whether the operation was successful or not. This will fail if the
|
||||||
* user does not have the privileges to set realtime priorities.
|
* user does not have the privileges to set realtime priorities.
|
||||||
*/
|
*/
|
||||||
bool set_realtime_priority();
|
bool set_realtime_priority(bool sched_fifo);
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ class PluginBridge {
|
|||||||
info.windows_plugin_path.string(),
|
info.windows_plugin_path.string(),
|
||||||
.endpoint_base_dir =
|
.endpoint_base_dir =
|
||||||
sockets.base_dir.string()}))),
|
sockets.base_dir.string()}))),
|
||||||
has_realtime_priority(set_realtime_priority()),
|
has_realtime_priority(set_realtime_priority(true)),
|
||||||
wine_io_handler([&]() { io_context.run(); }) {}
|
wine_io_handler([&]() { io_context.run(); }) {}
|
||||||
|
|
||||||
virtual ~PluginBridge(){};
|
virtual ~PluginBridge(){};
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ int __attribute__((visibility("default")))
|
|||||||
__cdecl
|
__cdecl
|
||||||
#endif
|
#endif
|
||||||
main(int argc, char* argv[]) {
|
main(int argc, char* argv[]) {
|
||||||
set_realtime_priority();
|
set_realtime_priority(true);
|
||||||
|
|
||||||
// Instead of directly hosting a plugin, this process will receive a UNIX
|
// Instead of directly hosting a plugin, this process will receive a UNIX
|
||||||
// domain socket endpoint path that it should listen on to allow yabridge
|
// domain socket endpoint path that it should listen on to allow yabridge
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ int __attribute__((visibility("default")))
|
|||||||
__cdecl
|
__cdecl
|
||||||
#endif
|
#endif
|
||||||
main(int argc, char* argv[]) {
|
main(int argc, char* argv[]) {
|
||||||
set_realtime_priority();
|
set_realtime_priority(true);
|
||||||
|
|
||||||
// We pass plugin format, the name of the VST2 plugin .dll file or VST3
|
// We pass plugin format, the name of the VST2 plugin .dll file or VST3
|
||||||
// bundle to load, and the base directory for the Unix domain socket
|
// bundle to load, and the base directory for the Unix domain socket
|
||||||
|
|||||||
Reference in New Issue
Block a user