summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/ardour/ardour/disk_writer.h4
-rw-r--r--libs/ardour/disk_io.cc9
-rw-r--r--libs/ardour/disk_writer.cc59
-rw-r--r--libs/ardour/midi_track.cc7
4 files changed, 61 insertions, 18 deletions
diff --git a/libs/ardour/ardour/disk_writer.h b/libs/ardour/ardour/disk_writer.h
index 6d2683780b..34a53a5a25 100644
--- a/libs/ardour/ardour/disk_writer.h
+++ b/libs/ardour/ardour/disk_writer.h
@@ -77,7 +77,7 @@ class LIBARDOUR_API DiskWriter : public DiskIOProcessor
boost::shared_ptr<SMFSource> midi_write_source () { return _midi_write_source; }
- virtual std::string steal_write_source_name () { return std::string(); }
+ virtual std::string steal_write_source_name ();
int use_new_write_source (DataType, uint32_t n = 0);
void reset_write_sources (bool, bool force = false);
@@ -91,6 +91,8 @@ class LIBARDOUR_API DiskWriter : public DiskIOProcessor
void set_input_latency (framecnt_t);
framecnt_t input_latency () const { return _input_latency; }
+ bool configure_io (ChanCount in, ChanCount out);
+
std::list<boost::shared_ptr<Source> >& last_capture_sources () { return _last_capture_sources; }
bool record_enabled() const { return g_atomic_int_get (const_cast<gint*>(&_record_enabled)); }
diff --git a/libs/ardour/disk_io.cc b/libs/ardour/disk_io.cc
index 587ba19ed0..40f97cba0a 100644
--- a/libs/ardour/disk_io.cc
+++ b/libs/ardour/disk_io.cc
@@ -136,10 +136,8 @@ DiskIOProcessor::can_support_io_configuration (const ChanCount& in, ChanCount& o
return false;
}
- if (in != out) {
- /* currently no way to deliver different channels that we receive */
- return false;
- }
+ /* currently no way to deliver different channels that we receive */
+ out = in;
return true;
}
@@ -332,6 +330,7 @@ DiskIOProcessor::use_playlist (DataType dt, boost::shared_ptr<Playlist> playlist
DEBUG_TRACE (DEBUG::DiskIO, string_compose ("%1: set to use playlist %2 (%3)\n", name(), playlist->name(), dt.to_string()));
if (playlist == _playlists[dt]) {
+ DEBUG_TRACE (DEBUG::DiskIO, string_compose ("%1: already using that playlist\n", name()));
return 0;
}
@@ -349,7 +348,7 @@ DiskIOProcessor::use_playlist (DataType dt, boost::shared_ptr<Playlist> playlist
playlist->DropReferences.connect_same_thread (playlist_connections, boost::bind (&DiskIOProcessor::playlist_deleted, this, boost::weak_ptr<Playlist>(playlist)));
playlist->RangesMoved.connect_same_thread (playlist_connections, boost::bind (&DiskIOProcessor::playlist_ranges_moved, this, _1, _2));
- DEBUG_TRACE (DEBUG::DiskIO, string_compose ("%1 now use playlist %1 (%2)\n", name(), playlist->name(), playlist->id()));
+ DEBUG_TRACE (DEBUG::DiskIO, string_compose ("%1 now using playlist %1 (%2)\n", name(), playlist->name(), playlist->id()));
PlaylistChanged (dt); /* EMIT SIGNAL */
_session.set_dirty ();
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;
+}
diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc
index 4e666b7c0a..777db1d91d 100644
--- a/libs/ardour/midi_track.cc
+++ b/libs/ardour/midi_track.cc
@@ -79,10 +79,6 @@ MidiTrack::MidiTrack (Session& sess, string name, TrackMode mode)
, _input_active (true)
{
_session.SessionLoaded.connect_same_thread (*this, boost::bind (&MidiTrack::restore_controls, this));
-
- _disk_writer->set_note_mode (_note_mode);
- _disk_reader->reset_tracker ();
-
}
MidiTrack::~MidiTrack ()
@@ -98,6 +94,9 @@ MidiTrack::init ()
_input->changed.connect_same_thread (*this, boost::bind (&MidiTrack::track_input_active, this, _1, _2));
+ _disk_writer->set_note_mode (_note_mode);
+ _disk_reader->reset_tracker ();
+
return 0;
}