summaryrefslogtreecommitdiff
path: root/libs/ardour/disk_writer.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2017-06-12 15:38:59 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2017-09-18 11:40:53 -0400
commit26b13ed5f11e5be61695334b57b18f802bf1e2ba (patch)
tree5f43a3a05f44d89613577be206edb423536bc359 /libs/ardour/disk_writer.cc
parent480b6b81cd070c82eed49dd231a3625554d29cb1 (diff)
get sdio branch working with MIDI tracks
Diffstat (limited to 'libs/ardour/disk_writer.cc')
-rw-r--r--libs/ardour/disk_writer.cc59
1 files changed, 51 insertions, 8 deletions
diff --git a/libs/ardour/disk_writer.cc b/libs/ardour/disk_writer.cc
index 4a1c24c1fd..c3d6039f10 100644
--- a/libs/ardour/disk_writer.cc
+++ b/libs/ardour/disk_writer.cc
@@ -1041,18 +1041,20 @@ DiskWriter::reset_write_sources (bool mark_write_complete, bool /*force*/)
Source::Lock lm(_midi_write_source->mutex());
_midi_write_source->mark_streaming_write_completed (lm);
}
+ }
+ if (_playlists[DataType::MIDI]) {
use_new_write_source (DataType::MIDI);
+ }
- if (destructive() && !c->empty ()) {
+ if (destructive() && !c->empty ()) {
- /* we now have all our write sources set up, so create the
- playlist's single region.
- */
+ /* we now have all our write sources set up, so create the
+ playlist's single region.
+ */
- if (_playlists[DataType::MIDI]->empty()) {
- setup_destructive_playlist ();
- }
+ if (_playlists[DataType::MIDI]->empty()) {
+ setup_destructive_playlist ();
}
}
}
@@ -1507,7 +1509,7 @@ DiskWriter::transport_stopped_wallclock (struct tm& /*when*/, time_t /*twhen*/,
}
- use_new_write_source (0);
+ reset_write_sources ();
for (ci = capture_info.begin(); ci != capture_info.end(); ++ci) {
delete *ci;
@@ -1682,3 +1684,44 @@ DiskWriter::set_name (string const & str)
return true;
}
+
+std::string
+DiskWriter::steal_write_source_name ()
+{
+ if (_playlists[DataType::MIDI]) {
+ string our_old_name = _midi_write_source->name();
+
+ /* this will bump the name of the current write source to the next one
+ * (e.g. "MIDI 1-1" gets renamed to "MIDI 1-2"), thus leaving the
+ * current write source name (e.g. "MIDI 1-1" available). See the
+ * comments in Session::create_midi_source_by_stealing_name() about why
+ * we do this.
+ */
+
+ try {
+ string new_path = _session.new_midi_source_path (name());
+
+ if (_midi_write_source->rename (new_path)) {
+ return string();
+ }
+ } catch (...) {
+ return string ();
+ }
+
+ return our_old_name;
+ }
+
+ return std::string();
+}
+
+bool
+DiskWriter::configure_io (ChanCount in, ChanCount out)
+{
+ if (!DiskIOProcessor::configure_io (in, out)) {
+ return false;
+ }
+
+ reset_write_sources (false, true);
+
+ return true;
+}