diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2014-04-10 08:58:04 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2014-04-10 08:58:04 -0400 |
commit | c52f7957a9b350dbb0d290a39acd33eb4472a218 (patch) | |
tree | 0998cb649e23ca8b98a782c5a34d7f9932ab2076 /libs/ardour/midi_source.cc | |
parent | 0802cbf30cc576e68df90b793b74f8691a7a4311 (diff) |
redesign technique for naming/creating regions for MIDI clone (or other non-capture driven MIDI region creation operations).
See comments in Session::new_midi_source_name() for details.
Diffstat (limited to 'libs/ardour/midi_source.cc')
-rw-r--r-- | libs/ardour/midi_source.cc | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/libs/ardour/midi_source.cc b/libs/ardour/midi_source.cc index 8034634ba7..d4452490fb 100644 --- a/libs/ardour/midi_source.cc +++ b/libs/ardour/midi_source.cc @@ -335,21 +335,19 @@ MidiSource::mark_streaming_write_completed () boost::shared_ptr<MidiSource> 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()) { - - /* get a new name for the MIDI file we're going to write to - */ - - do { - newname = bump_name_once (newname, '-'); - newpath = Glib::build_filename (_session.session_directory().midi_path(), newname + ".mid"); - - } while (Glib::file_test (newpath, Glib::FILE_TEST_EXISTS)); + string newname = PBD::basename_nosuffix(_name.val()); + newname = bump_name_once (newname, '-'); + newname += ".mid"; + newpath = _session.new_source_path_from_name (DataType::MIDI, newname); } else { /* caller must check for pre-existing file */ + assert (!Glib::file_test (path, Glib::FILE_TEST_EXISTS)); newpath = path; } |