summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_source.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour/midi_source.cc')
-rw-r--r--libs/ardour/midi_source.cc28
1 files changed, 4 insertions, 24 deletions
diff --git a/libs/ardour/midi_source.cc b/libs/ardour/midi_source.cc
index d4452490fb..655222413a 100644
--- a/libs/ardour/midi_source.cc
+++ b/libs/ardour/midi_source.cc
@@ -332,29 +332,9 @@ MidiSource::mark_streaming_write_completed ()
mark_midi_streaming_write_completed (Evoral::Sequence<Evoral::MusicalTime>::DeleteStuckNotes);
}
-boost::shared_ptr<MidiSource>
-MidiSource::clone (const string& path, Evoral::MusicalTime begin, Evoral::MusicalTime end)
+int
+MidiSource::write_to (boost::shared_ptr<MidiSource> newsrc, Evoral::MusicalTime begin, Evoral::MusicalTime end)
{
- string newpath;
-
- /* get a new name for the MIDI file we're going to write to
- */
-
- if (path.empty()) {
- 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;
- }
-
- boost::shared_ptr<MidiSource> newsrc = boost::dynamic_pointer_cast<MidiSource>(
- SourceFactory::createWritable(DataType::MIDI, _session,
- newpath, false, _session.frame_rate()));
-
newsrc->set_timeline_position(_timeline_position);
newsrc->copy_interpolation_from (this);
newsrc->copy_automation_state_from (this);
@@ -367,7 +347,7 @@ MidiSource::clone (const string& path, Evoral::MusicalTime begin, Evoral::Musica
}
} else {
error << string_compose (_("programming error: %1"), X_("no model for MidiSource during ::clone()"));
- return boost::shared_ptr<MidiSource>();
+ return -1;
}
newsrc->flush_midi();
@@ -384,7 +364,7 @@ MidiSource::clone (const string& path, Evoral::MusicalTime begin, Evoral::Musica
boost::dynamic_pointer_cast<FileSource> (newsrc)->prevent_deletion ();
- return newsrc;
+ return 0;
}
void