diff options
Diffstat (limited to 'libs/ardour/session.cc')
-rw-r--r-- | libs/ardour/session.cc | 64 |
1 files changed, 36 insertions, 28 deletions
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 59f6425266..182d29ca0b 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -1310,32 +1310,35 @@ Session::set_auto_loop_location (Location* location) } void -Session::update_skips (Location* loc, bool consolidate) +Session::update_loop (Location*) { - Locations::LocationList skips; + set_dirty (); +} - if (consolidate) { +void +Session::update_marks (Location*) +{ + set_dirty (); +} - skips = consolidate_skips (loc); +void +Session::update_skips (Location* loc, bool consolidate) +{ + Locations::LocationList skips; - } else { - Locations::LocationList all_locations = _locations->list (); - - for (Locations::LocationList::iterator l = all_locations.begin(); l != all_locations.end(); ++l) { - if ((*l)->is_skip ()) { - skips.push_back (*l); - } - } - } + if (consolidate) { + consolidate_skips (loc); + } - sync_locations_to_skips (skips); + sync_locations_to_skips (); + + set_dirty (); } -Locations::LocationList +void Session::consolidate_skips (Location* loc) { Locations::LocationList all_locations = _locations->list (); - Locations::LocationList skips; for (Locations::LocationList::iterator l = all_locations.begin(); l != all_locations.end(); ) { @@ -1366,35 +1369,40 @@ Session::consolidate_skips (Location* loc) break; case Evoral::OverlapNone: - skips.push_back (*l); ++l; break; } } +} - /* add the new one, which now covers the maximal appropriate range based on overlaps with existing skips */ - - skips.push_back (loc); - - return skips; +void +Session::sync_locations_to_skips () +{ + /* This happens asynchronously (in the audioengine thread). After the clear is done, we will call + * Session::_sync_locations_to_skips() from the audioengine thread. + */ + clear_events (SessionEvent::Skip, boost::bind (&Session::_sync_locations_to_skips, this)); } void -Session::sync_locations_to_skips (const Locations::LocationList& locations) +Session::_sync_locations_to_skips () { - clear_events (SessionEvent::Skip); + /* called as a callback after existing Skip events have been cleared from a realtime audioengine thread */ - for (Locations::LocationList::const_iterator i = locations.begin(); i != locations.end(); ++i) { - + Locations::LocationList const & locs (_locations->list()); + + for (Locations::LocationList::const_iterator i = locs.begin(); i != locs.end(); ++i) { + Location* location = *i; - - if (location->is_skipping()) { + + if (location->is_skip() && location->is_skipping()) { SessionEvent* ev = new SessionEvent (SessionEvent::Skip, SessionEvent::Add, location->start(), location->end(), 1.0); queue_event (ev); } } } + void Session::location_added (Location *location) { |