Add a proxy class for context menu targets

This commit is contained in:
Robbert van der Helm
2021-01-06 17:51:07 +01:00
parent 0cbcf44e3e
commit d3eeebc9f9
4 changed files with 107 additions and 9 deletions
+1
View File
@@ -122,6 +122,7 @@ vst3_plugin_sources = [
'src/common/serialization/vst3/component-handler-proxy.cpp',
'src/common/serialization/vst3/connection-point-proxy.cpp',
'src/common/serialization/vst3/context-menu-proxy.cpp',
'src/common/serialization/vst3/context-menu-target.cpp',
'src/common/serialization/vst3/event-list.cpp',
'src/common/serialization/vst3/host-context-proxy.cpp',
'src/common/serialization/vst3/message.cpp',
+10 -9
View File
@@ -52,15 +52,16 @@ VST3 host interfaces are implemented as follows:
The following host interfaces are passed as function arguments and are thus also
implemented for serialization purposes:
| yabridge class | Interfaces | Notes |
| -------------------- | ------------------- | ---------------------------------------------------------------------- |
| `YaAttributeList` | `IAttributeList` | |
| `YaEventList` | `IEventList` | Comes with a lot of serialization wrappers around the related structs. |
| `YaMessage` | `IMessage` | |
| `YaMessagePtr` | `IMessage` | Should be used in inter process communication to exchange messages |
| `YaParameterChanges` | `IParameterChanges` | |
| `YaParamValueQueue` | `IParamValueQueue` | |
| `VectorStream` | `IBStream` | Used for serializing data streams. |
| yabridge class | Interfaces | Notes |
| --------------------- | -------------------- | --------------------------------------------------------------------- |
| `YaAttributeList` | `IAttributeList` | |
| `YaContextMenuTarget` | `IContextMenuTarget` | Used in `YaContextMenu` to proxy specific menu items |
| `YaEventList` | `IEventList` | Comes with a lot of serialization wrappers around the related structs |
| `YaMessage` | `IMessage` | |
| `YaMessagePtr` | `IMessage` | Should be used in inter process communication to exchange messages |
| `YaParameterChanges` | `IParameterChanges` | |
| `YaParamValueQueue` | `IParamValueQueue` | |
| `VectorStream` | `IBStream` | Used for serializing data streams |
And finally `YaProcessData` uses the above along with `YaAudioBusBuffers` to
wrap around `ProcessData`.
@@ -0,0 +1,35 @@
// 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 <https://www.gnu.org/licenses/>.
#include "context-menu-target.h"
YaContextMenuTarget::YaContextMenuTarget(native_size_t owner_instance_id,
native_size_t context_menu_id,
int32 tag)
: owner_instance_id(owner_instance_id),
context_menu_id(context_menu_id),
tag(tag){FUNKNOWN_CTOR}
YaContextMenuTarget::~YaContextMenuTarget() {
FUNKNOWN_DTOR
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdelete-non-virtual-dtor"
IMPLEMENT_FUNKNOWN_METHODS(YaContextMenuTarget,
Steinberg::Vst::IContextMenuTarget,
Steinberg::Vst::IContextMenuTarget::iid)
#pragma GCC diagnostic pop
@@ -0,0 +1,61 @@
// 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 <https://www.gnu.org/licenses/>.
#pragma once
#include <pluginterfaces/vst/ivstcontextmenu.h>
#include "../common.h"
#include "base.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
/**
* Wraps around `IContextMenuTarget` for proxying calls to specific
* `IContextMenu` items. These are created on the plugin side, and when
* `executeMenuItem()` gets called we execute the corresponding menu item's
* target _from the GUI thread_.
*/
class YaContextMenuTarget : public Steinberg::Vst::IContextMenuTarget {
public:
/**
* Create context menu target that when called, calls the corresponding
* context menu target provided by the object.
*
* @param owner_instance_id The object instance that this target's context
* menu belongs to.
* @param context_menu_id The unique ID of the context menu requested by
* `owwner_instance_id`.
* @param tag The tag of the menu item this target belongs to.
*/
YaContextMenuTarget(native_size_t owner_instance_id,
native_size_t context_menu_id,
int32 tag);
~YaContextMenuTarget();
DECLARE_FUNKNOWN_METHODS
virtual tresult PLUGIN_API executeMenuItem(int32 tag) override = 0;
protected:
native_size_t owner_instance_id;
native_size_t context_menu_id;
int32 tag;
};
#pragma GCC diagnostic pop