From 6b9544cc39245f4670b210d1bdfa42504bb4ceb5 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 18 Oct 2023 01:14:20 +0200 Subject: [PATCH] VST3: cache if plugin has custom GUI This prevents repeated calls to createView(); view->release(); only to check if a VST3 plugin has a custom UI. --- libs/ardour/ardour/vst3_plugin.h | 2 ++ libs/ardour/vst3_plugin.cc | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/libs/ardour/ardour/vst3_plugin.h b/libs/ardour/ardour/vst3_plugin.h index 4e270ba03c..f2bc6d0f98 100644 --- a/libs/ardour/ardour/vst3_plugin.h +++ b/libs/ardour/ardour/vst3_plugin.h @@ -312,6 +312,8 @@ private: boost::optional _plugin_latency; + mutable boost::optional _has_editor; + int _n_bus_in; int _n_bus_out; diff --git a/libs/ardour/vst3_plugin.cc b/libs/ardour/vst3_plugin.cc index b28ffe4a76..89fb0797d3 100644 --- a/libs/ardour/vst3_plugin.cc +++ b/libs/ardour/vst3_plugin.cc @@ -341,6 +341,7 @@ VST3Plugin::possible_output () const bool VST3Plugin::has_editor () const { + /* consider caching has-editor in VST3Info */ return _plug->has_editor (); } @@ -3179,6 +3180,10 @@ VST3PI::close_view () bool VST3PI::has_editor () const { + if (_has_editor.has_value ()) { + return _has_editor.value (); + } + IPlugView* view = _view; if (!view) { view = try_create_view (); @@ -3197,6 +3202,7 @@ VST3PI::has_editor () const view->release (); } } + _has_editor = rv; return rv; }