set + store signal chain latency for all processors; DiskWriter sets its capture_offset appropriately

This commit is contained in:
Paul Davis 2017-06-23 14:19:04 -04:00
parent d4280997fb
commit 79abf3dfa6
5 changed files with 22 additions and 6 deletions

View File

@ -90,7 +90,6 @@ class LIBARDOUR_API DiskWriter : public DiskIOProcessor
PBD::Signal0<void> AlignmentStyleChanged;
void set_input_latency (framecnt_t);
framecnt_t input_latency () const { return _input_latency; }
bool configure_io (ChanCount in, ChanCount out);
@ -170,7 +169,6 @@ class LIBARDOUR_API DiskWriter : public DiskIOProcessor
CaptureInfos capture_info;
private:
framecnt_t _input_latency;
gint _record_enabled;
gint _record_safe;
framepos_t capture_start_frame;

View File

@ -70,6 +70,9 @@ class LIBARDOUR_API Processor : public SessionObject, public Automatable, public
virtual framecnt_t signal_latency() const { return 0; }
virtual void set_input_latency (framecnt_t);
framecnt_t input_latency () const { return _input_latency; }
virtual int set_block_size (pframes_t /*nframes*/) { return 0; }
virtual bool requires_fixed_sized_buffers() const { return false; }
@ -149,6 +152,7 @@ protected:
ProcessorWindowProxy *_window_proxy;
PluginPinWindowProxy *_pinmgr_proxy;
SessionObject* _owner;
framecnt_t _input_latency;
};
} // namespace ARDOUR

View File

@ -45,7 +45,6 @@ PBD::Signal0<void> DiskWriter::Overrun;
DiskWriter::DiskWriter (Session& s, string const & str, DiskIOProcessor::Flag f)
: DiskIOProcessor (s, str, f)
, _input_latency (0)
, _record_enabled (0)
, _record_safe (0)
, capture_start_frame (0)
@ -292,7 +291,8 @@ DiskWriter::get_captured_frames (uint32_t n) const
void
DiskWriter::set_input_latency (framecnt_t l)
{
_input_latency = l;
Processor::set_input_latency (l);
set_capture_offset ();
}
void
@ -309,7 +309,7 @@ DiskWriter::set_capture_offset ()
break;
}
DEBUG_TRACE (DEBUG::CaptureAlignment, string_compose ("%1: using IO latency, capture offset set to %2 with style = %3\n", name(), _capture_offset, enum_2_string (_alignment_style)));
DEBUG_TRACE (DEBUG::CaptureAlignment, string_compose ("%1: using input latency %4, capture offset set to %2 with style = %3\n", name(), _capture_offset, enum_2_string (_alignment_style), _input_latency));
}
@ -322,7 +322,6 @@ DiskWriter::set_align_style (AlignStyle a, bool force)
if ((a != _alignment_style) || force) {
_alignment_style = a;
cerr << name() << " using align style " << enum_2_string (_alignment_style) << endl;
set_capture_offset ();
AlignmentStyleChanged ();
}

View File

@ -68,6 +68,7 @@ Processor::Processor(Session& session, const string& name)
, _window_proxy (0)
, _pinmgr_proxy (0)
, _owner (0)
, _input_latency (0)
{
}
@ -86,6 +87,7 @@ Processor::Processor (const Processor& other)
, _window_proxy (0)
, _pinmgr_proxy (0)
, _owner (0)
, _input_latency (0)
{
}
@ -288,3 +290,10 @@ Processor::owner() const
{
return _owner;
}
void
Processor::set_input_latency (framecnt_t cnt)
{
_input_latency = cnt;
}

View File

@ -1806,6 +1806,8 @@ Route::configure_processors_unlocked (ProcessorStreams* err, Glib::Threads::RWLo
// TODO check for a potential ReaderLock after ReaderLock ??
Glib::Threads::RWLock::ReaderLock lr (_processor_lock);
framecnt_t chain_latency = _input->latency ();
list< pair<ChanCount,ChanCount> >::iterator c = configuration.begin();
for (ProcessorList::iterator p = _processors.begin(); p != _processors.end(); ++p, ++c) {
@ -1816,6 +1818,10 @@ Route::configure_processors_unlocked (ProcessorStreams* err, Glib::Threads::RWLo
lm->acquire ();
return -1;
}
(*p)->set_input_latency (chain_latency);
chain_latency += (*p)->signal_latency ();
processor_max_streams = ChanCount::max(processor_max_streams, c->first);
processor_max_streams = ChanCount::max(processor_max_streams, c->second);