diff --git a/meson.build b/meson.build index 3b88c46f..276ec0f3 100644 --- a/meson.build +++ b/meson.build @@ -115,6 +115,7 @@ vst3_plugin_sources = [ 'src/common/serialization/vst3/component-handler/component-handler-2.cpp', 'src/common/serialization/vst3/component-handler/component-handler-3.cpp', 'src/common/serialization/vst3/component-handler/component-handler-bus-activation.cpp', + 'src/common/serialization/vst3/component-handler/progress.cpp', 'src/common/serialization/vst3/component-handler/unit-handler.cpp', 'src/common/serialization/vst3/component-handler/unit-handler-2.cpp', 'src/common/serialization/vst3/context-menu/context-menu.cpp', @@ -200,6 +201,7 @@ if with_vst3 'src/common/serialization/vst3/component-handler/component-handler-2.cpp', 'src/common/serialization/vst3/component-handler/component-handler-3.cpp', 'src/common/serialization/vst3/component-handler/component-handler-bus-activation.cpp', + 'src/common/serialization/vst3/component-handler/progress.cpp', 'src/common/serialization/vst3/component-handler/unit-handler.cpp', 'src/common/serialization/vst3/component-handler/unit-handler-2.cpp', 'src/common/serialization/vst3/context-menu/context-menu.cpp', diff --git a/src/common/serialization/vst3/README.md b/src/common/serialization/vst3/README.md index 9ae0cbbc..d8b7f328 100644 --- a/src/common/serialization/vst3/README.md +++ b/src/common/serialization/vst3/README.md @@ -55,6 +55,7 @@ VST3 host interfaces are implemented as follows: | `YaComponentHandler2` | `Vst3ComponentHandlerProxy` | `IComponentHandler2` | | `YaComponentHandler3` | `Vst3ComponentHandlerProxy` | `IComponentHandler3` | | `YaComponentHandlerBusActivation` | `Vst3ComponentHandlerProxy` | `IComponentHandlerBusActivation` | +| `YaProgress` | `Vst3ComponentHandlerProxy` | `IProgress` | | `YaUnitHandler` | `Vst3ComponentHandlerProxy` | `IUnitHandler` | | `YaUnitHandler2` | `Vst3ComponentHandlerProxy` | `IUnitHandler2` | | `Vst3ContextMenuProxy` | | All of the below: | diff --git a/src/common/serialization/vst3/component-handler/progress.cpp b/src/common/serialization/vst3/component-handler/progress.cpp new file mode 100644 index 00000000..d66b4c3f --- /dev/null +++ b/src/common/serialization/vst3/component-handler/progress.cpp @@ -0,0 +1,26 @@ +// 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 "progress.h" + +YaProgress::ConstructArgs::ConstructArgs() {} + +YaProgress::ConstructArgs::ConstructArgs( + Steinberg::IPtr object) + : supported(Steinberg::FUnknownPtr(object)) {} + +YaProgress::YaProgress(const ConstructArgs&& args) + : arguments(std::move(args)) {} diff --git a/src/common/serialization/vst3/component-handler/progress.h b/src/common/serialization/vst3/component-handler/progress.h new file mode 100644 index 00000000..e73ce012 --- /dev/null +++ b/src/common/serialization/vst3/component-handler/progress.h @@ -0,0 +1,76 @@ +// 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 `IProgress` for serialization purposes. This is instantiated as + * part of `Vst3ComponentHandlerProxy`. + */ +class YaProgress : public Steinberg::Vst::IProgress { + public: + /** + * These are the arguments for creating a `YaProgress`. + */ + struct ConstructArgs { + ConstructArgs(); + + /** + * Check whether an existing implementation implements `IProgress` + * 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. + */ + YaProgress(const ConstructArgs&& args); + + inline bool supported() const { return arguments.supported; } + + virtual tresult PLUGIN_API + start(ProgressType type, + const Steinberg::tchar* optionalDescription, + ID& outID) override = 0; + virtual tresult PLUGIN_API + update(ID id, Steinberg::Vst::ParamValue normValue) override = 0; + virtual tresult PLUGIN_API finish(ID id) override = 0; + + protected: + ConstructArgs arguments; +}; + +#pragma GCC diagnostic pop diff --git a/src/common/serialization/vst3/component-handler/unit-handler-2.h b/src/common/serialization/vst3/component-handler/unit-handler-2.h index c0db9ef0..427a32a1 100644 --- a/src/common/serialization/vst3/component-handler/unit-handler-2.h +++ b/src/common/serialization/vst3/component-handler/unit-handler-2.h @@ -26,7 +26,7 @@ /** * Wraps around `IUnitHandler2` for serialization purposes. This is instantiated - * as part of `Vst3UnitHandler2Proxy`. + * as part of `Vst3ComponentHandlerProxy`. */ class YaUnitHandler2 : public Steinberg::Vst::IUnitHandler2 { public: diff --git a/src/common/serialization/vst3/component-handler/unit-handler.h b/src/common/serialization/vst3/component-handler/unit-handler.h index 00e1e73c..47aa3f23 100644 --- a/src/common/serialization/vst3/component-handler/unit-handler.h +++ b/src/common/serialization/vst3/component-handler/unit-handler.h @@ -26,7 +26,7 @@ /** * Wraps around `IUnitHandler` for serialization purposes. This is instantiated - * as part of `Vst3UnitHandlerProxy`. + * as part of `Vst3ComponentHandlerProxy`. */ class YaUnitHandler : public Steinberg::Vst::IUnitHandler { public: