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.
This commit is contained in:
Robin Gareus 2023-10-18 01:14:20 +02:00
parent 44a2ef9098
commit 6b9544cc39
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 8 additions and 0 deletions

View File

@ -312,6 +312,8 @@ private:
boost::optional<uint32_t> _plugin_latency;
mutable boost::optional<bool> _has_editor;
int _n_bus_in;
int _n_bus_out;

View File

@ -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;
}