diff options
author | Carl Hetherington <carl@carlh.net> | 2011-10-19 14:26:16 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2011-10-19 14:26:16 +0000 |
commit | 52caae3971a16a8d937204eb48c73fe83eacf8f6 (patch) | |
tree | fc89ba2749b9a064c521e9118f92c9ac0f4600ea /libs | |
parent | cb58ca535f7366834062c4f88d74b4de9488e63b (diff) |
Improve plugin hide logic to prevent crashes when trying to insert fully audio plugins into MIDI tracks.
git-svn-id: svn://localhost/ardour2/branches/3.0@10232 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/plugin_insert.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index 78f6596330..1bdf7e32d0 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -803,17 +803,22 @@ PluginInsert::private_can_support_io_configuration (ChanCount const & in, ChanCo by feeding them silence. */ - bool can_hide = false; + bool could_hide = false; + bool cannot_hide = false; ChanCount hide_channels; for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { if (inputs.get(*t) > in.get(*t)) { + /* there is potential to hide, since the plugin has more inputs of type t than the insert */ hide_channels.set (*t, inputs.get(*t) - in.get(*t)); - can_hide = true; + could_hide = true; + } else if (inputs.get(*t) < in.get(*t)) { + /* we definitely cannot hide, since the plugin has fewer inputs of type t than the insert */ + cannot_hide = true; } } - if (can_hide) { + if (could_hide && !cannot_hide) { out = outputs; return Match (Hide, 1, hide_channels); } |