VST3: cache has-editor (improve on 6b9544cc39)

This commit is contained in:
Robin Gareus 2023-10-18 16:52:46 +02:00
parent c37a7944aa
commit bd1cf4e5cf
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 10 additions and 9 deletions

View File

@ -312,8 +312,6 @@ private:
boost::optional<uint32_t> _plugin_latency;
mutable boost::optional<bool> _has_editor;
int _n_bus_in;
int _n_bus_out;
@ -461,6 +459,8 @@ public:
bool is_instrument () const;
PBD::Searchpath preset_search_path () const;
mutable boost::optional<bool> has_editor;
std::shared_ptr<VST3PluginModule> m;
};

View File

@ -341,8 +341,14 @@ VST3Plugin::possible_output () const
bool
VST3Plugin::has_editor () const
{
/* consider caching has-editor in VST3Info */
return _plug->has_editor ();
std::shared_ptr<VST3PluginInfo> nfo = std::dynamic_pointer_cast<VST3PluginInfo> (get_info ());
if (nfo->has_editor.has_value ()) {
return nfo->has_editor.value ();
}
bool rv = _plug->has_editor ();
nfo->has_editor = rv;
return rv;
}
Steinberg::IPlugView*
@ -3180,10 +3186,6 @@ 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 ();
@ -3202,7 +3204,6 @@ VST3PI::has_editor () const
view->release ();
}
}
_has_editor = rv;
return rv;
}