summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_diskstream.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2014-04-10 08:58:04 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2014-04-10 08:58:04 -0400
commitc52f7957a9b350dbb0d290a39acd33eb4472a218 (patch)
tree0998cb649e23ca8b98a782c5a34d7f9932ab2076 /libs/ardour/midi_diskstream.cc
parent0802cbf30cc576e68df90b793b74f8691a7a4311 (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_diskstream.cc')
-rw-r--r--libs/ardour/midi_diskstream.cc33
1 files changed, 16 insertions, 17 deletions
diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc
index a1a640cd1c..6fd40be57b 100644
--- a/libs/ardour/midi_diskstream.cc
+++ b/libs/ardour/midi_diskstream.cc
@@ -1213,25 +1213,24 @@ MidiDiskstream::use_new_write_source (uint32_t n)
return 0;
}
-
-list<boost::shared_ptr<Source> >
-MidiDiskstream::steal_write_sources()
+/**
+ * We want to use the name of the existing write source (the one that will be
+ * used by the next capture) for another purpose. So change the name of the
+ * current source, and return its current name.
+ *
+ * Return an empty string if the change cannot be accomplished.
+ */
+std::string
+MidiDiskstream::steal_write_source_name ()
{
- list<boost::shared_ptr<Source> > ret;
-
- /* put some data on the disk, even if its just a header for an empty file */
- boost::dynamic_pointer_cast<SMFSource> (_write_source)->ensure_disk_file ();
-
- /* never let it go away */
- _write_source->mark_nonremovable ();
-
- ret.push_back (_write_source);
-
- /* get a new one */
-
- use_new_write_source (0);
+ std::string our_new_name = _session.new_midi_source_name (_write_source->name());
+ std::string our_old_name = _write_source->name();
+
+ if (_write_source->set_source_name (our_new_name, false)) {
+ return string();
+ }
- return ret;
+ return our_old_name;
}
void