Rework Vst3MessageHandler::receive_messages

This now takes a regular overloaded function and the visiting is done in
`receive_messages()` itself. This way we can use templates to ensure
that the return type is correct. Otherwise auto will cause issues in the
future when we want to return multiple concrete types from a function
that takes a single variant. The alternative would be both receiving a
variant as a parameter and then returning another variant as a result,
but that is much less type safe.
This commit is contained in:
Robbert van der Helm
2020-12-06 15:09:02 +01:00
parent 7fb8cf97b1
commit 8ea40cd9f9
4 changed files with 20 additions and 22 deletions
+2 -7
View File
@@ -78,13 +78,8 @@ Vst3PluginBridge::Vst3PluginBridge()
host_callback_handler = std::jthread([&]() {
sockets.vst_host_callback.receive_messages(
std::pair<Vst3Logger&, bool>(logger, false),
[&](CallbackRequest request) -> auto {
return std::visit(overload{[&](const WantsConfiguration&)
-> WantsConfiguration::Response {
return config;
}},
request);
});
overload{[&](const WantsConfiguration&)
-> WantsConfiguration::Response { return config; }});
});
// Set up the plugin factory, since this is the first thing the host will