Make YaPluginFactory abstract

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.
This commit is contained in:
Robbert van der Helm
2020-12-05 17:59:31 +01:00
parent 1db3c0371f
commit 049eb257c5
10 changed files with 169 additions and 37 deletions
+33
View File
@@ -0,0 +1,33 @@
// 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-impls.h"
YaPluginFactoryHostImpl::YaPluginFactoryHostImpl(
Steinberg::IPtr<Steinberg::IPluginFactory> factory)
: YaPluginFactory(factory) {}
tresult PLUGIN_API
YaPluginFactoryHostImpl::createInstance(Steinberg::FIDString /*cid*/,
Steinberg::FIDString /*_iid*/,
void** /*obj*/) {
throw std::runtime_error("Unexpected call to 'createInstance()'");
}
tresult PLUGIN_API
YaPluginFactoryHostImpl::setHostContext(Steinberg::FUnknown* /*context*/) {
throw std::runtime_error("Unexpected call to 'setHostContext()'");
}
+31
View File
@@ -0,0 +1,31 @@
// 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/>.
#pragma once
#include "vst3.h"
class YaPluginFactoryHostImpl : public YaPluginFactory {
public:
YaPluginFactoryHostImpl(Steinberg::IPtr<Steinberg::IPluginFactory> factory);
tresult PLUGIN_API createInstance(Steinberg::FIDString cid,
Steinberg::FIDString _iid,
void** obj) override;
tresult PLUGIN_API
setHostContext(Steinberg::FUnknown* /*context*/) override;
};
+4 -2
View File
@@ -17,6 +17,7 @@
#include "vst3.h"
#include "../boost-fix.h"
#include "vst3-impls.h"
#include <public.sdk/source/vst/hosting/module_win32.cpp>
@@ -45,8 +46,9 @@ void Vst3Bridge::run() {
// TODO: Remove, this is just for type checking
if (false) {
boost::asio::local::stream_protocol::socket* socket;
YaPluginFactory* object;
write_object(*socket, *object);
Steinberg::IPtr<Steinberg::IPluginFactory> factory;
YaPluginFactoryHostImpl object(factory);
write_object(*socket, object);
}
// TODO: Handle events