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:
parent
44a2ef9098
commit
6b9544cc39
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user