Show a notification on version mismatch

Between the plugin and the Wine plugin host application.
This commit is contained in:
Robbert van der Helm
2021-07-13 22:14:31 +02:00
parent 4013aea63a
commit 5fc7acccd1
5 changed files with 44 additions and 5 deletions
+3
View File
@@ -23,6 +23,9 @@ Versioning](https://semver.org/spec/v2.0.0.html).
of only printing it to the logger. This makes diagnosing issues much faster if of only printing it to the logger. This makes diagnosing issues much faster if
you didn't already start your DAW from a terminal. These notifications require you didn't already start your DAW from a terminal. These notifications require
`libnotify` and the `notify-send` application to be installed. `libnotify` and the `notify-send` application to be installed.
- Also added a warning and a desktop notification when there's a version
mismatch between the yabridge host application and the plugin to remind you to
rerun `yabridgectl sync`.
- Added an environment variable to disable the watchdog timer. This allows the - Added an environment variable to disable the watchdog timer. This allows the
Wine process to run under a separate namespace. If you don't know that you Wine process to run under a separate namespace. If you don't know that you
need this, then you probably don't need this! need this, then you probably don't need this!
+8 -2
View File
@@ -51,13 +51,19 @@
/** /**
* Marker struct to indicate the other side (the plugin) should send a copy of * Marker struct to indicate the other side (the plugin) should send a copy of
* the configuration. * the configuration. During this process we will also transmit the version
* string from the host, so we can show a little warning when the user forgot to
* rerun `yabridgectl sync` (and the initialization was still successful).
*/ */
struct WantsConfiguration { struct WantsConfiguration {
using Response = Configuration; using Response = Configuration;
std::string host_version;
template <typename S> template <typename S>
void serialize(S&) {} void serialize(S& s) {
s.text1b(host_version, 128);
}
}; };
/** /**
+24
View File
@@ -339,6 +339,30 @@ class PluginBridge {
#endif #endif
} }
/**
* Show a desktop notification if the Wine plugin host is using a different
* version of yabridge than this library. Yabridge may still work (and we do
* this often during development), but at some point a request may fail the
* plugin and the host are out of sync.
*/
void warn_on_version_mismatch(const std::string& host_version) {
if (host_version != yabridge_git_version) {
generic_logger.log(
"WARNING: The host application's version does not match");
generic_logger.log(
" this plugin's. If you just updated yabridge, then");
generic_logger.log(
" you may need rerun 'yabridgectl sync' first to");
generic_logger.log(" update your plugins.");
send_notification(
"Version mismatch",
"If you just updated yabridge, then you may need "
"to rerun 'yabridgectl sync' first to update your plugins.",
true);
}
}
/** /**
* The configuration for this instance of yabridge. Set based on the values * The configuration for this instance of yabridge. Set based on the values
* from a `yabridge.toml`, if it exists. * from a `yabridge.toml`, if it exists.
+4 -1
View File
@@ -63,7 +63,10 @@ Vst3PluginBridge::Vst3PluginBridge()
return Ack{}; return Ack{};
}, },
[&](const WantsConfiguration&) -> WantsConfiguration::Response { [&](const WantsConfiguration& request)
-> WantsConfiguration::Response {
warn_on_version_mismatch(request.host_version);
return config; return config;
}, },
[&](const YaComponentHandler::BeginEdit& request) [&](const YaComponentHandler::BeginEdit& request)
+5 -2
View File
@@ -24,6 +24,9 @@
#include "vst3-impls/host-context-proxy.h" #include "vst3-impls/host-context-proxy.h"
#include "vst3-impls/plug-frame-proxy.h" #include "vst3-impls/plug-frame-proxy.h"
// Generated inside of the build directory
#include <version.h>
// NOLINTNEXTLINE(bugprone-suspicious-include) // NOLINTNEXTLINE(bugprone-suspicious-include)
#include <public.sdk/source/vst/hosting/module_win32.cpp> #include <public.sdk/source/vst/hosting/module_win32.cpp>
@@ -100,8 +103,8 @@ Vst3Bridge::Vst3Bridge(MainContext& main_context,
// Fetch this instance's configuration from the plugin to finish the setup // Fetch this instance's configuration from the plugin to finish the setup
// process // process
config = sockets.vst_host_callback.send_message(WantsConfiguration{}, config = sockets.vst_host_callback.send_message(
std::nullopt); WantsConfiguration{.host_version = yabridge_git_version}, std::nullopt);
// Allow this plugin to configure the main context's tick rate // Allow this plugin to configure the main context's tick rate
main_context.update_timer_interval(config.event_loop_interval()); main_context.update_timer_interval(config.event_loop_interval());