using namespace std;
using namespace ARDOUR;
-//using namespace sigc;
+using namespace PBD;
sigc::signal<void,Playlist*> Playlist::PlaylistCreated;
}
};
-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();
}
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);
}
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));
void
Playlist::init (bool hide)
{
- atomic_set (&block_notifications, 0);
- atomic_set (&ignore_state_changes, 0);
+ g_atomic_int_set (&block_notifications, 0);
+ g_atomic_int_set (&ignore_state_changes, 0);
pending_modified = false;
pending_length = false;
_refcnt = 0;
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;
}
Playlist::freeze ()
{
delay_notifications ();
- atomic_inc (&ignore_state_changes);
+ g_atomic_int_inc (&ignore_state_changes);
}
void
Playlist::thaw ()
{
- atomic_dec (&ignore_state_changes);
+ g_atomic_int_dec_and_test (&ignore_state_changes);
release_notifications ();
}
void
Playlist::delay_notifications ()
{
- atomic_inc (&block_notifications);
+ g_atomic_int_inc (&block_notifications);
freeze_length = _get_maximum_extent();
}
void
Playlist::release_notifications ()
{
- if (atomic_dec_and_test(&block_notifications)) {
+ if (g_atomic_int_dec_and_test (&block_notifications)) {
flush_notifications ();
}
}
return -1;
}
+void
+Playlist::get_equivalent_regions (const Region& other, vector<Region*>& 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<Region*>& 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)
{
_session.region_name (after_name, region.name(), false);
right = createRegion (region, before, after, after_name, region.layer(), Region::Flag (region.flags()|Region::RightOfSplit));
-
+
add_region_internal (left, region.position(), true);
add_region_internal (right, region.position() + before);
+
+ uint64_t orig_layer_op = region.last_layer_op();
+ for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
+ if ((*i)->last_layer_op() > orig_layer_op) {
+ (*i)->set_last_layer_op( (*i)->last_layer_op() + 1 );
+ }
+ }
+
+ left->set_last_layer_op ( orig_layer_op );
+ right->set_last_layer_op ( orig_layer_op + 1);
+
+ layer_op_counter++;
finalize_split_region (®ion, left, right);
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"));
}
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");
}
Region*
-Playlist::find_region (id_t id) const
+Playlist::find_region (const ID& id) const
{
RegionLock rlock (const_cast<Playlist*> (this));
RegionList::const_iterator i;