13
0

Add context-menu options to disconnect plugin-pins

This commit is contained in:
Robin Gareus 2023-03-20 23:14:06 +01:00
parent 73bc7e6cb7
commit 6dadac73ab
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 30 additions and 1 deletions

View File

@ -114,7 +114,11 @@ PluginPinWidget::PluginPinWidget (boost::shared_ptr<ARDOUR::PluginInsert> pi)
Menu_Helpers::MenuList& citems = reset_menu.items ();
reset_menu.set_name ("ArdourContextMenu");
citems.clear ();
citems.push_back (Menu_Helpers::MenuElem (_("Reset"), sigc::mem_fun (*this, &PluginPinWidget::reset_mapping)));
citems.push_back (Menu_Helpers::MenuElem (_("Reset to default"), sigc::mem_fun (*this, &PluginPinWidget::reset_mapping)));
citems.push_back (Menu_Helpers::SeparatorElem ());
citems.push_back (Menu_Helpers::MenuElem (_("Disconnect Inputs"), sigc::bind (sigc::mem_fun (*this, &PluginPinWidget::clear_mapping), DisconnectIn)));
citems.push_back (Menu_Helpers::MenuElem (_("Disconnect Outputs"), sigc::bind (sigc::mem_fun (*this, &PluginPinWidget::clear_mapping), DisconnectOut)));
citems.push_back (Menu_Helpers::MenuElem (_("Disconnect All"), sigc::bind (sigc::mem_fun (*this, &PluginPinWidget::clear_mapping), DisconnectAll)));
_pm_size_group = SizeGroup::create (SIZE_GROUP_BOTH);
_add_plugin.set_tweaks (ArdourButton::Square);
@ -1646,6 +1650,23 @@ PluginPinWidget::reset_mapping ()
_pi->reset_map ();
}
void
PluginPinWidget::clear_mapping (ClearMode m)
{
ChanMapping map;
for (uint32_t n = 0; n < _n_plugins; ++n) {
if (m & DisconnectIn) {
_pi->set_input_map (n, map);
}
if (m & DisconnectOut) {
_pi->set_output_map (n, map);
}
}
if (m == DisconnectAll) {
_pi->set_thru_map (map);
}
}
void
PluginPinWidget::select_output_preset (uint32_t n_audio)
{

View File

@ -57,6 +57,13 @@ private:
Output
} CtrlType;
typedef enum {
DisconnectIn = 1,
DisconnectOut = 2,
DisconnectAll = 3, // includes thru
} ClearMode;
struct _CtrlElem {
_CtrlElem (CtrlType c, ARDOUR::DataType d, uint32_t i, uint32_t p, uint32_t b, bool s)
: ct (c), dt (d), id (i), ip (p), bn (b), sc (s) {}
@ -153,6 +160,7 @@ private:
static std::string port_label (const std::string&, bool);
void reset_mapping ();
void clear_mapping (ClearMode);
void reset_configuration ();
void toggle_sidechain ();
void connect_sidechain ();