mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-06-13 15:52:16 +02:00
Implement the plugin side if IComponentHandler3
This commit is contained in:
@@ -38,6 +38,22 @@ class Vst3PluginProxyImpl : public Vst3PluginProxy {
|
||||
tresult PLUGIN_API queryInterface(const Steinberg::TUID _iid,
|
||||
void** obj) override;
|
||||
|
||||
/**
|
||||
* Add a context menu created by a call to
|
||||
* `IComponentHandler3::createContextMenu` to our list of registered cotnext
|
||||
* menus. This way we can refer to it later when the plugin calls a function
|
||||
* on the proxy object we'll create for it.
|
||||
*/
|
||||
size_t register_context_menu(
|
||||
Steinberg::IPtr<Steinberg::Vst::IContextMenu> menu);
|
||||
|
||||
/**
|
||||
* Unregister a context menu using the ID generated by a previous call to
|
||||
* `register_context_menu()`. This will release the context menu object
|
||||
* returned by the host.
|
||||
*/
|
||||
bool unregister_context_menu(size_t context_menu_id);
|
||||
|
||||
// From `IAudioPresentationLatency`
|
||||
tresult PLUGIN_API
|
||||
setAudioPresentationLatencySamples(Steinberg::Vst::BusDirection dir,
|
||||
@@ -242,6 +258,21 @@ class Vst3PluginProxyImpl : public Vst3PluginProxy {
|
||||
*/
|
||||
Vst3PlugViewProxyImpl* last_created_plug_view = nullptr;
|
||||
|
||||
/**
|
||||
* All context menus created by this object through
|
||||
* `IComponentHandler3::createContextMenu()`. We'll generate a unique
|
||||
* identifier for each context menu just like we do for plugin objects. When
|
||||
* the plugin drops the context menu object, we'll also remove the
|
||||
* corresponding entry for this map causing the original pointer returned by
|
||||
* the host to get dropped a well.
|
||||
*
|
||||
* @see Vst3PluginProxyImpl::register_context_menu
|
||||
* @see Vst3PluginProxyImpl::unregister_context_menu
|
||||
*/
|
||||
std::map<size_t, Steinberg::IPtr<Steinberg::Vst::IContextMenu>>
|
||||
context_menus;
|
||||
std::mutex context_menus_mutex;
|
||||
|
||||
// The following pointers are cast from `host_context` if
|
||||
// `IPluginBase::initialize()` has been called
|
||||
|
||||
@@ -252,6 +283,8 @@ class Vst3PluginProxyImpl : public Vst3PluginProxy {
|
||||
|
||||
Steinberg::FUnknownPtr<Steinberg::Vst::IComponentHandler2>
|
||||
component_handler_2;
|
||||
Steinberg::FUnknownPtr<Steinberg::Vst::IComponentHandler3>
|
||||
component_handler_3;
|
||||
Steinberg::FUnknownPtr<Steinberg::Vst::IUnitHandler> unit_handler;
|
||||
|
||||
private:
|
||||
@@ -265,4 +298,12 @@ class Vst3PluginProxyImpl : public Vst3PluginProxy {
|
||||
* but for the sake of correctness we will.
|
||||
*/
|
||||
Steinberg::IPtr<Steinberg::FUnknown> host_context;
|
||||
|
||||
/**
|
||||
* Used to assign unique identifiers to context menus created by
|
||||
* `IComponentHandler3::CreateContextMenu`.
|
||||
*
|
||||
* @related Vst3PluginProxyImpl::register_context_menu
|
||||
*/
|
||||
std::atomic_size_t current_context_menu_id;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user