- string newname = PBD::basename_nosuffix(_name.val());
- string newpath;
-
- 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));
- } 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,
- newpath, false, _session.frame_rate()));
-