mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-16 21:50:11 +02:00
Add Vst3PlugViewProxy
This commit is contained in:
@@ -92,6 +92,7 @@ vst3_plugin_sources = [
|
|||||||
'src/common/serialization/vst3/host-context-proxy.cpp',
|
'src/common/serialization/vst3/host-context-proxy.cpp',
|
||||||
'src/common/serialization/vst3/param-value-queue.cpp',
|
'src/common/serialization/vst3/param-value-queue.cpp',
|
||||||
'src/common/serialization/vst3/parameter-changes.cpp',
|
'src/common/serialization/vst3/parameter-changes.cpp',
|
||||||
|
'src/common/serialization/vst3/plug-view-proxy.cpp',
|
||||||
'src/common/serialization/vst3/plugin-proxy.cpp',
|
'src/common/serialization/vst3/plugin-proxy.cpp',
|
||||||
'src/common/serialization/vst3/plugin-factory.cpp',
|
'src/common/serialization/vst3/plugin-factory.cpp',
|
||||||
'src/common/serialization/vst3/process-data.cpp',
|
'src/common/serialization/vst3/process-data.cpp',
|
||||||
@@ -141,6 +142,7 @@ if with_vst3
|
|||||||
'src/common/serialization/vst3/host-context-proxy.cpp',
|
'src/common/serialization/vst3/host-context-proxy.cpp',
|
||||||
'src/common/serialization/vst3/param-value-queue.cpp',
|
'src/common/serialization/vst3/param-value-queue.cpp',
|
||||||
'src/common/serialization/vst3/parameter-changes.cpp',
|
'src/common/serialization/vst3/parameter-changes.cpp',
|
||||||
|
'src/common/serialization/vst3/plug-view-proxy.cpp',
|
||||||
'src/common/serialization/vst3/plugin-proxy.cpp',
|
'src/common/serialization/vst3/plugin-proxy.cpp',
|
||||||
'src/common/serialization/vst3/plugin-factory.cpp',
|
'src/common/serialization/vst3/plugin-factory.cpp',
|
||||||
'src/common/serialization/vst3/process-data.cpp',
|
'src/common/serialization/vst3/process-data.cpp',
|
||||||
|
|||||||
@@ -7,16 +7,18 @@ serialization works.
|
|||||||
|
|
||||||
VST3 plugin interfaces are implemented as follows:
|
VST3 plugin interfaces are implemented as follows:
|
||||||
|
|
||||||
| yabridge class | Included in | Interfaces |
|
| yabridge class | Included in | Interfaces |
|
||||||
| ------------------- | ----------------- | ------------------------------------------------------ |
|
| ------------------- | ------------------- | ------------------------------------------------------ |
|
||||||
| `YaPluginFactory` | | `IPluginFactory`, `IPluginFactory2`, `IPluginFactory3` |
|
| `YaPluginFactory` | | `IPluginFactory`, `IPluginFactory2`, `IPluginFactory3` |
|
||||||
| `Vst3PluginProxy` | | All of the below: |
|
| `Vst3PlugViewProxy` | | All of the below: |
|
||||||
| `YaAudioProcessor` | `Vst3PluginProxy` | `IAudioProcessor` |
|
| `YaPlugView` | `Vst3PlugViewProxy` | `IPlugView` |
|
||||||
| `YaComponent` | `Vst3PluginProxy` | `IComponent` |
|
| `Vst3PluginProxy` | | All of the below: |
|
||||||
| `YaConnectionPoint` | `Vst3PluginProxy` | `IConnectionPoint` |
|
| `YaAudioProcessor` | `Vst3PluginProxy` | `IAudioProcessor` |
|
||||||
| `YaEditController` | `Vst3PluginProxy` | `IEditController` |
|
| `YaComponent` | `Vst3PluginProxy` | `IComponent` |
|
||||||
| `YaEditController2` | `Vst3PluginProxy` | `IEditController2` |
|
| `YaConnectionPoint` | `Vst3PluginProxy` | `IConnectionPoint` |
|
||||||
| `YaPluginBase` | `Vst3PluginProxy` | `IPluginBase` |
|
| `YaEditController` | `Vst3PluginProxy` | `IEditController` |
|
||||||
|
| `YaEditController2` | `Vst3PluginProxy` | `IEditController2` |
|
||||||
|
| `YaPluginBase` | `Vst3PluginProxy` | `IPluginBase` |
|
||||||
|
|
||||||
VST3 host interfaces are implemented as follows:
|
VST3 host interfaces are implemented as follows:
|
||||||
|
|
||||||
|
|||||||
@@ -28,9 +28,9 @@
|
|||||||
// Yet Another layer of includes, but these are some VST3-specific typedefs that
|
// Yet Another layer of includes, but these are some VST3-specific typedefs that
|
||||||
// we'll need for all of our interfaces
|
// we'll need for all of our interfaces
|
||||||
|
|
||||||
using Steinberg::TBool, Steinberg::int8, Steinberg::int16, Steinberg::int32,
|
using Steinberg::TBool, Steinberg::char16, Steinberg::int8, Steinberg::int16,
|
||||||
Steinberg::int64, Steinberg::uint8, Steinberg::uint16, Steinberg::uint32,
|
Steinberg::int32, Steinberg::int64, Steinberg::uint8, Steinberg::uint16,
|
||||||
Steinberg::uint64, Steinberg::tresult;
|
Steinberg::uint32, Steinberg::uint64, Steinberg::tresult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Both `TUID` (`int8_t[16]`) and `FIDString` (`char*`) are hard to work with
|
* Both `TUID` (`int8_t[16]`) and `FIDString` (`char*`) are hard to work with
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class Vst3ComponentHandlerProxy : public YaComponentHandler {
|
|||||||
* dropped a corresponding `Vst3ComponentHandlerProxyImpl` should also be
|
* dropped a corresponding `Vst3ComponentHandlerProxyImpl` should also be
|
||||||
* dropped.
|
* dropped.
|
||||||
*/
|
*/
|
||||||
virtual ~Vst3ComponentHandlerProxy() = 0;
|
virtual ~Vst3ComponentHandlerProxy();
|
||||||
|
|
||||||
DECLARE_FUNKNOWN_METHODS
|
DECLARE_FUNKNOWN_METHODS
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class Vst3HostContextProxy : public YaHostApplication {
|
|||||||
* dropped a corresponding `Vst3HostContextProxyImpl` should also be
|
* dropped a corresponding `Vst3HostContextProxyImpl` should also be
|
||||||
* dropped.
|
* dropped.
|
||||||
*/
|
*/
|
||||||
virtual ~Vst3HostContextProxy() = 0;
|
virtual ~Vst3HostContextProxy();
|
||||||
|
|
||||||
DECLARE_FUNKNOWN_METHODS
|
DECLARE_FUNKNOWN_METHODS
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
// 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 "plug-view-proxy.h"
|
||||||
|
|
||||||
|
Vst3PlugViewProxy::ConstructArgs::ConstructArgs() {}
|
||||||
|
|
||||||
|
Vst3PlugViewProxy::ConstructArgs::ConstructArgs(
|
||||||
|
Steinberg::IPtr<Steinberg::FUnknown> object,
|
||||||
|
size_t owner_instance_id)
|
||||||
|
: owner_instance_id(owner_instance_id), plug_view_args(object) {}
|
||||||
|
|
||||||
|
Vst3PlugViewProxy::Vst3PlugViewProxy(const ConstructArgs&& args)
|
||||||
|
: YaPlugView(std::move(args.plug_view_args)),
|
||||||
|
arguments(std::move(args)){FUNKNOWN_CTOR}
|
||||||
|
|
||||||
|
Vst3PlugViewProxy::~Vst3PlugViewProxy() {
|
||||||
|
FUNKNOWN_DTOR
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdelete-non-virtual-dtor"
|
||||||
|
IMPLEMENT_REFCOUNT(Vst3PlugViewProxy)
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
|
tresult PLUGIN_API Vst3PlugViewProxy::queryInterface(Steinberg::FIDString _iid,
|
||||||
|
void** obj) {
|
||||||
|
if (YaPlugView::supported()) {
|
||||||
|
QUERY_INTERFACE(_iid, obj, Steinberg::FUnknown::iid,
|
||||||
|
Steinberg::IPlugView)
|
||||||
|
QUERY_INTERFACE(_iid, obj, Steinberg::IPlugView::iid,
|
||||||
|
Steinberg::IPlugView)
|
||||||
|
}
|
||||||
|
|
||||||
|
*obj = nullptr;
|
||||||
|
return Steinberg::kNoInterface;
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
// 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 "../common.h"
|
||||||
|
#include "plug-view/plug-view.h"
|
||||||
|
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An abstract class that implements `IPlugView`, and optionally also all
|
||||||
|
* extensions to `IPlugView` depending on what the plugin's implementation
|
||||||
|
* supports. This provides a proxy for the `IPlugView*` returned by a plugin on
|
||||||
|
* `IEditController::createView()`, and it works exactly the same as
|
||||||
|
* `Vst3PluginProxy`.
|
||||||
|
*/
|
||||||
|
class Vst3PlugViewProxy : public YaPlugView {
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* These are the arguments for constructing a
|
||||||
|
* `Vst3PlugViewProxyImpl`.
|
||||||
|
*/
|
||||||
|
struct ConstructArgs {
|
||||||
|
ConstructArgs();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read from an existing object. We will try to mimic this object, so
|
||||||
|
* we'll support any interfaces this object also supports.
|
||||||
|
*/
|
||||||
|
ConstructArgs(Steinberg::IPtr<FUnknown> object,
|
||||||
|
size_t owner_instance_id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The unique instance identifier of the proxy object that returned this
|
||||||
|
* `IPlugView*`. This way we can refer to the correct 'actual'
|
||||||
|
* `IPlugView*` when the host calls a function on this object.
|
||||||
|
*/
|
||||||
|
native_size_t owner_instance_id;
|
||||||
|
|
||||||
|
YaPlugView::ConstructArgs plug_view_args;
|
||||||
|
|
||||||
|
template <typename S>
|
||||||
|
void serialize(S& s) {
|
||||||
|
s.value8b(owner_instance_id);
|
||||||
|
s.object(plug_view_args);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiate this instance with arguments read from an actual component
|
||||||
|
* handler.
|
||||||
|
*
|
||||||
|
* @note Since this is passed as part of `IEditController::createView()`,
|
||||||
|
* there are is no direct `Construct`
|
||||||
|
* message. The destructor should still send a message to drop the
|
||||||
|
* original smart pointer.
|
||||||
|
*/
|
||||||
|
Vst3PlugViewProxy(const ConstructArgs&& args);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @remark The plugin side implementation should send a control message to
|
||||||
|
* clean up the instance on the Wine side in its destructor.
|
||||||
|
*/
|
||||||
|
virtual ~Vst3PlugViewProxy() = 0;
|
||||||
|
|
||||||
|
DECLARE_FUNKNOWN_METHODS
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the instance ID of the owner of this object.
|
||||||
|
*/
|
||||||
|
inline size_t owner_instance_id() const {
|
||||||
|
return arguments.owner_instance_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
ConstructArgs arguments;
|
||||||
|
};
|
||||||
|
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
Reference in New Issue
Block a user