X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fplaylist.cc;h=61aa5c587aca2ed0bfacad87f418a3442f9fa0ae;hb=25d1670a61d19e795227b939a98be9cf5a050c67;hp=7dee8667673a2a1bcd5ccebc24afff66cee8fd48;hpb=fe13d08874f08b723df53116e5655c3d229a657e;p=ardour.git diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 7dee866767..61aa5c587a 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -72,21 +72,24 @@ struct RegionSortByLastLayerOp { } }; -Playlist::Playlist (Session& sess, string nom, bool hide) +Playlist::Playlist (Session& sess, string nom, DataType type, bool hide) : _session (sess) + , _type(type) { init (hide); _name = nom; - _orig_diskstream_id = 0; } -Playlist::Playlist (Session& sess, const XMLNode& node, bool hide) +Playlist::Playlist (Session& sess, const XMLNode& node, DataType type, bool hide) : _session (sess) + , _type(type) { + const XMLProperty* prop = node.property("type"); + assert(!prop || DataType(prop->value()) == _type); + init (hide); _name = "unnamed"; /* reset by set_state */ - _orig_diskstream_id = 0; if (set_state (node)) { throw failed_constructor(); @@ -94,7 +97,7 @@ Playlist::Playlist (Session& sess, const XMLNode& node, bool hide) } Playlist::Playlist (const Playlist& other, string namestr, bool hide) - : _name (namestr), _session (other._session), _orig_diskstream_id(other._orig_diskstream_id) + : _name (namestr), _session (other._session), _type(other._type), _orig_diskstream_id(other._orig_diskstream_id) { init (hide); @@ -127,7 +130,7 @@ Playlist::Playlist (const Playlist& other, string namestr, bool hide) } Playlist::Playlist (const Playlist& other, jack_nframes_t start, jack_nframes_t cnt, string str, bool hide) - : _name (str), _session (other._session), _orig_diskstream_id(other._orig_diskstream_id) + : _name (str), _session (other._session), _type(other._type), _orig_diskstream_id(other._orig_diskstream_id) { RegionLock rlock2 (&((Playlist&)other)); @@ -249,12 +252,14 @@ Playlist::init (bool hide) Playlist::Playlist (const Playlist& pl) : _session (pl._session) + , _type(pl.data_type()) { fatal << _("playlist const copy constructor called") << endmsg; } Playlist::Playlist (Playlist& pl) : _session (pl._session) + , _type(pl.data_type()) { fatal << _("playlist non-const copy constructor called") << endmsg; } @@ -600,6 +605,31 @@ Playlist::remove_region_internal (Region *region, bool delay_sort) return -1; } +void +Playlist::get_equivalent_regions (const Region& other, vector& results) +{ + for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) { + if (Config->get_use_overlap_equivalency()) { + if ((*i)->overlap_equivalent (other)) { + results.push_back ((*i)); + } else if ((*i)->equivalent (other)) { + results.push_back ((*i)); + } + } + } +} + +void +Playlist::get_region_list_equivalent_regions (const Region& other, vector& results) +{ + for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) { + + if ((*i) && (*i)->region_list_equivalent (other)) { + results.push_back (*i); + } + } +} + void Playlist::partition (jack_nframes_t start, jack_nframes_t end, bool just_top_level) { @@ -1343,7 +1373,7 @@ Playlist::set_state (const XMLNode& node) if (prop->name() == X_("name")) { _name = prop->value(); } else if (prop->name() == X_("orig_diskstream_id")) { - sscanf (prop->value().c_str(), "%" PRIu64, &_orig_diskstream_id); + _orig_diskstream_id = prop->value (); } else if (prop->name() == X_("frozen")) { _frozen = (prop->value() == X_("yes")); } @@ -1403,8 +1433,9 @@ Playlist::state (bool full_state) char buf[64]; node->add_property (X_("name"), _name); + node->add_property (X_("type"), _type.to_string()); - snprintf (buf, sizeof(buf), "%" PRIu64, _orig_diskstream_id); + _orig_diskstream_id.print (buf); node->add_property (X_("orig_diskstream_id"), buf); node->add_property (X_("frozen"), _frozen ? "yes" : "no"); @@ -1725,7 +1756,7 @@ Playlist::nudge_after (jack_nframes_t start, jack_nframes_t distance, bool forwa } Region* -Playlist::find_region (id_t id) const +Playlist::find_region (const ID& id) const { RegionLock rlock (const_cast (this)); RegionList::const_iterator i;