Move the VST3 context menu target implementation

So it can also be used on the Wine side in a bit.
This commit is contained in:
Robbert van der Helm
2022-01-03 14:12:25 +01:00
parent b60139ce77
commit 0e3aba1870
4 changed files with 26 additions and 48 deletions
@@ -16,23 +16,42 @@
#pragma once
#include "../vst3.h"
#include "../vst3/context-menu-target.h"
/**
* This implementation used to live in `src/plugin/bridges/vst3-impls`, but
* since plugins can also call context menu items added by the host this is
* needed on both sides.
*/
template <typename Bridge>
class YaContextMenuTargetImpl : public YaContextMenuTarget {
public:
YaContextMenuTargetImpl(Vst3PluginBridge& bridge,
ConstructArgs&& args) noexcept;
YaContextMenuTargetImpl(Bridge& bridge, ConstructArgs&& args) noexcept
: YaContextMenuTarget(std::move(args)), bridge_(bridge) {}
/**
* We'll override the query interface to log queries for interfaces we do
* not (yet) support.
*/
tresult PLUGIN_API queryInterface(const Steinberg::TUID _iid,
void** obj) override;
void** obj) override {
const tresult result = YaContextMenuTarget::queryInterface(_iid, obj);
bridge_.logger_.log_query_interface(
"In IContextMenuTarget::queryInterface()", result,
Steinberg::FUID::fromTUID(_iid));
return result;
}
// From `IContextMenuTarget`
tresult PLUGIN_API executeMenuItem(int32 tag) override;
tresult PLUGIN_API executeMenuItem(int32 tag) override {
return bridge_.send_message(YaContextMenuTarget::ExecuteMenuItem{
.owner_instance_id = owner_instance_id(),
.context_menu_id = context_menu_id(),
.target_tag = target_tag(),
.tag = tag});
}
private:
Vst3PluginBridge& bridge_;
Bridge& bridge_;
};
@@ -1,40 +0,0 @@
// yabridge: a Wine VST bridge
// Copyright (C) 2020-2022 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 "context-menu-target.h"
YaContextMenuTargetImpl::YaContextMenuTargetImpl(Vst3PluginBridge& bridge,
ConstructArgs&& args) noexcept
: YaContextMenuTarget(std::move(args)), bridge_(bridge) {}
tresult PLUGIN_API
YaContextMenuTargetImpl::queryInterface(const Steinberg::TUID _iid,
void** obj) {
const tresult result = YaContextMenuTarget::queryInterface(_iid, obj);
bridge_.logger_.log_query_interface(
"In IContextMenuTarget::queryInterface()", result,
Steinberg::FUID::fromTUID(_iid));
return result;
}
tresult PLUGIN_API YaContextMenuTargetImpl::executeMenuItem(int32 tag) {
return bridge_.send_message(YaContextMenuTarget::ExecuteMenuItem{
.owner_instance_id = owner_instance_id(),
.context_menu_id = context_menu_id(),
.target_tag = target_tag(),
.tag = tag});
}
+1 -1
View File
@@ -18,8 +18,8 @@
#include <pluginterfaces/base/ustring.h>
#include "../../common/serialization/vst3-impls/context-menu-target.h"
#include "../../common/serialization/vst3.h"
#include "vst3-impls/context-menu-target.h"
#include "vst3-impls/plugin-proxy.h"
using namespace std::literals::string_literals;
-1
View File
@@ -81,7 +81,6 @@ vst3_plugin_sources = files(
'../common/plugins.cpp',
'../common/utils.cpp',
'bridges/vst3.cpp',
'bridges/vst3-impls/context-menu-target.cpp',
'bridges/vst3-impls/plugin-factory-proxy.cpp',
'bridges/vst3-impls/plug-view-proxy.cpp',
'bridges/vst3-impls/plugin-proxy.cpp',