diff options
author | Carl Hetherington <carl@carlh.net> | 2010-06-25 20:47:09 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-06-25 20:47:09 +0000 |
commit | ecb0cd5d119d28092a8f48e4521ac5eba197bb54 (patch) | |
tree | 57d7bcff09ab6d6382af929212ff4a4adeea2658 /gtk2_ardour/automation_streamview.cc | |
parent | ad81fd40d22f63f0f9e7a247164b6b367fabb2fd (diff) |
Make MIDI region `automation' respect the automation mode so that it is
only played back if the automation mode is set to "Play". Munge AutoState
for AutomationRegionViews so that they reflect their AutomationTimeAxisView's
setting. Fixes #3135.
git-svn-id: svn://localhost/ardour2/branches/3.0@7304 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/automation_streamview.cc')
-rw-r--r-- | gtk2_ardour/automation_streamview.cc | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/gtk2_ardour/automation_streamview.cc b/gtk2_ardour/automation_streamview.cc index fad14006b2..006834c59d 100644 --- a/gtk2_ardour/automation_streamview.cc +++ b/gtk2_ardour/automation_streamview.cc @@ -58,6 +58,7 @@ AutomationStreamView::AutomationStreamView (AutomationTimeAxisView& tv) new ArdourCanvas::Group(*tv.canvas_display())) , _controller(tv.controller()) , _automation_view(tv) + , _pending_automation_state (Off) { //canvas_rect->property_fill_color_rgba() = stream_base_color; canvas_rect->property_outline_color_rgba() = RGBA_BLACK; @@ -82,9 +83,9 @@ AutomationStreamView::add_region_view_internal (boost::shared_ptr<Region> region mr->midi_source()->load_model(); } - const boost::shared_ptr<AutomationControl> control - = boost::dynamic_pointer_cast<AutomationControl>( - region->control(_controller->controllable()->parameter())); + const boost::shared_ptr<AutomationControl> control = boost::dynamic_pointer_cast<AutomationControl> ( + region->control (_controller->controllable()->parameter(), true) + ); boost::shared_ptr<AutomationList> list; if (control) { @@ -130,6 +131,12 @@ AutomationStreamView::add_region_view_internal (boost::shared_ptr<Region> region /* catch regionview going away */ region->DropReferences.connect (*this, invalidator (*this), boost::bind (&AutomationStreamView::remove_region_view, this, boost::weak_ptr<Region>(region)), gui_context()); + /* setup automation state for this region */ + boost::shared_ptr<AutomationLine> line = region_view->line (); + if (line && line->the_list()) { + line->the_list()->set_automation_state (automation_state ()); + } + RegionViewAdded (region_view); return region_view; @@ -144,11 +151,18 @@ AutomationStreamView::display_region(AutomationRegionView* region_view) void AutomationStreamView::set_automation_state (AutoState state) { - std::list<RegionView *>::iterator i; - for (i = region_views.begin(); i != region_views.end(); ++i) { - boost::shared_ptr<AutomationLine> line = ((AutomationRegionView*)(*i))->line(); - if (line && line->the_list()) { - line->the_list()->set_automation_state (state); + /* XXX: not sure if this is right, but for now the automation state is basically held by + the regions' AutomationLists. Each region is always set to have the same AutoState. + */ + + if (region_views.empty()) { + _pending_automation_state = state; + } else { + for (std::list<RegionView *>::iterator i = region_views.begin(); i != region_views.end(); ++i) { + boost::shared_ptr<AutomationLine> line = dynamic_cast<AutomationRegionView*>(*i)->line(); + if (line && line->the_list()) { + line->the_list()->set_automation_state (state); + } } } } @@ -196,10 +210,8 @@ AutomationStreamView::color_handler () AutoState AutomationStreamView::automation_state () const { - /* XXX: bit of a hack: just return the state of our first RegionView */ - if (region_views.empty()) { - return Off; + return _pending_automation_state; } boost::shared_ptr<AutomationLine> line = ((AutomationRegionView*) region_views.front())->line (); |