mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 20:10:13 +02:00
049eb257c5
And add separate implementations for the native plugin and the Wine plugin host. This way we can easily allow the native host to do callbacks without having to manage a load of lambdas.
61 lines
2.2 KiB
C++
61 lines
2.2 KiB
C++
// yabridge: a Wine VST bridge
|
|
// Copyright (C) 2020 Robbert van der Helm
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
#include "vst3.h"
|
|
|
|
#include "../boost-fix.h"
|
|
#include "vst3-impls.h"
|
|
|
|
#include <public.sdk/source/vst/hosting/module_win32.cpp>
|
|
|
|
Vst3Bridge::Vst3Bridge(MainContext& main_context,
|
|
std::string plugin_dll_path,
|
|
std::string endpoint_base_dir)
|
|
: HostBridge(plugin_dll_path),
|
|
main_context(main_context),
|
|
sockets(main_context.context, endpoint_base_dir, false) {
|
|
std::string error;
|
|
module = VST3::Hosting::Win32Module::create(plugin_dll_path, error);
|
|
if (!module) {
|
|
throw std::runtime_error("Could not load the VST3 module for '" +
|
|
plugin_dll_path + "': " + error);
|
|
}
|
|
|
|
sockets.connect();
|
|
|
|
// Fetch this instance's configuration from the plugin to finish the setup
|
|
// process
|
|
config = sockets.vst_host_callback.send_message(WantsConfiguration{},
|
|
std::nullopt);
|
|
}
|
|
|
|
void Vst3Bridge::run() {
|
|
// TODO: Remove, this is just for type checking
|
|
if (false) {
|
|
boost::asio::local::stream_protocol::socket* socket;
|
|
Steinberg::IPtr<Steinberg::IPluginFactory> factory;
|
|
YaPluginFactoryHostImpl object(factory);
|
|
write_object(*socket, object);
|
|
}
|
|
|
|
// TODO: Handle events
|
|
// sockets.host_vst_control.receive_messages(
|
|
// std::nullopt, [&](ControlRequest request) -> ControlResponse {
|
|
// });
|
|
|
|
std::cerr << "TODO: Not yet implemented" << std::endl;
|
|
}
|