summaryrefslogtreecommitdiff
path: root/libs/ardour/playlist_source.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2020-01-08 22:18:18 -0700
committerPaul Davis <paul@linuxaudiosystems.com>2020-01-08 22:21:21 -0700
commit7373e3ac148aedc2d0c707443e5ea6b6c208ed7a (patch)
treeb2c78c03a06b77fe6f8d09c5bc9a14a945796602 /libs/ardour/playlist_source.cc
parentd1c2098c112c65d9fcb11805e53df53134ae88b5 (diff)
add concept of an owner region (by ID) to PlaylistSource
Diffstat (limited to 'libs/ardour/playlist_source.cc')
-rw-r--r--libs/ardour/playlist_source.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/libs/ardour/playlist_source.cc b/libs/ardour/playlist_source.cc
index dc03bbeb2d..0922d2e959 100644
--- a/libs/ardour/playlist_source.cc
+++ b/libs/ardour/playlist_source.cc
@@ -47,6 +47,7 @@ PlaylistSource::PlaylistSource (Session& s, const ID& orig, const std::string& n
: Source (s, type, name)
, _playlist (p)
, _original (orig)
+ , _owner (0) /* zero is never a legal ID for an object */
{
/* PlaylistSources are never writable, renameable, removable or destructive */
_flags = Flag (_flags & ~(Writable|CanRename|Removable|RemovableIfEmpty|RemoveAtDestroy|Destructive));
@@ -77,6 +78,14 @@ PlaylistSource::~PlaylistSource ()
}
void
+PlaylistSource::set_owner (PBD::ID const &id)
+{
+ if (_owner == 0) {
+ _owner = id;
+ }
+}
+
+void
PlaylistSource::add_state (XMLNode& node)
{
node.set_property ("playlist", _playlist->id ());
@@ -84,6 +93,10 @@ PlaylistSource::add_state (XMLNode& node)
node.set_property ("length", _playlist_length);
node.set_property ("original", _original);
+ if (_owner != 0) {
+ node.set_property ("owner", _owner);
+ }
+
node.add_child_nocopy (_playlist->get_state());
}
@@ -139,6 +152,12 @@ PlaylistSource::set_state (const XMLNode& node, int /*version*/)
throw failed_constructor ();
}
+ /* this is allowed to fail. It either means an older session file
+ format, or a PlaylistSource that wasn't created for a combined
+ region (whose ID would be stored in _owner).
+ */
+ node.get_property (X_("owner"), _owner);
+
_level = _playlist->max_source_level () + 1;
return 0;