mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 15:25:01 +01:00
Don't show plugin preset UI for plugins without controls
Notably Ardour's General MIDI Synth has no presets, but users try. This also prevents presets of plugins with internal state, but no user visible controls. But those usually have a plugin provided presets.
This commit is contained in:
parent
cefab85dab
commit
6e28c43cef
2 changed files with 31 additions and 0 deletions
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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<AutomationControl const> 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<PlugInsertBase::UIElements> (static_cast <std::uint8_t>(rv) & ~static_cast<std::uint8_t> (PlugInsertBase::PluginPreset));
|
||||
}
|
||||
if (!is_instrument()) {
|
||||
rv = static_cast<PlugInsertBase::UIElements> (static_cast <std::uint8_t>(rv) & ~static_cast<std::uint8_t> (PlugInsertBase::MIDIKeyboard));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue