mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Split YaEditController into YaEditController{,2}
Since even though the title would make you assume it's a versioned interface, it's not.
This commit is contained in:
@@ -81,6 +81,7 @@ vst3_plugin_sources = [
|
||||
'src/common/serialization/vst3/plugin/component.cpp',
|
||||
'src/common/serialization/vst3/plugin/connection-point.cpp',
|
||||
'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/base.cpp',
|
||||
'src/common/serialization/vst3/event-list.cpp',
|
||||
@@ -125,6 +126,7 @@ if with_vst3
|
||||
'src/common/serialization/vst3/plugin/component.cpp',
|
||||
'src/common/serialization/vst3/plugin/connection-point.cpp',
|
||||
'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/base.cpp',
|
||||
'src/common/serialization/vst3/event-list.cpp',
|
||||
|
||||
@@ -14,7 +14,8 @@ VST3 plugin interfaces are implemented as follows:
|
||||
| `YaAudioProcessor` | `Vst3PluginProxy` | `IAudioProcessor` |
|
||||
| `YaComponent` | `Vst3PluginProxy` | `IComponent` |
|
||||
| `YaConnectionPoint` | `Vst3PluginProxy` | `IConnectionPoint` |
|
||||
| `YaEditController` | `Vst3PluginProxy` | `IEditController`, `IEditController2` |
|
||||
| `YaEditController` | `Vst3PluginProxy` | `IEditController` |
|
||||
| `YaEditController2` | `Vst3PluginProxy` | `IEditController2` |
|
||||
| `YaPluginBase` | `Vst3PluginProxy` | `IPluginBase` |
|
||||
|
||||
VST3 host interfaces are implemented as follows:
|
||||
|
||||
@@ -25,6 +25,7 @@ Vst3PluginProxy::ConstructArgs::ConstructArgs(
|
||||
audio_processor_args(object),
|
||||
component_args(object),
|
||||
connection_point_args(object),
|
||||
edit_controller_args(object),
|
||||
edit_controller_2_args(object),
|
||||
plugin_base_args(object) {}
|
||||
|
||||
@@ -32,7 +33,8 @@ Vst3PluginProxy::Vst3PluginProxy(const ConstructArgs&& args)
|
||||
: YaAudioProcessor(std::move(args.audio_processor_args)),
|
||||
YaComponent(std::move(args.component_args)),
|
||||
YaConnectionPoint(std::move(args.connection_point_args)),
|
||||
YaEditController(std::move(args.edit_controller_2_args)),
|
||||
YaEditController(std::move(args.edit_controller_args)),
|
||||
YaEditController2(std::move(args.edit_controller_2_args)),
|
||||
YaPluginBase(std::move(args.plugin_base_args)),
|
||||
arguments(std::move(args)){FUNKNOWN_CTOR}
|
||||
|
||||
@@ -77,11 +79,11 @@ tresult PLUGIN_API Vst3PluginProxy::queryInterface(Steinberg::FIDString _iid,
|
||||
QUERY_INTERFACE(_iid, obj, Steinberg::Vst::IConnectionPoint::iid,
|
||||
Steinberg::Vst::IConnectionPoint)
|
||||
}
|
||||
if (YaEditController::supported_version_1()) {
|
||||
if (YaEditController::supported()) {
|
||||
QUERY_INTERFACE(_iid, obj, Steinberg::Vst::IEditController::iid,
|
||||
Steinberg::Vst::IEditController)
|
||||
}
|
||||
if (YaEditController::supported_version_2()) {
|
||||
if (YaEditController2::supported()) {
|
||||
QUERY_INTERFACE(_iid, obj, Steinberg::Vst::IEditController2::iid,
|
||||
Steinberg::Vst::IEditController2)
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "plugin/audio-processor.h"
|
||||
#include "plugin/component.h"
|
||||
#include "plugin/connection-point.h"
|
||||
#include "plugin/edit-controller-2.h"
|
||||
#include "plugin/edit-controller.h"
|
||||
#include "plugin/plugin-base.h"
|
||||
|
||||
@@ -55,6 +56,7 @@ class Vst3PluginProxy : public YaAudioProcessor,
|
||||
public YaComponent,
|
||||
public YaConnectionPoint,
|
||||
public YaEditController,
|
||||
public YaEditController2,
|
||||
public YaPluginBase {
|
||||
public:
|
||||
/**
|
||||
@@ -77,7 +79,8 @@ class Vst3PluginProxy : public YaAudioProcessor,
|
||||
YaAudioProcessor::ConstructArgs audio_processor_args;
|
||||
YaComponent::ConstructArgs component_args;
|
||||
YaConnectionPoint::ConstructArgs connection_point_args;
|
||||
YaEditController::ConstructArgs edit_controller_2_args;
|
||||
YaEditController::ConstructArgs edit_controller_args;
|
||||
YaEditController2::ConstructArgs edit_controller_2_args;
|
||||
YaPluginBase::ConstructArgs plugin_base_args;
|
||||
|
||||
template <typename S>
|
||||
@@ -86,6 +89,7 @@ class Vst3PluginProxy : public YaAudioProcessor,
|
||||
s.object(audio_processor_args);
|
||||
s.object(component_args);
|
||||
s.object(connection_point_args);
|
||||
s.object(edit_controller_args);
|
||||
s.object(edit_controller_2_args);
|
||||
s.object(plugin_base_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 "edit-controller-2.h"
|
||||
|
||||
YaEditController2::ConstructArgs::ConstructArgs() {}
|
||||
|
||||
YaEditController2::ConstructArgs::ConstructArgs(
|
||||
Steinberg::IPtr<Steinberg::FUnknown> object)
|
||||
: supported(
|
||||
Steinberg::FUnknownPtr<Steinberg::Vst::IEditController2>(object)) {}
|
||||
|
||||
YaEditController2::YaEditController2(const ConstructArgs&& args)
|
||||
: arguments(std::move(args)) {}
|
||||
@@ -0,0 +1,73 @@
|
||||
// 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 `IEditController2` for serialization purposes. This is
|
||||
* instantiated as part of `Vst3PluginProxy`.
|
||||
*/
|
||||
class YaEditController2 : public Steinberg::Vst::IEditController2 {
|
||||
public:
|
||||
/**
|
||||
* These are the arguments for creating a `YaEditController2`.
|
||||
*/
|
||||
struct ConstructArgs {
|
||||
ConstructArgs();
|
||||
|
||||
/**
|
||||
* Check whether an existing implementation implements
|
||||
* `IEditController2` 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.
|
||||
*/
|
||||
YaEditController2(const ConstructArgs&& args);
|
||||
|
||||
inline bool supported() const { return arguments.supported; }
|
||||
|
||||
virtual tresult PLUGIN_API
|
||||
setKnobMode(Steinberg::Vst::KnobMode mode) override = 0;
|
||||
virtual tresult PLUGIN_API openHelp(TBool onlyCheck) override = 0;
|
||||
virtual tresult PLUGIN_API openAboutBox(TBool onlyCheck) override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
@@ -20,10 +20,8 @@ YaEditController::ConstructArgs::ConstructArgs() {}
|
||||
|
||||
YaEditController::ConstructArgs::ConstructArgs(
|
||||
Steinberg::IPtr<Steinberg::FUnknown> object)
|
||||
: supported_version_1(
|
||||
Steinberg::FUnknownPtr<Steinberg::Vst::IEditController>(object)),
|
||||
supported_version_2(
|
||||
Steinberg::FUnknownPtr<Steinberg::Vst::IEditController2>(object)) {}
|
||||
: supported(
|
||||
Steinberg::FUnknownPtr<Steinberg::Vst::IEditController>(object)) {}
|
||||
|
||||
YaEditController::YaEditController(const ConstructArgs&& args)
|
||||
: arguments(std::move(args)) {}
|
||||
|
||||
@@ -25,14 +25,10 @@
|
||||
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
|
||||
|
||||
/**
|
||||
* Wraps around `IEditController{,2}` for serialization purposes. This is
|
||||
* Wraps around `IEditController` for serialization purposes. This is
|
||||
* instantiated as part of `Vst3PluginProxy`.
|
||||
*
|
||||
* Steinberg forgot to inherit `IEditController2` from `IEditController` event
|
||||
* if it says it does in the docs, so we'll pretend they just that.
|
||||
*/
|
||||
class YaEditController : public Steinberg::Vst::IEditController,
|
||||
public Steinberg::Vst::IEditController2 {
|
||||
class YaEditController : public Steinberg::Vst::IEditController {
|
||||
public:
|
||||
/**
|
||||
* These are the arguments for creating a `YaEditController`.
|
||||
@@ -41,25 +37,19 @@ class YaEditController : public Steinberg::Vst::IEditController,
|
||||
ConstructArgs();
|
||||
|
||||
/**
|
||||
* Check whether an existing implementation implements `IEditController`
|
||||
* and `IEditController2` and read arguments from it.
|
||||
* Check whether an existing implementation implements
|
||||
* `IEditController` and read arguments from it.
|
||||
*/
|
||||
ConstructArgs(Steinberg::IPtr<Steinberg::FUnknown> object);
|
||||
|
||||
/**
|
||||
* Whether the object supported `IEditController`.
|
||||
* Whether the object supported this interface.
|
||||
*/
|
||||
bool supported_version_1;
|
||||
|
||||
/**
|
||||
* Whether the object supported `IEditController2`.
|
||||
*/
|
||||
bool supported_version_2;
|
||||
bool supported;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value1b(supported_version_1);
|
||||
s.value1b(supported_version_2);
|
||||
s.value1b(supported);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -69,14 +59,7 @@ class YaEditController : public Steinberg::Vst::IEditController,
|
||||
*/
|
||||
YaEditController(const ConstructArgs&& args);
|
||||
|
||||
inline bool supported_version_1() const {
|
||||
return arguments.supported_version_1;
|
||||
}
|
||||
inline bool supported_version_2() const {
|
||||
return arguments.supported_version_2;
|
||||
}
|
||||
|
||||
// From `IEditController`
|
||||
inline bool supported() const { return arguments.supported; }
|
||||
|
||||
/**
|
||||
* Message to pass through a call to
|
||||
@@ -350,13 +333,6 @@ class YaEditController : public Steinberg::Vst::IEditController,
|
||||
virtual Steinberg::IPlugView* PLUGIN_API
|
||||
createView(Steinberg::FIDString name) override = 0;
|
||||
|
||||
// From `IEditController2`
|
||||
|
||||
virtual tresult PLUGIN_API
|
||||
setKnobMode(Steinberg::Vst::KnobMode mode) override = 0;
|
||||
virtual tresult PLUGIN_API openHelp(TBool onlyCheck) override = 0;
|
||||
virtual tresult PLUGIN_API openAboutBox(TBool onlyCheck) override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user