diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2014-04-10 08:58:04 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2014-04-14 13:04:14 -0400 |
commit | 384c0a9facf1bfecc783ac048dbb0bae4ad901fd (patch) | |
tree | 6d7aa5fc5396d210612c9f692269cdf0109f096c /libs/ardour/midi_diskstream.cc | |
parent | 2b3cb052caa3426866b67ab14afac84a3dc764a9 (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.cc | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc index 66a3754e2d..eeabdcb728 100644 --- a/libs/ardour/midi_diskstream.cc +++ b/libs/ardour/midi_diskstream.cc @@ -1214,25 +1214,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 |