diff options
author | Robin Gareus <robin@gareus.org> | 2016-09-21 03:42:06 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-09-21 03:42:06 +0200 |
commit | ad0aef7dce247ac69fc9c86554d0acbe6c3045bd (patch) | |
tree | 93ae652087c18ee0bac271c3141ffe36123e910c /libs/ardour | |
parent | 22e16b7904d0a8a4068ecc21c7751334aa050d80 (diff) |
add API to change FileSource path in-place
This allows to retain IDs and References of a FileSource, while
changing the actual file under the hood (e.g. from .wav to .flac)
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/file_source.h | 1 | ||||
-rw-r--r-- | libs/ardour/file_source.cc | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/libs/ardour/ardour/file_source.h b/libs/ardour/ardour/file_source.h index 00fb74b426..9b4c2ccffc 100644 --- a/libs/ardour/ardour/file_source.h +++ b/libs/ardour/ardour/file_source.h @@ -79,6 +79,7 @@ public: const std::string& origin() const { return _origin; } virtual void set_path (const std::string&); + void replace_file (const std::string&); static PBD::Signal2<int,std::string,std::vector<std::string> > AmbiguousFileName; diff --git a/libs/ardour/file_source.cc b/libs/ardour/file_source.cc index 32f8a1b124..726b223273 100644 --- a/libs/ardour/file_source.cc +++ b/libs/ardour/file_source.cc @@ -556,6 +556,15 @@ FileSource::set_path (const std::string& newpath) } } + +void +FileSource::replace_file (const std::string& newpath) +{ + close (); + _path = newpath; + _name = Glib::path_get_basename (newpath); +} + void FileSource::inc_use_count () { |