mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-10 04:30:12 +02:00
Send the factory from the Wine host to the plugin
This commit is contained in:
@@ -178,7 +178,7 @@ class Vst3MessageHandler : public AdHocSocketHandler<Thread> {
|
|||||||
request);
|
request);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto response = callback(request);
|
const auto& response = callback(request);
|
||||||
if (logging) {
|
if (logging) {
|
||||||
auto [logger, is_host_vst] = *logging;
|
auto [logger, is_host_vst] = *logging;
|
||||||
logger.log_response(!is_host_vst, response);
|
logger.log_response(!is_host_vst, response);
|
||||||
|
|||||||
@@ -50,7 +50,9 @@ struct WantsConfiguration {
|
|||||||
* copy of the hosted Windows VST3 plugin's `IPluginFactory{,2,3}` interface.
|
* copy of the hosted Windows VST3 plugin's `IPluginFactory{,2,3}` interface.
|
||||||
*/
|
*/
|
||||||
struct WantsPluginFactory {
|
struct WantsPluginFactory {
|
||||||
using Response = YaPluginFactory;
|
// TODO: Some things had to be changed to use references since this is an
|
||||||
|
// abstract class. Check if nothing breaks.
|
||||||
|
using Response = YaPluginFactory&;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -73,6 +73,10 @@ SMTG_EXPORT_SYMBOL Steinberg::IPluginFactory* PLUGIN_API GetPluginFactory() {
|
|||||||
// The host should have called `InitModule()` first
|
// The host should have called `InitModule()` first
|
||||||
assert(bridge);
|
assert(bridge);
|
||||||
|
|
||||||
|
// TODO: I think there is a flag that indicates that the class configuration
|
||||||
|
// may change, but I don't remember if it's at runtime or every time
|
||||||
|
// the module is loaded. If it's the former then this will take some
|
||||||
|
// special handling.
|
||||||
return bridge->plugin_factory.get();
|
return bridge->plugin_factory.get();
|
||||||
|
|
||||||
// TODO: In the normal implementation of this function they manually call
|
// TODO: In the normal implementation of this function they manually call
|
||||||
|
|||||||
@@ -36,6 +36,11 @@ Vst3Bridge::Vst3Bridge(MainContext& main_context,
|
|||||||
|
|
||||||
sockets.connect();
|
sockets.connect();
|
||||||
|
|
||||||
|
// Serialize the plugin's plugin factory. The native VST3 plugin will
|
||||||
|
// request a copy of this during its initialization.
|
||||||
|
plugin_factory =
|
||||||
|
std::make_unique<YaPluginFactoryHostImpl>(module->getFactory().get());
|
||||||
|
|
||||||
// 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(WantsConfiguration{},
|
||||||
@@ -43,18 +48,12 @@ Vst3Bridge::Vst3Bridge(MainContext& main_context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Vst3Bridge::run() {
|
void Vst3Bridge::run() {
|
||||||
// TODO: Remove, this is just for type checking
|
sockets.host_vst_control.receive_messages(
|
||||||
if (false) {
|
std::nullopt, [&](ControlRequest request) -> auto& {
|
||||||
boost::asio::local::stream_protocol::socket* socket;
|
return std::visit(overload{[&](const WantsPluginFactory&)
|
||||||
Steinberg::IPtr<Steinberg::IPluginFactory> factory;
|
-> WantsPluginFactory::Response {
|
||||||
YaPluginFactoryHostImpl object(factory);
|
return *plugin_factory;
|
||||||
write_object(*socket, object);
|
}},
|
||||||
}
|
request);
|
||||||
|
});
|
||||||
// TODO: Handle events
|
|
||||||
// sockets.host_vst_control.receive_messages(
|
|
||||||
// std::nullopt, [&](ControlRequest request) -> ControlResponse {
|
|
||||||
// });
|
|
||||||
|
|
||||||
std::cerr << "TODO: Not yet implemented" << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,4 +83,11 @@ class Vst3Bridge : public HostBridge {
|
|||||||
* threads to exit.
|
* threads to exit.
|
||||||
*/
|
*/
|
||||||
Vst3Sockets<Win32Thread> sockets;
|
Vst3Sockets<Win32Thread> sockets;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A plugin factory copied from the Windows VST3 plugin during
|
||||||
|
* initialization. The native VST3 plugin will request a copy of this
|
||||||
|
* information during its initialization.
|
||||||
|
*/
|
||||||
|
std::unique_ptr<YaPluginFactory> plugin_factory;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user