diff options
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r-- | libs/ardour/ardour/latent.h | 48 |
1 files changed, 41 insertions, 7 deletions
diff --git a/libs/ardour/ardour/latent.h b/libs/ardour/ardour/latent.h index c4464f7ba4..b7d9a3fcd5 100644 --- a/libs/ardour/ardour/latent.h +++ b/libs/ardour/ardour/latent.h @@ -26,27 +26,61 @@ namespace ARDOUR { class LIBARDOUR_API Latent { - public: +public: Latent() : _user_latency (0) {} virtual ~Latent() {} virtual samplecnt_t signal_latency() const = 0; - samplecnt_t user_latency () const { return _user_latency; } + /* effective latency to be used while processing */ samplecnt_t effective_latency() const { - if (_user_latency) { + if (_zero_latency) { + return 0; + } else if (_use_user_latency) { return _user_latency; } else { return signal_latency (); } } - virtual void set_user_latency (samplecnt_t val) { _user_latency = val; } + /* custom user-set latency, if any */ + samplecnt_t user_latency () const { + if (_use_user_latency) { + return _user_latency; + } else { + return 0; + } + } + + void unset_user_latency () { + _use_user_latency = false; + _user_latency = 0; + } + + virtual void set_user_latency (samplecnt_t val) { + _use_user_latency = true; + _user_latency = val; + } + + static void force_zero_latency (bool en) { + _zero_latency = en; + } - protected: - samplecnt_t _user_latency; + static bool zero_latency () { + return _zero_latency; + } + +protected: + int set_state (const XMLNode& node, int version); + void add_state (XMLNode*) const; + +private: + samplecnt_t _use_user_latency; + samplecnt_t _user_latency; + static bool _zero_latency; }; -} +} /* namespace */ + #endif /* __ardour_latent_h__*/ |