diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2020-01-08 22:18:18 -0700 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2020-01-08 22:21:21 -0700 |
commit | 7373e3ac148aedc2d0c707443e5ea6b6c208ed7a (patch) | |
tree | b2c78c03a06b77fe6f8d09c5bc9a14a945796602 /libs/ardour/playlist_source.cc | |
parent | d1c2098c112c65d9fcb11805e53df53134ae88b5 (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.cc | 19 |
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; |