mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Add IComponentHandler to Vst3ComponentHandlerProxy
This commit is contained in:
@@ -83,7 +83,9 @@ vst3_plugin_sources = [
|
||||
'src/common/serialization/vst3/plugin/edit-controller.cpp',
|
||||
'src/common/serialization/vst3/plugin/edit-controller-2.cpp',
|
||||
'src/common/serialization/vst3/plugin/plugin-base.cpp',
|
||||
'src/common/serialization/vst3/component-handler/component-handler.cpp',
|
||||
'src/common/serialization/vst3/base.cpp',
|
||||
'src/common/serialization/vst3/component-handler-proxy.cpp',
|
||||
'src/common/serialization/vst3/event-list.cpp',
|
||||
'src/common/serialization/vst3/host-application.cpp',
|
||||
'src/common/serialization/vst3/param-value-queue.cpp',
|
||||
@@ -128,7 +130,9 @@ if with_vst3
|
||||
'src/common/serialization/vst3/plugin/edit-controller.cpp',
|
||||
'src/common/serialization/vst3/plugin/edit-controller-2.cpp',
|
||||
'src/common/serialization/vst3/plugin/plugin-base.cpp',
|
||||
'src/common/serialization/vst3/component-handler/component-handler.cpp',
|
||||
'src/common/serialization/vst3/base.cpp',
|
||||
'src/common/serialization/vst3/component-handler-proxy.cpp',
|
||||
'src/common/serialization/vst3/event-list.cpp',
|
||||
'src/common/serialization/vst3/host-application.cpp',
|
||||
'src/common/serialization/vst3/param-value-queue.cpp',
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
// 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 "component-handler-proxy.h"
|
||||
|
||||
Vst3ComponentHandlerProxy::ConstructArgs::ConstructArgs() {}
|
||||
|
||||
Vst3ComponentHandlerProxy::ConstructArgs::ConstructArgs(
|
||||
Steinberg::IPtr<Steinberg::FUnknown> object,
|
||||
size_t owner_instance_id)
|
||||
: owner_instance_id(owner_instance_id), component_handler_args(object) {}
|
||||
|
||||
Vst3ComponentHandlerProxy::Vst3ComponentHandlerProxy(const ConstructArgs&& args)
|
||||
: YaComponentHandler(std::move(args.component_handler_args)),
|
||||
arguments(std::move(args)){FUNKNOWN_CTOR}
|
||||
|
||||
Vst3ComponentHandlerProxy::~Vst3ComponentHandlerProxy() {
|
||||
FUNKNOWN_DTOR
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdelete-non-virtual-dtor"
|
||||
IMPLEMENT_REFCOUNT(Vst3ComponentHandlerProxy)
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
tresult PLUGIN_API
|
||||
Vst3ComponentHandlerProxy::queryInterface(Steinberg::FIDString _iid,
|
||||
void** obj) {
|
||||
if (YaComponentHandler::supported()) {
|
||||
QUERY_INTERFACE(_iid, obj, Steinberg::FUnknown::iid,
|
||||
Steinberg::Vst::IComponentHandler)
|
||||
QUERY_INTERFACE(_iid, obj, Steinberg::Vst::IComponentHandler::iid,
|
||||
Steinberg::Vst::IComponentHandler)
|
||||
}
|
||||
|
||||
*obj = nullptr;
|
||||
return Steinberg::kNoInterface;
|
||||
}
|
||||
@@ -17,13 +17,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "../common.h"
|
||||
#include "base.h"
|
||||
#include "host-application.h"
|
||||
#include "plugin/audio-processor.h"
|
||||
#include "plugin/component.h"
|
||||
#include "plugin/connection-point.h"
|
||||
#include "plugin/edit-controller.h"
|
||||
#include "plugin/plugin-base.h"
|
||||
#include "component-handler/component-handler.h"
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
|
||||
@@ -36,7 +30,7 @@
|
||||
* plugin we are proxying for the `IComponentHandler*` argument passed to plugin
|
||||
* by the host.
|
||||
*/
|
||||
class Vst3ComponentHandlerProxy {
|
||||
class Vst3ComponentHandlerProxy : public YaComponentHandler {
|
||||
public:
|
||||
/**
|
||||
* These are the arguments for constructing a
|
||||
@@ -60,22 +54,12 @@ class Vst3ComponentHandlerProxy {
|
||||
*/
|
||||
native_size_t owner_instance_id;
|
||||
|
||||
// TODO:
|
||||
// YaAudioProcessor::ConstructArgs audio_processor_args;
|
||||
// YaComponent::ConstructArgs component_args;
|
||||
// YaConnectionPoint::ConstructArgs connection_point_args;
|
||||
// YaEditController::ConstructArgs edit_controller_2_args;
|
||||
// YaPluginBase::ConstructArgs plugin_base_args;
|
||||
YaComponentHandler::ConstructArgs component_handler_args;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value8b(owner_instance_id);
|
||||
// TODO:
|
||||
// s.object(audio_processor_args);
|
||||
// s.object(component_args);
|
||||
// s.object(connection_point_args);
|
||||
// s.object(edit_controller_2_args);
|
||||
// s.object(plugin_base_args);
|
||||
s.object(component_handler_args);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// 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 "component-handler.h"
|
||||
|
||||
YaComponentHandler::ConstructArgs::ConstructArgs() {}
|
||||
|
||||
YaComponentHandler::ConstructArgs::ConstructArgs(
|
||||
Steinberg::IPtr<Steinberg::FUnknown> object)
|
||||
: supported(
|
||||
Steinberg::FUnknownPtr<Steinberg::Vst::IComponentHandler>(object)) {}
|
||||
|
||||
YaComponentHandler::YaComponentHandler(const ConstructArgs&& args)
|
||||
: arguments(std::move(args)) {}
|
||||
@@ -0,0 +1,76 @@
|
||||
// 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 <pluginterfaces/vst/ivsteditcontroller.h>
|
||||
|
||||
#include "../../common.h"
|
||||
#include "../base.h"
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
|
||||
|
||||
/**
|
||||
* Wraps around `IComponentHandler` for serialization purposes. This is
|
||||
* instantiated as part of `Vst3ComponentHandlerProxy`.
|
||||
*/
|
||||
class YaComponentHandler : public Steinberg::Vst::IComponentHandler {
|
||||
public:
|
||||
/**
|
||||
* These are the arguments for creating a `YaComponentHandler`.
|
||||
*/
|
||||
struct ConstructArgs {
|
||||
ConstructArgs();
|
||||
|
||||
/**
|
||||
* Check whether an existing implementation implements
|
||||
* `IComponentHandler` and read arguments from it.
|
||||
*/
|
||||
ConstructArgs(Steinberg::IPtr<Steinberg::FUnknown> object);
|
||||
|
||||
/**
|
||||
* Whether the object supported this interface.
|
||||
*/
|
||||
bool supported;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value1b(supported);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Instantiate this instance with arguments read from another interface
|
||||
* implementation.
|
||||
*/
|
||||
YaComponentHandler(const ConstructArgs&& args);
|
||||
|
||||
inline bool supported() const { return arguments.supported; }
|
||||
|
||||
virtual tresult PLUGIN_API
|
||||
beginEdit(Steinberg::Vst::ParamID id) override = 0;
|
||||
virtual tresult PLUGIN_API
|
||||
performEdit(Steinberg::Vst::ParamID id,
|
||||
Steinberg::Vst::ParamValue valueNormalized) override = 0;
|
||||
virtual tresult PLUGIN_API endEdit(Steinberg::Vst::ParamID id) override = 0;
|
||||
virtual tresult PLUGIN_API restartComponent(int32 flags) override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
Reference in New Issue
Block a user