Add an option to disable VST3 content scaling

This might be necessary when using a HiDPI screen as plugin GUIs often
don't scale correctly under Wine.
This commit is contained in:
Robbert van der Helm
2021-01-14 17:36:00 +01:00
parent 07e84c78b3
commit 5dcedbace5
6 changed files with 52 additions and 12 deletions
+5
View File
@@ -36,6 +36,11 @@ TODO: Add an updated screenshot with some fancy VST3-only plugins to the readme
the refresh rate of a plugin's editor GUI. The default 60 updates per second
may be too high if your computer's cannot keep up, or if you're using a host
that never closes the editor such as Ardour.
- Added a [compatibility
option](https://github.com/robbert-vdh/yabridge#compatibility-options) to
disable HiDPI scaling for VST3 plugins. At the moment Wine does not have
proper HiDPI support, so some plugins might not scale their interfaces
correctly when the host tells those plugins to scale their GUIs.
### Changed
+8 -3
View File
@@ -283,6 +283,7 @@ plugin._
| `editor_double_embed` | `{true,false}` | Compatibility option for plugins that rely on the absolute screen coordinates of the window they're embedded in. Since the Wine window gets embedded inside of a window provided by your DAW, these coordinates won't match up and the plugin would end up drawing in the wrong location without this option. Currently the only known plugins that require this option are _PSPaudioware_ plugins with expandable GUIs, such as E27. Defaults to `false`. |
| `editor_xembed` | `{true,false}` | Use Wine's XEmbed implementation instead of yabridge's normal window embedding method. Some plugins will have redrawing issues when using XEmbed and editor resizing won't always work properly with it, but it could be useful in certain setups. You may need to use [this Wine patch](https://github.com/psycha0s/airwave/blob/master/fix-xembed-wine-windows.patch) if you're getting blank editor windows. Defaults to `false`. _This option is only availble on the master branch._ |
| `frame_rate` | `<number>` | The rate at which Win32 events are being handled and usually also the refresh rate of a plugin's editor GUI. When using plugin groups all plugins share the same event handling loop, so in those the last loaded plugin will set the refresh rate. Defaults to `60`. _This option is only available on the master branch._ |
| `vst3_no_scaling` | `{true,false}` | Disable HiDPI scaling for VST3 plugins. Wine currently does not have proper HiDPI support, so you might have to enable this option if you're using a HiDPI display. Defaults to `false`. _This option is only available on the master branch._ |
These options are workarounds for issues mentioned in the [known
issues](#runtime-dependencies-and-known-issues) section. Depending on the hosts
@@ -348,11 +349,15 @@ deep within in, like this:
["FabFilter*.vst3"]
group = "fabfilter"
vst3_no_scaling = true
["Misstortion2.vst3"]
# This option is not needed and also not recommended, but an example config file
# without any options looks weird
editor_xembed = true
vst3_no_scaling = true
# These options would be applied to all plugins that do not already have their
# own configuration set
["*"]
vst3_no_scaling = true
```
## Troubleshooting common issues
+6
View File
@@ -113,6 +113,12 @@ Configuration::Configuration(const fs::path& config_path,
} else {
invalid_options.push_back(key);
}
} else if (key == "vst3_no_scaling") {
if (const auto parsed_value = value.as_boolean()) {
vst3_no_scaling = parsed_value->get();
} else {
invalid_options.push_back(key);
}
} else {
unknown_options.push_back(key);
}
+10
View File
@@ -122,6 +122,15 @@ class Configuration {
*/
std::optional<float> frame_rate;
/**
* Disable `IPlugViewContentScaleSupport::setContentScaleFactor()`. Wine
* does not properly implement DPI scaling, so without this option plugins
* using GDI+ would draw their editor GUIs at the normal size even though
* their window would actually be scaled. That would result in giant black
* borders at the top and the right of the window.
*/
bool vst3_no_scaling = false;
/**
* The name of the plugin group that should be used for the plugin this
* configuration object was created for. If not set, then the plugin should
@@ -165,6 +174,7 @@ class Configuration {
s.value1b(editor_xembed);
s.ext(frame_rate, bitsery::ext::StdOptional(),
[](S& s, auto& v) { s.value4b(v); });
s.value1b(vst3_no_scaling);
s.ext(group, bitsery::ext::StdOptional(),
[](S& s, auto& v) { s.text1b(v, 4096); });
+3
View File
@@ -171,6 +171,9 @@ class PluginBridge {
<< *config.frame_rate << " fps";
other_options.push_back(option.str());
}
if (config.vst3_no_scaling) {
other_options.push_back("vst3: no GUI scaling");
}
if (!other_options.empty()) {
init_msg << join_quoted_strings(other_options) << std::endl;
} else {
+20 -9
View File
@@ -742,15 +742,26 @@ void Vst3Bridge::run() {
[&](YaPlugViewContentScaleSupport::SetContentScaleFactor& request)
-> YaPlugViewContentScaleSupport::SetContentScaleFactor::
Response {
return main_context
.run_in_context<tresult>([&]() {
return object_instances[request
.owner_instance_id]
.plug_view_instance
->plug_view_content_scale_support
->setContentScaleFactor(request.factor);
})
.get();
if (config.vst3_no_scaling) {
std::cerr << "The host requested the editor GUI to "
"be scaled by a factor of "
<< request.factor
<< ", but the 'vst3_no_scale' option is "
"enabled. Ignoring the request."
<< std::endl;
return Steinberg::kResultFalse;
} else {
return main_context
.run_in_context<tresult>([&]() {
return object_instances
[request.owner_instance_id]
.plug_view_instance
->plug_view_content_scale_support
->setContentScaleFactor(
request.factor);
})
.get();
}
},
[&](YaPluginBase::Initialize& request)
-> YaPluginBase::Initialize::Response {