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 -5
View File
@@ -161,13 +161,28 @@ Steinberg::IPluginFactory* Vst3PluginBridge::get_plugin_factory() {
return plugin_factory;
}
void Vst3PluginBridge::register_plugin_proxy(Vst3PluginProxyImpl& component) {
void Vst3PluginBridge::register_plugin_proxy(
Vst3PluginProxyImpl& proxy_object) {
std::lock_guard lock(plugin_proxies_mutex);
plugin_proxies.emplace(component.instance_id(),
std::ref<Vst3PluginProxyImpl>(component));
plugin_proxies.emplace(proxy_object.instance_id(),
std::ref<Vst3PluginProxyImpl>(proxy_object));
// For optimization reaons we use dedicated sockets for functions that will
// be run in the audio processing loop
if (proxy_object.YaAudioProcessor::supported() ||
proxy_object.YaComponent::supported()) {
sockets.add_audio_processor_and_connect(proxy_object.instance_id());
}
}
void Vst3PluginBridge::unregister_plugin_proxy(size_t instance_id) {
void Vst3PluginBridge::unregister_plugin_proxy(
Vst3PluginProxyImpl& proxy_object) {
std::lock_guard lock(plugin_proxies_mutex);
plugin_proxies.erase(instance_id);
plugin_proxies.erase(proxy_object.instance_id());
if (proxy_object.YaAudioProcessor::supported() ||
proxy_object.YaComponent::supported()) {
sockets.remove_audio_processor(proxy_object.instance_id());
}
}