X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fplaylist.cc;h=47462a3575be3b19274698290d9dbf861f68a3d8;hb=8c5cff60912c7e0a7256f635641399500d8d00d9;hp=12490d02d7b7d4a9ce5da12a9ef882b1c9e5db5b;hpb=2a262b55cbaa1e27f1e55b80ad2893fd408e0e2a;p=ardour.git diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 12490d02d7..47462a3575 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -19,20 +19,14 @@ #include #include -#include #include -#include -#include #include -#include #include #include "pbd/convert.h" -#include "pbd/failed_constructor.h" #include "pbd/stateful_diff_command.h" #include "pbd/xml++.h" -#include "pbd/stacktrace.h" #include "ardour/debug.h" #include "ardour/playlist.h" @@ -53,9 +47,9 @@ using namespace ARDOUR; using namespace PBD; namespace ARDOUR { -namespace Properties { -PBD::PropertyDescriptor regions; -} + namespace Properties { + PBD::PropertyDescriptor regions; + } } struct ShowMeTheList { @@ -256,7 +250,7 @@ Playlist::Playlist (boost::shared_ptr other, framepos_t start, f plist.add (Properties::layer, region->layer()); plist.add (Properties::layering_index, region->layering_index()); - new_region = RegionFactory::RegionFactory::create (region, plist); + new_region = RegionFactory::create (region, plist); add_region_internal (new_region, position); } @@ -290,7 +284,7 @@ Playlist::copy_regions (RegionList& newlist) const RegionReadLock rlock (const_cast (this)); for (RegionList::const_iterator i = regions.begin(); i != regions.end(); ++i) { - newlist.push_back (RegionFactory::RegionFactory::create (*i, true)); + newlist.push_back (RegionFactory::create (*i, true)); } } @@ -317,6 +311,7 @@ Playlist::init (bool hide) in_partition = false; subcnt = 0; _frozen = false; + _capture_insertion_underway = false; _combine_ops = 0; _session.history().BeginUndoRedo.connect_same_thread (*this, boost::bind (&Playlist::begin_undo, this)); @@ -756,10 +751,6 @@ Playlist::flush_notifications (bool from_undo) notify_region_added (region); - if (!holding_state ()) { - check_crossfades (region->range ()); - } - region->PropertyChanged.connect_same_thread (region_state_changed_connections, boost::bind (&Playlist::region_changed_proxy, this, _1, boost::weak_ptr (region))); return true; @@ -853,6 +844,17 @@ Playlist::flush_notifications (bool from_undo) } } + void + Playlist::get_source_equivalent_regions (boost::shared_ptr other, vector >& results) + { + for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) { + + if ((*i) && (*i)->any_source_equivalent (other)) { + results.push_back (*i); + } + } + } + void Playlist::partition (framepos_t start, framepos_t end, bool cut) { @@ -1100,8 +1102,6 @@ Playlist::flush_notifications (bool from_undo) in_partition = false; } - - check_crossfades (Evoral::Range (start, end)); } boost::shared_ptr @@ -1558,10 +1558,6 @@ Playlist::flush_notifications (bool from_undo) save = !(_splicing || _nudging); } - if (what_changed.contains (our_interests) && !what_changed.contains (pos_and_length)) { - check_crossfades (region->range ()); - } - if (what_changed.contains (Properties::position) && !what_changed.contains (Properties::length)) { notify_region_moved (region); } else if (!what_changed.contains (Properties::position) && what_changed.contains (Properties::length)) { @@ -2001,11 +1997,11 @@ Playlist::find_next_region (framepos_t frame, RegionPoint point, int dir) freeze (); /* add the added regions */ - for (RegionListProperty::ChangeContainer::iterator i = change.added.begin(); i != change.added.end(); ++i) { + for (RegionListProperty::ChangeContainer::const_iterator i = change.added.begin(); i != change.added.end(); ++i) { add_region_internal ((*i), (*i)->position()); } /* remove the removed regions */ - for (RegionListProperty::ChangeContainer::iterator i = change.removed.begin(); i != change.removed.end(); ++i) { + for (RegionListProperty::ChangeContainer::const_iterator i = change.removed.begin(); i != change.removed.end(); ++i) { remove_region (*i); } @@ -2105,15 +2101,6 @@ Playlist::find_next_region (framepos_t frame, RegionPoint point, int dir) if (seen_region_nodes && regions.empty()) { ret = -1; - } else { - - /* update dependents, which was not done during add_region_internal - due to in_set_state being true - */ - - for (RegionList::iterator r = regions.begin(); r != regions.end(); ++r) { - check_crossfades ((*r)->range ()); - } } thaw (); @@ -2185,6 +2172,16 @@ Playlist::n_regions() const return regions.size(); } +/** @return true if the all_regions list is empty, ie this playlist + * has never had a region added to it. + */ +bool +Playlist::all_regions_empty() const +{ + RegionReadLock rl (const_cast (this)); + return all_regions.empty(); +} + pair Playlist::get_extent () const { @@ -2416,7 +2413,6 @@ Playlist::raise_region (boost::shared_ptr region) { set_layer (region, region->layer() + 1.5); relayer (); - check_crossfades (region->range ()); } void @@ -2424,7 +2420,6 @@ Playlist::lower_region (boost::shared_ptr region) { set_layer (region, region->layer() - 1.5); relayer (); - check_crossfades (region->range ()); } void @@ -2432,7 +2427,6 @@ Playlist::raise_region_to_top (boost::shared_ptr region) { set_layer (region, DBL_MAX); relayer (); - check_crossfades (region->range ()); } void @@ -2440,7 +2434,6 @@ Playlist::lower_region_to_bottom (boost::shared_ptr region) { set_layer (region, -0.5); relayer (); - check_crossfades (region->range ()); } void @@ -2495,7 +2488,7 @@ Playlist::uses_source (boost::shared_ptr src) const { RegionReadLock rlock (const_cast (this)); - for (set >::iterator r = all_regions.begin(); r != all_regions.end(); ++r) { + for (set >::const_iterator r = all_regions.begin(); r != all_regions.end(); ++r) { if ((*r)->uses_source (src)) { return true; } @@ -2540,7 +2533,7 @@ Playlist::region_by_id (const ID& id) const { /* searches all regions ever added to this playlist */ - for (set >::iterator i = all_regions.begin(); i != all_regions.end(); ++i) { + for (set >::const_iterator i = all_regions.begin(); i != all_regions.end(); ++i) { if ((*i)->id() == id) { return *i; } @@ -2832,6 +2825,7 @@ Playlist::combine (const RegionList& r) /* make position relative to zero */ pl->add_region (copied_region, original_region->position() - earliest_position); + copied_region->set_layer (original_region->layer ()); /* use the maximum number of channels for any region */ @@ -3109,8 +3103,10 @@ restart: } } } +} - for (list >::iterator i = ranges.begin(); i != ranges.end(); ++i) { - check_crossfades (*i); - } +void +Playlist::set_capture_insertion_in_progress (bool yn) +{ + _capture_insertion_underway = yn; }