From d98f87d542e65f56c55035571bcb7b8802288a24 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 24 Sep 2017 00:54:26 +0200 Subject: No more disk-reader roll-delay It was not working in sdio/6.0-pre anyway and with upcoming changes to latency compensation the concept of per disk[stream/reader] will go away. --- libs/ardour/ardour/disk_reader.h | 8 ++---- libs/ardour/ardour/session.h | 2 -- libs/ardour/disk_reader.cc | 55 +++++----------------------------------- libs/ardour/luabindings.cc | 1 - libs/ardour/route.cc | 15 +---------- libs/ardour/session.cc | 8 +----- libs/ardour/session_export.cc | 2 +- 7 files changed, 12 insertions(+), 79 deletions(-) (limited to 'libs') diff --git a/libs/ardour/ardour/disk_reader.h b/libs/ardour/ardour/disk_reader.h index 8e124a27dd..be336fffad 100644 --- a/libs/ardour/ardour/disk_reader.h +++ b/libs/ardour/ardour/disk_reader.h @@ -52,9 +52,6 @@ class LIBARDOUR_API DiskReader : public DiskIOProcessor int overwrite_existing_buffers (); void set_pending_overwrite (bool yn); - samplecnt_t roll_delay() const { return _roll_delay; } - void set_roll_delay (samplecnt_t); - virtual XMLNode& state (bool full); int set_state (const XMLNode&, int version); @@ -117,13 +114,12 @@ class LIBARDOUR_API DiskReader : public DiskIOProcessor /** The number of samples by which this diskstream's output should be delayed with respect to the transport sample. This is used for latency compensation. */ - samplecnt_t _roll_delay; - samplepos_t overwrite_sample; + samplepos_t overwrite_sample; off_t overwrite_offset; bool _pending_overwrite; bool overwrite_queued; IOChange input_change_pending; - samplepos_t file_sample[DataType::num_types]; + samplepos_t file_sample[DataType::num_types]; int _do_refill_with_alloc (bool partial_fill); diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index bbd2fe56cf..43336c2465 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -477,7 +477,6 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop samplecnt_t worst_output_latency ()const { return _worst_output_latency; } samplecnt_t worst_input_latency () const { return _worst_input_latency; } samplecnt_t worst_track_latency () const { return _worst_track_latency; } - samplecnt_t worst_track_roll_delay () const { return _worst_track_roll_delay; } samplecnt_t worst_track_out_latency () const { return _worst_track_out_latency; } samplecnt_t worst_playback_latency () const { return _worst_output_latency + _worst_track_latency; } @@ -1267,7 +1266,6 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop samplecnt_t _worst_input_latency; samplecnt_t _worst_track_latency; samplecnt_t _worst_track_out_latency; - samplecnt_t _worst_track_roll_delay; bool _have_captured; bool _non_soloed_outs_muted; bool _listening; diff --git a/libs/ardour/disk_reader.cc b/libs/ardour/disk_reader.cc index 3aac9e07f5..a9f403d40b 100644 --- a/libs/ardour/disk_reader.cc +++ b/libs/ardour/disk_reader.cc @@ -50,11 +50,10 @@ bool DiskReader::_no_disk_output = false; DiskReader::DiskReader (Session& s, string const & str, DiskIOProcessor::Flag f) : DiskIOProcessor (s, str, f) - , _roll_delay (0) , overwrite_sample (0) - , overwrite_offset (0) - , _pending_overwrite (false) - , overwrite_queued (false) + , overwrite_offset (0) + , _pending_overwrite (false) + , overwrite_queued (false) , _gui_feed_buffer (AudioEngine::instance()->raw_buffer_size (DataType::MIDI)) { file_sample[DataType::AUDIO] = 0; @@ -127,13 +126,6 @@ DiskReader::set_name (string const & str) return true; } -void -DiskReader::set_roll_delay (ARDOUR::samplecnt_t nframes) -{ - /* Must be called from process context or with process lock held */ - _roll_delay = nframes; -} - XMLNode& DiskReader::state (bool full) { @@ -280,38 +272,14 @@ DiskReader::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp disk_samples_to_consume = nframes; } - bool roll_delayed = false; - samplecnt_t roll_delay_offset = 0; - - if (speed != 0.0) { - if (_roll_delay >= disk_samples_to_consume) { - /* still waiting for _roll_delay to end */ - _roll_delay -= disk_samples_to_consume; - /* we could set disk_samples_to_consume to zero here, but it - won't be used anyway. - */ - roll_delayed = true; - - } else if (_roll_delay > 0) { - /* roll delay will end during this call to ::run(), but - * there's some silence needed in the signal-from-disk first - */ - roll_delay_offset = _roll_delay; - bufs.silence (_roll_delay, 0); - disk_samples_to_consume -= _roll_delay; - start_sample += _roll_delay; - _roll_delay = 0; - } - } - BufferSet& scratch_bufs (_session.get_scratch_buffers (bufs.count())); const bool still_locating = _session.global_locate_pending(); - if (!result_required || ((ms & MonitoringDisk) == 0) || still_locating || _no_disk_output || roll_delayed) { + if (!result_required || ((ms & MonitoringDisk) == 0) || still_locating || _no_disk_output) { /* no need for actual disk data, just advance read pointer and return */ - if (!roll_delayed && (!still_locating || _no_disk_output)) { + if (!still_locating || _no_disk_output) { for (ChannelList::iterator chan = c->begin(); chan != c->end(); ++chan) { (*chan)->buf->increment_read_ptr (disk_samples_to_consume); } @@ -319,7 +287,7 @@ DiskReader::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp /* if monitoring disk but locating put silence in the buffers */ - if ((roll_delayed || _no_disk_output || still_locating) && (ms == MonitoringDisk)) { + if ((_no_disk_output || still_locating) && (ms == MonitoringDisk)) { bufs.silence (nframes, 0); } @@ -351,15 +319,6 @@ DiskReader::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp disk_signal = output.data (); } - /* if we skipped some number of samples at the start - because of the _roll_delay being non-zero but small - enough that we will process some data from disk, - advance where we're going to write that data to, - thus skipping over the silence that was written - there. - */ - disk_signal += roll_delay_offset; - if (start_sample < playback_sample) { cerr << owner()->name() << " SS = " << start_sample << " PS = " << playback_sample << endl; abort (); @@ -459,7 +418,7 @@ DiskReader::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp } } - if (!still_locating && !roll_delayed) { + if (!still_locating) { bool butler_required = false; diff --git a/libs/ardour/luabindings.cc b/libs/ardour/luabindings.cc index 34dcabc736..7f13fc5abf 100644 --- a/libs/ardour/luabindings.cc +++ b/libs/ardour/luabindings.cc @@ -2171,7 +2171,6 @@ LuaBindings::common (lua_State* L) .addFunction ("worst_output_latency", &Session::worst_output_latency) .addFunction ("worst_input_latency", &Session::worst_input_latency) .addFunction ("worst_track_latency", &Session::worst_track_latency) - .addFunction ("worst_track_roll_delay", &Session::worst_track_roll_delay) .addFunction ("worst_track_out_latency", &Session::worst_track_out_latency) .addFunction ("worst_playback_latency", &Session::worst_playback_latency) .addFunction ("cfg", &Session::cfg) diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index cc2a9e4aec..4eae23bd19 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -3360,10 +3360,6 @@ Route::non_realtime_transport_stop (samplepos_t now, bool flush) (*i)->non_realtime_transport_stop (now, flush); } } - - if (_disk_reader) { - _disk_reader->set_roll_delay (_initial_delay); - } } void @@ -3870,7 +3866,7 @@ Route::add_export_point() Glib::Threads::RWLock::WriterLock lw (_processor_lock); // this aligns all tracks; but not tracks + busses - samplecnt_t latency = _session.worst_track_roll_delay (); + samplecnt_t latency = _session.worst_track_out_latency (); // FIXME assert (latency >= _initial_delay); _capturing_processor.reset (new CapturingProcessor (_session, latency - _initial_delay)); _capturing_processor->activate (); @@ -3950,11 +3946,6 @@ Route::set_latency_compensation (samplecnt_t longest_session_latency) initial_delay_changed (); /* EMIT SIGNAL */ } - if (_session.transport_stopped()) { - if (_disk_reader) { - _disk_reader->set_roll_delay (_initial_delay); - } - } } void @@ -4910,10 +4901,6 @@ Route::non_realtime_locate (samplepos_t pos) (*i)->non_realtime_locate (pos); } } - - if (_disk_reader) { - _disk_reader->set_roll_delay (_initial_delay); - } } void diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 0d9888df24..b903ed66fc 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -200,7 +200,6 @@ Session::Session (AudioEngine &eng, , _worst_input_latency (0) , _worst_track_latency (0) , _worst_track_out_latency (0) - , _worst_track_roll_delay (0) , _have_captured (false) , _non_soloed_outs_muted (false) , _listening (false) @@ -6935,14 +6934,9 @@ Session::post_playback_latency () } } - _worst_track_roll_delay = 0; - for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { if (!(*i)->active()) { continue ; } - (*i)->set_latency_compensation (_worst_track_latency + _worst_track_out_latency - (*i)->output ()->latency ()); - if (boost::dynamic_pointer_cast (*i)) { - _worst_track_roll_delay = max (_worst_track_roll_delay, (*i)->initial_delay ()); - } + (*i)->set_latency_compensation (_worst_track_out_latency - (*i)->output ()->latency ()); } } diff --git a/libs/ardour/session_export.cc b/libs/ardour/session_export.cc index 04c945b658..33ede3cadc 100644 --- a/libs/ardour/session_export.cc +++ b/libs/ardour/session_export.cc @@ -141,7 +141,7 @@ Session::start_audio_export (samplepos_t position, bool realtime, bool region_ex * (this is all still very [w]hacky. Individual Bus and Track outputs * are not aligned but one can select them in the PortExportChannelSelector) */ - _export_latency = worst_track_roll_delay (); + _export_latency = worst_track_out_latency (); boost::shared_ptr master = master_out (); if (master && comensate_master_latency) { -- cgit v1.2.3