diff options
-rw-r--r-- | libs/ardour/ardour/playlist_source.h | 4 | ||||
-rw-r--r-- | libs/ardour/playlist.cc | 4 | ||||
-rw-r--r-- | libs/ardour/playlist_source.cc | 19 |
3 files changed, 27 insertions, 0 deletions
diff --git a/libs/ardour/ardour/playlist_source.h b/libs/ardour/ardour/playlist_source.h index d78cf0804e..001c8f97a7 100644 --- a/libs/ardour/ardour/playlist_source.h +++ b/libs/ardour/ardour/playlist_source.h @@ -37,10 +37,14 @@ public: int set_state (const XMLNode&, int version); boost::shared_ptr<const Playlist> playlist() const { return _playlist; } const PBD::ID& original() const { return _original; } + const PBD::ID& owner() const { return _owner; } + + void set_owner (PBD::ID const & id); protected: boost::shared_ptr<Playlist> _playlist; PBD::ID _original; + PBD::ID _owner; sampleoffset_t _playlist_offset; samplecnt_t _playlist_length; diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index f2249dcde9..6462ee2dca 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -3177,6 +3177,10 @@ Playlist::combine (const RegionList& r) boost::shared_ptr<Region> compound_region = RegionFactory::create (parent_region, plist, true); + for (SourceList::iterator s = sources.begin(); s != sources.end(); ++s) { + boost::dynamic_pointer_cast<PlaylistSource>(*s)->set_owner (compound_region->id()); + } + /* remove all the selected regions from the current playlist */ freeze (); 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; |