diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2012-05-23 20:32:29 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2012-05-23 20:32:29 +0000 |
commit | 7873fdb55cf8db4bfe9aaf4f4ed311ac91f7e248 (patch) | |
tree | 5b5ed20f3e459285e467755d48d22d8a0bac5734 /libs/ardour/midi_source.cc | |
parent | 2a262b55cbaa1e27f1e55b80ad2893fd408e0e2a (diff) |
alter API for MIDI cloning to facilitate export
git-svn-id: svn://localhost/ardour2/branches/3.0@12401 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/midi_source.cc')
-rw-r--r-- | libs/ardour/midi_source.cc | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/libs/ardour/midi_source.cc b/libs/ardour/midi_source.cc index 0ca8183655..4c854baf69 100644 --- a/libs/ardour/midi_source.cc +++ b/libs/ardour/midi_source.cc @@ -328,21 +328,26 @@ MidiSource::mark_streaming_write_completed () } boost::shared_ptr<MidiSource> -MidiSource::clone (Evoral::MusicalTime begin, Evoral::MusicalTime end) +MidiSource::clone (const string& path, Evoral::MusicalTime begin, Evoral::MusicalTime end) { string newname = PBD::basename_nosuffix(_name.val()); string newpath; - /* get a new name for the MIDI file we're going to write to - */ + if (path.empty()) { - do { - - newname = bump_name_once (newname, '-'); - /* XXX build path safely */ - newpath = _session.session_directory().midi_path().to_string() +"/"+ newname + ".mid"; - - } while (Glib::file_test (newpath, Glib::FILE_TEST_EXISTS)); + /* get a new name for the MIDI file we're going to write to + */ + + do { + newname = bump_name_once (newname, '-'); + /* XXX build path safely */ + newpath = _session.session_directory().midi_path().to_string() +"/"+ newname + ".mid"; + + } while (Glib::file_test (newpath, Glib::FILE_TEST_EXISTS)); + } else { + /* caller must check for pre-existing file */ + newpath = path; + } boost::shared_ptr<MidiSource> newsrc = boost::dynamic_pointer_cast<MidiSource>( SourceFactory::createWritable(DataType::MIDI, _session, |