Add dedicated IAudioProcessor/IComponent sockets

This way every relevant object instance will get its own thread for
handling these calls. The alternative would be creating a full fat
Vst3MessageHandler pair for all object instances, but that would be a
huge waste.
This commit is contained in:
Robbert van der Helm
2020-12-21 17:25:08 +01:00
parent 415c1b5683
commit 51877796fa
10 changed files with 764 additions and 500 deletions
+20 -10
View File
@@ -76,13 +76,12 @@ class Vst3PluginBridge : PluginBridge<Vst3Sockets<std::jthread>> {
/**
* Add a `Vst3PluginProxyImpl` to the list of registered proxy objects so we
* can handle host callbacks. This function is called in
* `Vst3PluginProxyImpl`'s constructor.
* `Vst3PluginProxyImpl`'s constructor. If the plugin supports the
* `IAudioProcessor` or `IComponent` interfaces, then we'll also connect to
* a dedicated audio processing socket.
*
* @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 plugin_proxy The actual proxy object we can access its host
* context.
* @param proxy_object The proxy object so we can access its host context
* and unique instance identifier.
*
* @see plugin_proxies
*/
@@ -93,13 +92,12 @@ class Vst3PluginBridge : PluginBridge<Vst3Sockets<std::jthread>> {
* 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.
* @param proxy_object The proxy object so we can access its unique instance
* identifier.
*
* @see plugin_proxies
*/
void unregister_plugin_proxy(size_t instance_id);
void unregister_plugin_proxy(Vst3PluginProxyImpl& proxy_object);
/**
* Send a control message to the Wine plugin host return the response. This
@@ -112,6 +110,18 @@ class Vst3PluginBridge : PluginBridge<Vst3Sockets<std::jthread>> {
object, std::pair<Vst3Logger&, bool>(logger, true));
}
/**
* Send an `IAudioProcessor` or `IComponent` control message to a specific
* plugin instance. This is separated from the above `send_message()` for
* performance reasons, as this way every instance has its own dedicated
* socket and thread.
*/
template <typename T>
typename T::Response send_audio_processor_message(const T& object) {
return sockets.send_audio_processor_message(
object, std::pair<Vst3Logger&, bool>(logger, true));
}
/**
* The logging facility used for this instance of yabridge. Wraps around
* `PluginBridge::generic_logger`.