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
+34
View File
@@ -0,0 +1,34 @@
// 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"
YaPluginFactoryPluginImpl::YaPluginFactoryPluginImpl(Vst3PluginBridge& bridge)
: bridge(bridge) {}
tresult PLUGIN_API
YaPluginFactoryPluginImpl::createInstance(Steinberg::FIDString /*cid*/,
Steinberg::FIDString /*_iid*/,
void** /*obj*/) {
// TODO: Send a control message
return 0;
}
tresult PLUGIN_API
YaPluginFactoryPluginImpl::setHostContext(Steinberg::FUnknown* /*context*/) {
// TODO: Send a control message
return 0;
}
+36
View File
@@ -0,0 +1,36 @@
// 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"
// These are implementation of the serialization clases in
// `src/common/serialization/vst3/` to provide callback support
class YaPluginFactoryPluginImpl : public YaPluginFactory {
public:
YaPluginFactoryPluginImpl(Vst3PluginBridge& bridge);
tresult PLUGIN_API createInstance(Steinberg::FIDString cid,
Steinberg::FIDString _iid,
void** obj) override;
tresult PLUGIN_API setHostContext(Steinberg::FUnknown* context) override;
private:
Vst3PluginBridge& bridge;
};
+5 -2
View File
@@ -17,6 +17,9 @@
#include <public.sdk/source/main/pluginfactory.h>
#include "bridges/vst3.h"
// TODO: Remove include, instantiating and returning the `YaPluginFactory`
// should be done in `Vst3PluginBridge`
#include "src/plugin/bridges/vst3-impls.h"
#include <public.sdk/source/main/linuxmain.cpp>
@@ -87,8 +90,8 @@ SMTG_EXPORT_SYMBOL Steinberg::IPluginFactory* PLUGIN_API GetPluginFactory() {
// TODO: Remove, this is just for type checking
if (false) {
boost::asio::local::stream_protocol::socket* socket;
YaPluginFactory* object;
write_object(*socket, *object);
YaPluginFactoryPluginImpl object(*bridge);
write_object(*socket, object);
}
if (!gPluginFactory) {