diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h index 883f3ca364..57d11d00c3 100644 --- a/libs/ardour/ardour/plugin_insert.h +++ b/libs/ardour/ardour/plugin_insert.h @@ -192,6 +192,7 @@ public: bool has_no_audio_inputs() const; bool is_instrument () const; + bool has_automatables () const; bool has_output_presets ( ChanCount in = ChanCount (DataType::MIDI, 1), diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index ed14a145d1..e794a58dc4 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -462,13 +462,43 @@ PluginInsert::is_instrument() const return (pip->is_instrument ()); } +bool +PluginInsert::has_automatables () const +{ + for (size_t i = 0; i < plugin(0)->parameter_count (); ++i) { + if (!plugin(0)->parameter_is_control (i)) { + continue; + } + if (!plugin(0)->parameter_is_input (i)) { + continue; + } + std::shared_ptr ac = automation_control (Evoral::Parameter (PluginAutomation, 0, i)); + if (!ac) { + continue; + } + if (ac->flags () & Controllable::HiddenControl) { + continue; + } + if (ac->flags () & Controllable::NotAutomatable) { + continue; + } + return true; + break; + } + return false; +} + PlugInsertBase::UIElements PluginInsert::ui_elements () const { if (owner () == (ARDOUR::SessionObject*)(_session.the_auditioner().get())) { return NoGUIToolbar; } + UIElements rv = AllUIElements; + if (!has_automatables ()) { + rv = static_cast (static_cast (rv) & ~static_cast (PlugInsertBase::PluginPreset)); + } if (!is_instrument()) { rv = static_cast (static_cast (rv) & ~static_cast (PlugInsertBase::MIDIKeyboard)); }