From 06f6e6acfc1d349072d95d7448568e70189b96d3 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sun, 17 Jan 2021 13:09:20 +0100 Subject: [PATCH] Add a proxy class for IParameterFunctionName This is the last official VST3 interface we have to implement! --- meson.build | 2 + src/common/serialization/vst3/README.md | 2 +- .../vst3/plugin/parameter-function-name.cpp | 27 +++++++ .../vst3/plugin/parameter-function-name.h | 75 +++++++++++++++++++ 4 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 src/common/serialization/vst3/plugin/parameter-function-name.cpp create mode 100644 src/common/serialization/vst3/plugin/parameter-function-name.h diff --git a/meson.build b/meson.build index 276ec0f3..0496849b 100644 --- a/meson.build +++ b/meson.build @@ -139,6 +139,7 @@ vst3_plugin_sources = [ 'src/common/serialization/vst3/plugin/midi-mapping.cpp', 'src/common/serialization/vst3/plugin/note-expression-controller.cpp', 'src/common/serialization/vst3/plugin/note-expression-physical-ui-mapping.cpp', + 'src/common/serialization/vst3/plugin/parameter-function-name.cpp', 'src/common/serialization/vst3/plugin/plugin-base.cpp', 'src/common/serialization/vst3/plugin/prefetchable-support.cpp', 'src/common/serialization/vst3/plugin/process-context-requirements.cpp', @@ -225,6 +226,7 @@ if with_vst3 'src/common/serialization/vst3/plugin/midi-mapping.cpp', 'src/common/serialization/vst3/plugin/note-expression-controller.cpp', 'src/common/serialization/vst3/plugin/note-expression-physical-ui-mapping.cpp', + 'src/common/serialization/vst3/plugin/parameter-function-name.cpp', 'src/common/serialization/vst3/plugin/plugin-base.cpp', 'src/common/serialization/vst3/plugin/prefetchable-support.cpp', 'src/common/serialization/vst3/plugin/process-context-requirements.cpp', diff --git a/src/common/serialization/vst3/README.md b/src/common/serialization/vst3/README.md index d8b7f328..ffc6968d 100644 --- a/src/common/serialization/vst3/README.md +++ b/src/common/serialization/vst3/README.md @@ -6,7 +6,6 @@ for more information on how the serialization works. The following interfaces are not yet implemented: -- The last few VST 3.7.0 interfaces - The [Presonus extensions](https://presonussoftware.com/en_US/developer), although most of these things seem to overlap with newer VST3 interfaces @@ -35,6 +34,7 @@ VST3 plugin interfaces are implemented as follows: | `YaMidiMapping` | `Vst3PluginProxy` | `IMidiMapping` | | `YaNoteExpressionController` | `Vst3PluginProxy` | `INoteExpressionController` | | `YaNoteExpressionPhysicalUIMapping` | `Vst3PluginProxy` | `INoteExpressionPhysicalUIMapping` | +| `YaParameterFunctionName` | `Vst3PluginProxy` | `IParameterFunctionName` | | `YaPluginBase` | `Vst3PluginProxy` | `IPluginBase` | | `YaProcessContextRequirements` | `Vst3PluginProxy` | `IProcessContextRequirements` | | `YaPrefetchableSupport` | `Vst3PluginProxy` | `IPrefetchableSupport` | diff --git a/src/common/serialization/vst3/plugin/parameter-function-name.cpp b/src/common/serialization/vst3/plugin/parameter-function-name.cpp new file mode 100644 index 00000000..803d2d93 --- /dev/null +++ b/src/common/serialization/vst3/plugin/parameter-function-name.cpp @@ -0,0 +1,27 @@ +// yabridge: a Wine VST bridge +// Copyright (C) 2020-2021 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 . + +#include "parameter-function-name.h" + +YaParameterFunctionName::ConstructArgs::ConstructArgs() {} + +YaParameterFunctionName::ConstructArgs::ConstructArgs( + Steinberg::IPtr object) + : supported(Steinberg::FUnknownPtr( + object)) {} + +YaParameterFunctionName::YaParameterFunctionName(const ConstructArgs&& args) + : arguments(std::move(args)) {} diff --git a/src/common/serialization/vst3/plugin/parameter-function-name.h b/src/common/serialization/vst3/plugin/parameter-function-name.h new file mode 100644 index 00000000..300d13c1 --- /dev/null +++ b/src/common/serialization/vst3/plugin/parameter-function-name.h @@ -0,0 +1,75 @@ +// yabridge: a Wine VST bridge +// Copyright (C) 2020-2021 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 . + +#pragma once + +#include + +#include "../../common.h" +#include "../base.h" +#include "../host-context-proxy.h" + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wnon-virtual-dtor" + +/** + * Wraps around `IParameterFunctionName` for serialization purposes. Both + * components and edit controllers inherit from this. This is instantiated as + * part of `Vst3PluginProxy`. + */ +class YaParameterFunctionName : public Steinberg::Vst::IParameterFunctionName { + public: + /** + * These are the arguments for creating a `YaParameterFunctionName`. + */ + struct ConstructArgs { + ConstructArgs(); + + /** + * Check whether an existing implementation implements + * `IParameterFunctionName` and read arguments from it. + */ + ConstructArgs(Steinberg::IPtr object); + + /** + * Whether the object supported this interface. + */ + bool supported; + + template + void serialize(S& s) { + s.value1b(supported); + } + }; + + /** + * Instantiate this instance with arguments read from another interface + * implementation. + */ + YaParameterFunctionName(const ConstructArgs&& args); + + inline bool supported() const { return arguments.supported; } + + virtual tresult PLUGIN_API getParameterIDFromFunctionName( + Steinberg::Vst::UnitID unitID, + Steinberg::FIDString functionName, + Steinberg::Vst::ParamID& paramID) override = 0; + + protected: + ConstructArgs arguments; +}; + +#pragma GCC diagnostic pop