From 8cfe2512ed38ce638d7898e0f63674aad4657aa7 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Thu, 14 Jan 2021 13:56:10 +0100 Subject: [PATCH] Add a proxy class for IPlugViewContentScaleSupport --- meson.build | 2 + src/common/serialization/vst3/README.md | 3 +- .../vst3/plug-view/parameter-finder.h | 2 +- .../plug-view-content-scale-support.cpp | 28 ++++++++ .../plug-view-content-scale-support.h | 72 +++++++++++++++++++ 5 files changed, 105 insertions(+), 2 deletions(-) create mode 100644 src/common/serialization/vst3/plug-view/plug-view-content-scale-support.cpp create mode 100644 src/common/serialization/vst3/plug-view/plug-view-content-scale-support.h diff --git a/meson.build b/meson.build index c4239614..0f7fb897 100644 --- a/meson.build +++ b/meson.build @@ -120,6 +120,7 @@ vst3_plugin_sources = [ 'src/common/serialization/vst3/host-context/host-application.cpp', 'src/common/serialization/vst3/plug-view/parameter-finder.cpp', 'src/common/serialization/vst3/plug-view/plug-view.cpp', + 'src/common/serialization/vst3/plug-view/plug-view-content-scale-support.cpp', 'src/common/serialization/vst3/plug-frame/plug-frame.cpp', 'src/common/serialization/vst3/plugin/audio-presentation-latency.cpp', 'src/common/serialization/vst3/plugin/audio-processor.cpp', @@ -198,6 +199,7 @@ if with_vst3 'src/common/serialization/vst3/host-context/host-application.cpp', 'src/common/serialization/vst3/plug-view/parameter-finder.cpp', 'src/common/serialization/vst3/plug-view/plug-view.cpp', + 'src/common/serialization/vst3/plug-view/plug-view-content-scale-support.cpp', 'src/common/serialization/vst3/plug-frame/plug-frame.cpp', 'src/common/serialization/vst3/plugin/audio-presentation-latency.cpp', 'src/common/serialization/vst3/plugin/audio-processor.cpp', diff --git a/src/common/serialization/vst3/README.md b/src/common/serialization/vst3/README.md index 47b1a2be..1b30c3fe 100644 --- a/src/common/serialization/vst3/README.md +++ b/src/common/serialization/vst3/README.md @@ -6,7 +6,7 @@ for more information on how the serialization works. The following interfaces are not yet implemented: -- Interfaces introduced after VST 3.6.5 +- Interfaces introduced after VST 3.6.6 - The [Presonus extensions](https://presonussoftware.com/en_US/developer), although most of these things seem to overlap with newer VST3 interfaces @@ -19,6 +19,7 @@ VST3 plugin interfaces are implemented as follows: | `Vst3PlugViewProxy` | | All of the below: | | `YaParameterFinder` | `Vst3PlugViewProxy` | `IParameterFinder` | | `YaPlugView` | `Vst3PlugViewProxy` | `IPlugView` | +| `YaPlugViewContentScaleSupport` | `Vst3PlugViewProxy` | `IPlugViewContentScaleSupport` | | `Vst3PluginProxy` | | All of the below: | | `YaAudioPresentationLatency` | `Vst3PluginProxy` | `IAudioPresentationLatency` | | `YaAudioProcessor` | `Vst3PluginProxy` | `IAudioProcessor` | diff --git a/src/common/serialization/vst3/plug-view/parameter-finder.h b/src/common/serialization/vst3/plug-view/parameter-finder.h index fdfca513..95c405dd 100644 --- a/src/common/serialization/vst3/plug-view/parameter-finder.h +++ b/src/common/serialization/vst3/plug-view/parameter-finder.h @@ -26,7 +26,7 @@ /** * Wraps around `IParameterFinder` for serialization purposes. This is - * instantiated as part of `Vst3ParameterFinderProxy`. + * instantiated as part of `Vst3PlugViewProxy`. */ class YaParameterFinder : public Steinberg::Vst::IParameterFinder { public: diff --git a/src/common/serialization/vst3/plug-view/plug-view-content-scale-support.cpp b/src/common/serialization/vst3/plug-view/plug-view-content-scale-support.cpp new file mode 100644 index 00000000..516474f7 --- /dev/null +++ b/src/common/serialization/vst3/plug-view/plug-view-content-scale-support.cpp @@ -0,0 +1,28 @@ +// 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 "plug-view-content-scale-support.h" + +YaPlugViewContentScaleSupport::ConstructArgs::ConstructArgs() {} + +YaPlugViewContentScaleSupport::ConstructArgs::ConstructArgs( + Steinberg::IPtr object) + : supported(Steinberg::FUnknownPtr( + object)) {} + +YaPlugViewContentScaleSupport::YaPlugViewContentScaleSupport( + const ConstructArgs&& args) + : arguments(std::move(args)) {} diff --git a/src/common/serialization/vst3/plug-view/plug-view-content-scale-support.h b/src/common/serialization/vst3/plug-view/plug-view-content-scale-support.h new file mode 100644 index 00000000..c23fc0b6 --- /dev/null +++ b/src/common/serialization/vst3/plug-view/plug-view-content-scale-support.h @@ -0,0 +1,72 @@ +// 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" + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wnon-virtual-dtor" + +/** + * Wraps around `IPlugViewContentScaleSupport` for serialization purposes. This + * is instantiated as part of `Vst3PlugViewProxy`. + */ +class YaPlugViewContentScaleSupport + : public Steinberg::IPlugViewContentScaleSupport { + public: + /** + * These are the arguments for creating a `YaPlugViewContentScaleSupport`. + */ + struct ConstructArgs { + ConstructArgs(); + + /** + * Check whether an existing implementation implements + * `IPlugViewContentScaleSupport` 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. + */ + YaPlugViewContentScaleSupport(const ConstructArgs&& args); + + inline bool supported() const { return arguments.supported; } + + virtual tresult PLUGIN_API + setContentScaleFactor(ScaleFactor factor) override = 0; + + protected: + ConstructArgs arguments; +}; + +#pragma GCC diagnostic pop