Rename register_component to register_plugin_proxy

This commit is contained in:
Robbert van der Helm
2020-12-17 13:33:34 +01:00
parent 481975860c
commit d0e96da21a
6 changed files with 37 additions and 41 deletions
+20 -24
View File
@@ -73,34 +73,32 @@ class Vst3PluginBridge : PluginBridge<Vst3Sockets<std::jthread>> {
Steinberg::IPluginFactory* get_plugin_factory();
/**
* Add a `YaComponentPluginImpl` to the list of registered components so we
* can handle host callbacks, called during its constructor.
* Add a `Vst3PluginProxyImpl` to the list of registered proxy objects so we
* can handle host callbacks. This function is called in
* `Vst3PluginProxyImpl`'s constructor.
*
* @param instance_id The instance ID generated by the plugin host when
* instantiating the `IComponent`. Used as a stable name to refer to
* these.
* @param component The actual component instance so we can use its host
* @param plugin_proxy The actual proxy object we can access its host
* context.
*
* @see component_instances
*
* TODO: REname to `register_instance` or `register_object`
* @see plugin_proxies
*/
void register_component(size_t instance_id, Vst3PluginProxyImpl& component);
void register_plugin_proxy(Vst3PluginProxyImpl& proxy_object);
/**
* Remove a previously registered `YaComponentPluginImpl` from the list of
* registered components so we can handle host callbacks, called during its
* destructor after asking the Wine plugin host to destroy the component on
* its side..
* Remove a previously registered `Vst3PluginProxyImpl` from the list of
* registered proxy objects. Called during the object's destructor after
* asking the Wine plugin host to destroy the component on its side.
*
* @param instance_id The instance ID generated by the plugin host when
* instantiating the `IComponent`. Used as a stable name to refer to
* these.
*
* @see component_instances
* @see plugin_proxies
*/
void unregister_component(size_t instance_id);
void unregister_plugin_proxy(size_t instance_id);
/**
* Send a control message to the Wine plugin host return the response. This
@@ -140,17 +138,15 @@ class Vst3PluginBridge : PluginBridge<Vst3Sockets<std::jthread>> {
private:
/**
* All `IComponent` instances we created from this plugin. We only need to
* keep track of them in case the 'real' `IComponent` instance tries to do a
* callback through the host context. We store the copy of the host context
* passed during `initialize()` in the `YaComponentPluginImpl`. The IDs here
* are the same IDs as generated by the Wine plugin host. We store raw
* pointers instead of smart pointers because this shouldn't affect the
* reference counting. An instance is added here through a call by
* `register_component()` in the constractor, and an instance is then
* removed through a call to `unregister_component()` in the destructor.
* All VST3 plugin objects we created from this plugin. We keep track of
* these in case the plugin does a host callback, so we can associate that
* call with the exact host context object passed to it during a call to
* `initialize()`. The IDs here are the same IDs as generated by the Wine
* plugin host. An instance is added here through a call by
* `register_plugin_proxy()` in the constractor, and an instance is then
* removed through a call to `unregister_plugin_proxy()` in the destructor.
*/
std::map<size_t, std::reference_wrapper<Vst3PluginProxyImpl>>
component_instances;
std::mutex component_instances_mutex;
plugin_proxies;
std::mutex plugin_proxies_mutex;
};