#include <stdint.h>
#include <set>
-#include <fstream>
#include <algorithm>
-#include <unistd.h>
-#include <cerrno>
#include <string>
-#include <climits>
#include <boost/lexical_cast.hpp>
#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"
using namespace PBD;
namespace ARDOUR {
-namespace Properties {
-PBD::PropertyDescriptor<bool> regions;
-}
+ namespace Properties {
+ PBD::PropertyDescriptor<bool> regions;
+ }
}
struct ShowMeTheList {
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);
}
RegionReadLock rlock (const_cast<Playlist *> (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));
}
}
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));
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> (region)));
return true;
}
}
+ void
+ Playlist::get_source_equivalent_regions (boost::shared_ptr<Region> other, vector<boost::shared_ptr<Region> >& 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)
{
in_partition = false;
}
-
- check_crossfades (Evoral::Range<framepos_t> (start, end));
}
boost::shared_ptr<Playlist>
times = fabs (times);
{
- RegionWriteLock rl1 (this);
RegionReadLock rl2 (other.get());
int itimes = (int) floor (times);
framecnt_t const shift = other->_get_extent().second;
layer_t top = top_layer ();
- while (itimes--) {
- for (RegionList::iterator i = other->regions.begin(); i != other->regions.end(); ++i) {
- boost::shared_ptr<Region> copy_of_region = RegionFactory::create (*i, true);
-
- /* put these new regions on top of all existing ones, but preserve
- the ordering they had in the original playlist.
- */
-
- add_region_internal (copy_of_region, (*i)->position() + pos);
- set_layer (copy_of_region, copy_of_region->layer() + top);
+ {
+ RegionWriteLock rl1 (this);
+ while (itimes--) {
+ for (RegionList::iterator i = other->regions.begin(); i != other->regions.end(); ++i) {
+ boost::shared_ptr<Region> copy_of_region = RegionFactory::create (*i, true);
+
+ /* put these new regions on top of all existing ones, but preserve
+ the ordering they had in the original playlist.
+ */
+
+ add_region_internal (copy_of_region, (*i)->position() + pos);
+ set_layer (copy_of_region, copy_of_region->layer() + top);
+ }
+ pos += shift;
}
- pos += shift;
}
}
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)) {
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);
}
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 ();
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<Playlist *> (this));
+ return all_regions.empty();
+}
+
pair<framepos_t, framepos_t>
Playlist::get_extent () const
{
{
set_layer (region, region->layer() + 1.5);
relayer ();
- check_crossfades (region->range ());
}
void
{
set_layer (region, region->layer() - 1.5);
relayer ();
- check_crossfades (region->range ());
}
void
{
set_layer (region, DBL_MAX);
relayer ();
- check_crossfades (region->range ());
}
void
{
set_layer (region, -0.5);
relayer ();
- check_crossfades (region->range ());
}
void
{
RegionReadLock rlock (const_cast<Playlist*> (this));
- for (set<boost::shared_ptr<Region> >::iterator r = all_regions.begin(); r != all_regions.end(); ++r) {
+ for (set<boost::shared_ptr<Region> >::const_iterator r = all_regions.begin(); r != all_regions.end(); ++r) {
if ((*r)->uses_source (src)) {
return true;
}
{
/* searches all regions ever added to this playlist */
- for (set<boost::shared_ptr<Region> >::iterator i = all_regions.begin(); i != all_regions.end(); ++i) {
+ for (set<boost::shared_ptr<Region> >::const_iterator i = all_regions.begin(); i != all_regions.end(); ++i) {
if ((*i)->id() == id) {
return *i;
}
/* 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 */
}
}
}
+}
- for (list<Evoral::Range<framepos_t> >::iterator i = ranges.begin(); i != ranges.end(); ++i) {
- check_crossfades (*i);
- }
+void
+Playlist::set_capture_insertion_in_progress (bool yn)
+{
+ _capture_insertion_underway = yn;
}