in_set_state = true;
use_new_playlist ();
in_set_state = false;
+
+ if (flag & Destructive) {
+ use_destructive_playlist ();
+ }
}
AudioDiskstream::AudioDiskstream (Session& sess, const XMLNode& node)
PropertyList plist;
plist.add (Properties::name, _name.val());
plist.add (Properties::start, 0);
- plist.add (Properties::length, max_framepos - (max_framepos - srcs.front()->natural_position()));
+ plist.add (Properties::length, max_framepos - srcs.front()->natural_position());
boost::shared_ptr<Region> region (RegionFactory::create (srcs, plist));
_playlist->add_region (region, srcs.front()->natural_position());
+
+ /* apply region properties and update write sources */
+ use_destructive_playlist();
}
void
with the (presumed single, full-extent) region.
*/
- boost::shared_ptr<Region> rp = _playlist->find_next_region (_session.current_start_frame(), Start, 1);
+ boost::shared_ptr<Region> rp;
+ {
+ const RegionList& rl (_playlist->region_list().rlist());
+ if (rl.size() > 0) {
+ assert((rl.size() == 1));
+ rp = rl.front();
+ }
+ }
if (!rp) {
reset_write_sources (false, true);
if (loc && start >= loop_end) {
start = loop_start + ((start - loop_start) % loop_length);
}
+
}
if (reversed) {
return false;
}
+ /* if no regions are present: easy */
+
+ if (_playlist->n_regions() == 0) {
+ requires_bounce = false;
+ return true;
+ }
+
/* is there only one region ? */
if (_playlist->n_regions() != 1) {
return false;
}
- boost::shared_ptr<Region> first = _playlist->find_next_region (_session.current_start_frame(), Start, 1);
+ boost::shared_ptr<Region> first;
+ {
+ const RegionList& rl (_playlist->region_list().rlist());
+ assert((rl.size() == 1));
+ first = rl.front();
+
+ }
+
if (!first) {
requires_bounce = false;
return true;
/* do the source(s) for the region cover the session start position ? */
if (first->position() != _session.current_start_frame()) {
+ // what is the idea here? why start() ??
if (first->start() > _session.current_start_frame()) {
requires_bounce = true;
return false;
}
}
+ /* currently RouteTimeAxisView::set_track_mode does not
+ * implement bounce. Existing regions cannot be converted.
+ *
+ * so let's make sure this region is already set up
+ * as tape-track (spanning the complete range)
+ */
+ if (first->length() != max_framepos - first->position()) {
+ requires_bounce = true;
+ return false;
+ }
+
/* is the source used by only 1 playlist ? */
boost::shared_ptr<AudioRegion> afirst = boost::dynamic_pointer_cast<AudioRegion> (first);
AudioDiskstream::ChannelInfo::~ChannelInfo ()
{
+ if (write_source) {
+ if (write_source->removable()) {
+ /* this is a "stub" write source which exists in the
+ Session source list, but is removable. We must emit
+ a drop references call because it should not
+ continue to exist. If we do not do this, then the
+ Session retains a reference to it, it is not
+ deleted, and later attempts to create a new source
+ file will use wierd naming because it already
+ exists.
+
+ XXX longer term TO-DO: do not add to session source
+ list until we write to the source.
+ */
+ write_source->drop_references ();
+ }
+ }
+
write_source.reset ();
delete [] speed_buffer;