mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Allow changing the event loop tick rate
This also changes the refresh rate for most plugins. You can now lower this setting if your computer is struggling to keep up with rendering a certain heavy plugin.
This commit is contained in:
@@ -96,6 +96,12 @@ Configuration::Configuration(const fs::path& config_path,
|
||||
} else {
|
||||
invalid_options.push_back(key);
|
||||
}
|
||||
} else if (key == "frame_rate") {
|
||||
if (const auto parsed_value = value.as_floating_point()) {
|
||||
frame_rate = parsed_value->get();
|
||||
} else {
|
||||
invalid_options.push_back(key);
|
||||
}
|
||||
} else if (key == "group") {
|
||||
if (const auto parsed_value = value.as_string()) {
|
||||
group = parsed_value->get();
|
||||
@@ -110,3 +116,8 @@ Configuration::Configuration(const fs::path& config_path,
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::chrono::steady_clock::duration Configuration::event_loop_interval() const {
|
||||
return std::chrono::duration_cast<std::chrono::steady_clock::duration>(
|
||||
std::chrono::milliseconds(1000) / frame_rate.value_or(60.0));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user