mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-08 12:30:12 +02:00
Allow hiding the DAW name for VST2 plugins
This can be useful when plugins have (broken) host-specific behaviour that you want to avoid. I'll later add a list of host/plugin combinations where this may be useful to the readme.
This commit is contained in:
@@ -119,6 +119,12 @@ Configuration::Configuration(const fs::path& config_path,
|
||||
} else {
|
||||
invalid_options.push_back(key);
|
||||
}
|
||||
} else if (key == "hide_daw") {
|
||||
if (const auto parsed_value = value.as_boolean()) {
|
||||
hide_daw = parsed_value->get();
|
||||
} 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();
|
||||
|
||||
@@ -138,6 +138,15 @@ class Configuration {
|
||||
*/
|
||||
std::optional<float> frame_rate;
|
||||
|
||||
/**
|
||||
* When this option is enabled, we'll report some random other string
|
||||
* instead of the actual name of the host when the plugin queries it. This
|
||||
* can sometimes be useful when a plugin has undesirable host-specific
|
||||
* behaviour. See the readme for some examples of where this might be
|
||||
* useful.
|
||||
*/
|
||||
bool hide_daw = false;
|
||||
|
||||
/**
|
||||
* Disable `IPlugViewContentScaleSupport::setContentScaleFactor()`. Wine
|
||||
* does not properly implement fractional DPI scaling, so without this
|
||||
@@ -198,6 +207,7 @@ class Configuration {
|
||||
s.value1b(editor_xembed);
|
||||
s.ext(frame_rate, bitsery::ext::StdOptional(),
|
||||
[](S& s, auto& v) { s.value4b(v); });
|
||||
s.value1b(hide_daw);
|
||||
s.value1b(vst3_no_scaling);
|
||||
s.value1b(vst3_prefer_32bit);
|
||||
|
||||
|
||||
@@ -31,6 +31,20 @@
|
||||
*/
|
||||
constexpr time_t audio_thread_priority_synchronization_interval = 10;
|
||||
|
||||
/**
|
||||
* When the `hide_daw` compatibility option is enabled, we'll report this
|
||||
* instead of the actual DAW's name. This can be useful when plugins are
|
||||
* hardcoded to behave differently in certain DAWs, and when that different
|
||||
* behaviour causes issues under Wine. Examples of this are Melodyne 5 under
|
||||
* REAPER, and AAS Chromaphone 3 under Bitwig.
|
||||
*/
|
||||
constexpr char product_name_override[] = "Get yabridge'd";
|
||||
/**
|
||||
* When the `hide_daw` compatibility option is enabled, we'll report this
|
||||
* instead of the actual vendor's name in a VST2 plugin.
|
||||
*/
|
||||
constexpr char vendor_name_override[] = "yabridge";
|
||||
|
||||
// The cannonical overloading template for `std::visitor`, not sure why this
|
||||
// isn't part of the standard library
|
||||
template <class... Ts>
|
||||
|
||||
@@ -193,6 +193,9 @@ class PluginBridge {
|
||||
<< *config.frame_rate << " fps";
|
||||
other_options.push_back(option.str());
|
||||
}
|
||||
if (config.hide_daw) {
|
||||
other_options.push_back("hack: hide DAW name");
|
||||
}
|
||||
if (config.vst3_no_scaling) {
|
||||
other_options.push_back("vst3: no GUI scaling");
|
||||
}
|
||||
|
||||
+44
-11
@@ -90,11 +90,10 @@ Vst2PluginBridge::Vst2PluginBridge(audioMasterCallback host_callback)
|
||||
|
||||
incoming_midi_events.push_back(
|
||||
std::get<DynamicVstEvents>(event.payload));
|
||||
EventResult response{.return_value = 1,
|
||||
.payload = nullptr,
|
||||
.value_payload = std::nullopt};
|
||||
|
||||
return response;
|
||||
return EventResult{.return_value = 1,
|
||||
.payload = nullptr,
|
||||
.value_payload = std::nullopt};
|
||||
} break;
|
||||
// REAPER requires that `audioMasterSizeWindow()` calls are
|
||||
// handled from the GUI thread, which is the thread that
|
||||
@@ -105,16 +104,50 @@ Vst2PluginBridge::Vst2PluginBridge(audioMasterCallback host_callback)
|
||||
std::lock_guard lock(incoming_resize_mutex);
|
||||
|
||||
incoming_resize = std::pair(event.index, event.value);
|
||||
EventResult response{.return_value = 1,
|
||||
.payload = nullptr,
|
||||
.value_payload = std::nullopt};
|
||||
|
||||
return response;
|
||||
return EventResult{.return_value = 1,
|
||||
.payload = nullptr,
|
||||
.value_payload = std::nullopt};
|
||||
} break;
|
||||
// HACK: Certain plugins may have undesirable DAW-specific
|
||||
// behaviour. Chromaphone 3 for instance has broken
|
||||
// text input dialogs when using Bitwig. We can work
|
||||
// around these issues by reporting we're running
|
||||
// under some other host. We need to do this on the
|
||||
// plugin side instead of one the Wine side because
|
||||
// the plugin will likely do this callback during
|
||||
// initialization, and at that point we will not yet
|
||||
// have sent the configuration to the plugin.
|
||||
case audioMasterGetProductString: {
|
||||
if (config.hide_daw) {
|
||||
logger.log("The plugin asked for the host's name.");
|
||||
logger.log("Reporting \"" +
|
||||
std::string(product_name_override) +
|
||||
"\" instead of the actual host's name.");
|
||||
|
||||
return EventResult{.return_value = 1,
|
||||
.payload = product_name_override,
|
||||
.value_payload = std::nullopt};
|
||||
}
|
||||
} break;
|
||||
case audioMasterGetVendorString: {
|
||||
if (config.hide_daw) {
|
||||
logger.log(
|
||||
"The plugin asked for the host's vendor.");
|
||||
logger.log(
|
||||
"Reporting \"" +
|
||||
std::string(vendor_name_override) +
|
||||
"\" instead of the actual host's vendor.");
|
||||
|
||||
return EventResult{.return_value = 1,
|
||||
.payload = vendor_name_override,
|
||||
.value_payload = std::nullopt};
|
||||
}
|
||||
} break;
|
||||
default:
|
||||
return passthrough_event(&plugin,
|
||||
host_callback_function, event);
|
||||
}
|
||||
|
||||
return passthrough_event(&plugin, host_callback_function,
|
||||
event);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user