diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2017-06-23 14:19:04 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2017-09-18 11:40:53 -0400 |
commit | 79abf3dfa6d649fbf1fb6fd16cd489f434d0b909 (patch) | |
tree | 32ff1d2f37f17c8eb627ac2357dff4aea4e149c7 | |
parent | d4280997fb1764ae0df619fbb34031bebd4b0670 (diff) |
set + store signal chain latency for all processors; DiskWriter sets its capture_offset appropriately
-rw-r--r-- | libs/ardour/ardour/disk_writer.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/processor.h | 4 | ||||
-rw-r--r-- | libs/ardour/disk_writer.cc | 7 | ||||
-rw-r--r-- | libs/ardour/processor.cc | 9 | ||||
-rw-r--r-- | libs/ardour/route.cc | 6 |
5 files changed, 22 insertions, 6 deletions
diff --git a/libs/ardour/ardour/disk_writer.h b/libs/ardour/ardour/disk_writer.h index 72882e86fb..218d1fc1fa 100644 --- a/libs/ardour/ardour/disk_writer.h +++ b/libs/ardour/ardour/disk_writer.h @@ -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; diff --git a/libs/ardour/ardour/processor.h b/libs/ardour/ardour/processor.h index 1898b6cb60..095ab7fadf 100644 --- a/libs/ardour/ardour/processor.h +++ b/libs/ardour/ardour/processor.h @@ -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 diff --git a/libs/ardour/disk_writer.cc b/libs/ardour/disk_writer.cc index 4eb4393861..82f9324d5b 100644 --- a/libs/ardour/disk_writer.cc +++ b/libs/ardour/disk_writer.cc @@ -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 (); } diff --git a/libs/ardour/processor.cc b/libs/ardour/processor.cc index 23e55f91ae..335bb0f019 100644 --- a/libs/ardour/processor.cc +++ b/libs/ardour/processor.cc @@ -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; +} + diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 352d36a2c5..b7a57fd3f1 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -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); |