13
0

Auto-touch when adding automation events to a spilled control

This commit is contained in:
Robin Gareus 2021-02-11 00:29:44 +01:00
parent 8321e7d6a6
commit 0becbe7f4f
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 17 additions and 5 deletions

View File

@ -170,10 +170,10 @@ AutomationRegionView::canvas_group_event (GdkEvent* ev)
void void
AutomationRegionView::add_automation_event (GdkEvent *, samplepos_t when, double y, bool with_guard_points) AutomationRegionView::add_automation_event (GdkEvent *, samplepos_t when, double y, bool with_guard_points)
{ {
boost::shared_ptr<Evoral::Control> c = _region->control(_parameter, true);
boost::shared_ptr<ARDOUR::AutomationControl> ac = boost::dynamic_pointer_cast<ARDOUR::AutomationControl>(c);
if (!_line) { if (!_line) {
boost::shared_ptr<Evoral::Control> c = _region->control(_parameter, true);
boost::shared_ptr<ARDOUR::AutomationControl> ac
= boost::dynamic_pointer_cast<ARDOUR::AutomationControl>(c);
assert(ac); assert(ac);
create_line(ac->alist()); create_line(ac->alist());
} }
@ -191,8 +191,6 @@ AutomationRegionView::add_automation_event (GdkEvent *, samplepos_t when, double
_line->view_to_model_coord (when_d, y); _line->view_to_model_coord (when_d, y);
if (UIConfiguration::instance().get_new_automation_points_on_lane()) { if (UIConfiguration::instance().get_new_automation_points_on_lane()) {
boost::shared_ptr<Evoral::Control> c = _region->control (_parameter, false);
assert (c);
if (c->list()->size () == 0) { if (c->list()->size () == 0) {
/* we need the MidiTrack::MidiControl, not the region's (midi model source) control */ /* we need the MidiTrack::MidiControl, not the region's (midi model source) control */
boost::shared_ptr<ARDOUR::MidiTrack> mt = boost::dynamic_pointer_cast<ARDOUR::MidiTrack> (view->parent_stripable ()); boost::shared_ptr<ARDOUR::MidiTrack> mt = boost::dynamic_pointer_cast<ARDOUR::MidiTrack> (view->parent_stripable ());
@ -208,6 +206,13 @@ AutomationRegionView::add_automation_event (GdkEvent *, samplepos_t when, double
XMLNode& before = _line->the_list()->get_state(); XMLNode& before = _line->the_list()->get_state();
if (_line->the_list()->editor_add (when_d, y, with_guard_points)) { if (_line->the_list()->editor_add (when_d, y, with_guard_points)) {
if (ac == view->session()->recently_touched_controllable ()) {
if (ac->automation_state () == ARDOUR::Off) {
ac->set_automation_state (ARDOUR::Touch);
}
}
view->editor().begin_reversible_command (_("add automation event")); view->editor().begin_reversible_command (_("add automation event"));
XMLNode& after = _line->the_list()->get_state(); XMLNode& after = _line->the_list()->get_state();

View File

@ -790,6 +790,13 @@ AutomationTimeAxisView::add_automation_event (GdkEvent* event, samplepos_t sampl
std::list<Selectable*> results; std::list<Selectable*> results;
if (list->editor_add (when.sample, y, with_guard_points)) { if (list->editor_add (when.sample, y, with_guard_points)) {
if (_control == _session->recently_touched_controllable ()) {
if (_control->automation_state () == ARDOUR::Off) {
_control->set_automation_state (ARDOUR::Touch);
}
}
XMLNode& after = list->get_state(); XMLNode& after = list->get_state();
_editor.begin_reversible_command (_("add automation event")); _editor.begin_reversible_command (_("add automation event"));
_session->add_command (new MementoCommand<ARDOUR::AutomationList> (*list.get (), &before, &after)); _session->add_command (new MementoCommand<ARDOUR::AutomationList> (*list.get (), &before, &after));