X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fdisk_reader.cc;h=624a9ac17d7fb0cff581c60427cd51bb3f58548e;hb=5ada17eba0195d90f0685776251b384efdf5168e;hp=1e9743a181d1c87b13bc15cccb01b5648d6a934f;hpb=7d559de3d0f1c4af0270d4f63efc9f772b5f042e;p=ardour.git diff --git a/libs/ardour/disk_reader.cc b/libs/ardour/disk_reader.cc index 1e9743a181..624a9ac17d 100644 --- a/libs/ardour/disk_reader.cc +++ b/libs/ardour/disk_reader.cc @@ -18,7 +18,6 @@ */ #include "pbd/enumwriter.h" -#include "pbd/i18n.h" #include "pbd/memento_command.h" #include "ardour/audioengine.h" @@ -36,6 +35,8 @@ #include "ardour/session.h" #include "ardour/session_playlists.h" +#include "pbd/i18n.h" + using namespace ARDOUR; using namespace PBD; using namespace std; @@ -49,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; @@ -126,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) { @@ -260,11 +253,17 @@ DiskReader::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_samp } } - if (speed == 0.0 && (ms == MonitoringDisk)) { - /* stopped. Don't accidentally pass any data from disk - * into our outputs (e.g. via interpolation) - */ - bufs.silence (nframes, 0); + if (speed == 0.0) { + /* stopped. Don't accidentally pass any data from disk + * into our outputs (e.g. via interpolation) + * nor jump ahead playback_sample when not rolling + */ + if (ms == MonitoringDisk) { + /* when monitoring disk, clear input data so far, + * everything before the disk processor is not relevant. + */ + bufs.silence (nframes, 0); + } return; } @@ -279,38 +278,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); } @@ -318,7 +293,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); } @@ -350,15 +325,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 (); @@ -458,7 +424,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; @@ -665,6 +631,8 @@ DiskReader::seek (samplepos_t sample, bool complete_refill) ChannelList::iterator chan; boost::shared_ptr c = channels.reader(); + //sample = std::max ((samplecnt_t)0, sample -_session.worst_output_latency ()); + for (n = 0, chan = c->begin(); chan != c->end(); ++chan, ++n) { (*chan)->buf->reset (); }