From 384c0a9facf1bfecc783ac048dbb0bae4ad901fd Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 10 Apr 2014 08:58:04 -0400 Subject: 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. --- libs/ardour/midi_diskstream.cc | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'libs/ardour/midi_diskstream.cc') 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 > -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 > ret; - - /* put some data on the disk, even if its just a header for an empty file */ - boost::dynamic_pointer_cast (_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 -- cgit v1.2.3