mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-30 08:53:08 +01:00
RegionFX: add clear-automation action
This commit is contained in:
parent
50044bd059
commit
fb1ca67e39
2 changed files with 44 additions and 1 deletions
|
|
@ -671,7 +671,8 @@ RegionEditor::RegionFxBox::fxe_button_press_event (GdkEventButton* ev, RegionFxE
|
|||
|
||||
if (!ac_items.empty ()) {
|
||||
items.push_back (SeparatorElem ());
|
||||
items.push_back (MenuElem ("Automation Enable", *automation_menu));
|
||||
items.push_back (MenuElem (_("Automation Enable"), *automation_menu));
|
||||
items.push_back (MenuElem (_("Clear All Automation"), sigc::bind (sigc::mem_fun (*this, &RegionFxBox::clear_automation), wfx)));
|
||||
} else {
|
||||
delete automation_menu;
|
||||
}
|
||||
|
|
@ -744,6 +745,47 @@ RegionEditor::RegionFxBox::on_key_press (GdkEventKey* ev)
|
|||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
RegionEditor::RegionFxBox::clear_automation (std::weak_ptr<ARDOUR::RegionFxPlugin> wfx)
|
||||
{
|
||||
std::shared_ptr<RegionFxPlugin> fx (wfx.lock ());
|
||||
if (!fx) {
|
||||
return;
|
||||
}
|
||||
bool in_command = false;
|
||||
|
||||
timepos_t tas ((samplepos_t)_region->length().samples());
|
||||
|
||||
for (auto const& c : fx->controls ()) {
|
||||
std::shared_ptr<AutomationControl> ac = std::dynamic_pointer_cast<AutomationControl> (c.second);
|
||||
if (!ac) {
|
||||
continue;
|
||||
}
|
||||
std::shared_ptr<ARDOUR::AutomationList> alist = ac->alist ();
|
||||
if (!alist) {
|
||||
continue;
|
||||
}
|
||||
|
||||
XMLNode& before (alist->get_state());
|
||||
|
||||
alist->freeze ();
|
||||
alist->clear ();
|
||||
fx->set_default_automation (tas);
|
||||
alist->thaw ();
|
||||
alist->set_automation_state (ARDOUR::Off);
|
||||
|
||||
if (!in_command) {
|
||||
_region->session ().begin_reversible_command (_("Clear region fx automation"));
|
||||
in_command = true;
|
||||
}
|
||||
_region->session ().add_command (new MementoCommand<AutomationList>(*alist.get(), &before, &alist->get_state()));
|
||||
}
|
||||
|
||||
if (in_command) {
|
||||
_region->session ().commit_reversible_command ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RegionEditor::RegionFxBox::reordered ()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ private:
|
|||
bool idle_delete_region_fx (std::weak_ptr<ARDOUR::RegionFxPlugin>);
|
||||
void notify_plugin_load_fail (uint32_t cnt = 1);
|
||||
bool on_key_press (GdkEventKey*);
|
||||
void clear_automation (std::weak_ptr<ARDOUR::RegionFxPlugin>);
|
||||
|
||||
/* PluginInterestedObject */
|
||||
bool use_plugins (SelectedPlugins const&);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue