diff --git a/libs/ardour/amp.cc b/libs/ardour/amp.cc index 4e3d123f4e..6d71c6c85a 100644 --- a/libs/ardour/amp.cc +++ b/libs/ardour/amp.cc @@ -43,7 +43,7 @@ using namespace PBD; #define GAIN_COEFF_DELTA (1e-5) Amp::Amp (Session& s, const std::string& name, std::shared_ptr gc, bool control_midi_also) - : Processor(s, "Amp", Temporal::AudioTime) + : Processor(s, "Amp", Temporal::TimeDomainProvider (Temporal::AudioTime)) , _apply_gain_automation(false) , _current_gain(GAIN_COEFF_ZERO) , _current_automation_sample (INT64_MAX) diff --git a/libs/ardour/ardour/automatable.h b/libs/ardour/ardour/automatable.h index 13f8009fd3..55a4270c19 100644 --- a/libs/ardour/ardour/automatable.h +++ b/libs/ardour/ardour/automatable.h @@ -34,6 +34,8 @@ #include "evoral/ControlSet.h" +#include "temporal/domain_provider.h" + #include "ardour/libardour_visibility.h" #include "ardour/slavable.h" #include "ardour/types.h" @@ -48,10 +50,10 @@ class AutomationControl; /* The inherited ControlSet is virtual because AutomatableSequence inherits * from this AND EvoralSequence, which is also a ControlSet */ -class LIBARDOUR_API Automatable : virtual public Evoral::ControlSet, public Slavable +class LIBARDOUR_API Automatable : virtual public Evoral::ControlSet, public Slavable, public Temporal::TimeDomainProvider { public: - Automatable(Session&, Temporal::TimeDomain); + Automatable(Session&, Temporal::TimeDomainProvider const &); Automatable (const Automatable& other); virtual ~Automatable(); @@ -117,8 +119,6 @@ public: PBD::Signal0 AutomationStateChanged; - Temporal::TimeDomain time_domain() const { return _time_domain; } - protected: Session& _a_session; @@ -141,7 +141,6 @@ protected: private: PBD::ScopedConnectionList _control_connections; ///< connections to our controls' signals - Temporal::TimeDomain _time_domain; }; diff --git a/libs/ardour/ardour/automatable_sequence.h b/libs/ardour/ardour/automatable_sequence.h index 6366c1b46c..a01a35d627 100644 --- a/libs/ardour/ardour/automatable_sequence.h +++ b/libs/ardour/ardour/automatable_sequence.h @@ -30,15 +30,15 @@ namespace ARDOUR { template class /*LIBARDOUR_API*/ AutomatableSequence : public Automatable, public Evoral::Sequence { public: - AutomatableSequence(Session& s, Temporal::TimeDomain td) + AutomatableSequence(Session& s, Temporal::TimeDomainProvider const & tdp) : Evoral::ControlSet() - , Automatable(s, td) + , Automatable(s, tdp) , Evoral::Sequence(EventTypeMap::instance()) {} AutomatableSequence(const AutomatableSequence& other) : Evoral::ControlSet(other) - , Automatable(other._a_session, other.time_domain()) + , Automatable(other._a_session, other) , Evoral::Sequence(other) {} diff --git a/libs/ardour/ardour/automation_list.h b/libs/ardour/ardour/automation_list.h index 823f998985..2733e5347e 100644 --- a/libs/ardour/ardour/automation_list.h +++ b/libs/ardour/ardour/automation_list.h @@ -73,8 +73,8 @@ private: class LIBARDOUR_API AutomationList : public Evoral::ControlList, public PBD::StatefulDestructible { public: - AutomationList (const Evoral::Parameter& id, const Evoral::ParameterDescriptor& desc, Temporal::TimeDomain); - AutomationList (const Evoral::Parameter& id, Temporal::TimeDomain); + AutomationList (const Evoral::Parameter& id, const Evoral::ParameterDescriptor& desc, Temporal::TimeDomainProvider const &); + AutomationList (const Evoral::Parameter& id, Temporal::TimeDomainProvider const &); AutomationList (const XMLNode&, Evoral::Parameter id); AutomationList (const AutomationList&); AutomationList (const AutomationList&, timepos_t const & start, timepos_t const & end); @@ -82,7 +82,7 @@ public: virtual std::shared_ptr create(const Evoral::Parameter& id, const Evoral::ParameterDescriptor& desc, - Temporal::TimeDomain); + Temporal::TimeDomainProvider const &); AutomationList& operator= (const AutomationList&); diff --git a/libs/ardour/ardour/disk_io.h b/libs/ardour/ardour/disk_io.h index a8084848a6..d1ae059038 100644 --- a/libs/ardour/ardour/disk_io.h +++ b/libs/ardour/ardour/disk_io.h @@ -59,7 +59,7 @@ public: static const std::string state_node_name; - DiskIOProcessor (Session&, Track&, const std::string& name, Flag f, Temporal::TimeDomain td); + DiskIOProcessor (Session&, Track&, const std::string& name, Flag f, Temporal::TimeDomainProvider const &); virtual ~DiskIOProcessor (); diff --git a/libs/ardour/ardour/disk_reader.h b/libs/ardour/ardour/disk_reader.h index 0776ac40b9..c9053ce542 100644 --- a/libs/ardour/ardour/disk_reader.h +++ b/libs/ardour/ardour/disk_reader.h @@ -41,7 +41,7 @@ template class MidiRingBuffer; class LIBARDOUR_API DiskReader : public DiskIOProcessor { public: - DiskReader (Session&, Track&, std::string const& name, Temporal::TimeDomain, DiskIOProcessor::Flag f = DiskIOProcessor::Flag (0)); + DiskReader (Session&, Track&, std::string const& name, Temporal::TimeDomainProvider const &, DiskIOProcessor::Flag f = DiskIOProcessor::Flag (0)); ~DiskReader (); bool set_name (std::string const& str); diff --git a/libs/ardour/ardour/internal_return.h b/libs/ardour/ardour/internal_return.h index 5c6b09c651..51655c9d6a 100644 --- a/libs/ardour/ardour/internal_return.h +++ b/libs/ardour/ardour/internal_return.h @@ -34,7 +34,7 @@ class InternalSend; class LIBARDOUR_API InternalReturn : public Processor { public: - InternalReturn (Session&, Temporal::TimeDomain, std::string const& name = "Return"); + InternalReturn (Session&, Temporal::TimeDomainProvider const &, std::string const& name = "Return"); void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool); bool configure_io (ChanCount, ChanCount); diff --git a/libs/ardour/ardour/io_processor.h b/libs/ardour/ardour/io_processor.h index dbea62935f..15ffad7d72 100644 --- a/libs/ardour/ardour/io_processor.h +++ b/libs/ardour/ardour/io_processor.h @@ -49,7 +49,7 @@ public: ARDOUR::DataType default_type = DataType::AUDIO, bool sendish=false); IOProcessor (Session&, std::shared_ptr input, std::shared_ptr output, - const std::string& proc_name, Temporal::TimeDomain, bool sendish=false); + const std::string& proc_name, Temporal::TimeDomainProvider const &, bool sendish=false); virtual ~IOProcessor (); diff --git a/libs/ardour/ardour/monitor_control.h b/libs/ardour/ardour/monitor_control.h index 37f9aa13ac..e6a7a1d42d 100644 --- a/libs/ardour/ardour/monitor_control.h +++ b/libs/ardour/ardour/monitor_control.h @@ -36,7 +36,7 @@ class Session; class LIBARDOUR_API MonitorControl : public SlavableAutomationControl { public: - MonitorControl (Session& session, std::string const & name, Monitorable& m, Temporal::TimeDomain); + MonitorControl (Session& session, std::string const & name, Monitorable& m, Temporal::TimeDomainProvider const &); ~MonitorControl() {} MonitorChoice monitoring_choice() const { return static_cast ((int)get_value()); } diff --git a/libs/ardour/ardour/monitor_return.h b/libs/ardour/ardour/monitor_return.h index 181de5262f..0d08cc41f7 100644 --- a/libs/ardour/ardour/monitor_return.h +++ b/libs/ardour/ardour/monitor_return.h @@ -28,7 +28,7 @@ class AudioPort; class LIBARDOUR_API MonitorReturn : public InternalReturn { public: - MonitorReturn (Session&, Temporal::TimeDomain); + MonitorReturn (Session&, Temporal::TimeDomainProvider const &); ~MonitorReturn (); void run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool); diff --git a/libs/ardour/ardour/mute_control.h b/libs/ardour/ardour/mute_control.h index 1cd6aad90f..35dee6d63f 100644 --- a/libs/ardour/ardour/mute_control.h +++ b/libs/ardour/ardour/mute_control.h @@ -36,7 +36,7 @@ class Muteable; class LIBARDOUR_API MuteControl : public SlavableAutomationControl { public: - MuteControl (Session& session, std::string const& name, Muteable&, Temporal::TimeDomain td); + MuteControl (Session& session, std::string const& name, Muteable&, Temporal::TimeDomainProvider const &); double get_value () const; double get_save_value() const { return muted_by_self(); } diff --git a/libs/ardour/ardour/pan_controllable.h b/libs/ardour/ardour/pan_controllable.h index 4b8c244920..63b0d38388 100644 --- a/libs/ardour/ardour/pan_controllable.h +++ b/libs/ardour/ardour/pan_controllable.h @@ -36,11 +36,11 @@ class Pannable; class LIBARDOUR_API PanControllable : public AutomationControl { public: - PanControllable (Session& s, std::string name, Pannable* o, Evoral::Parameter param, Temporal::TimeDomain td) + PanControllable (Session& s, std::string name, Pannable* o, Evoral::Parameter param, Temporal::TimeDomainProvider const & tdp) : AutomationControl (s, param, ParameterDescriptor(param), - std::shared_ptr(new AutomationList(param, td)), + std::shared_ptr(new AutomationList(param, tdp)), name) , owner (o) {} diff --git a/libs/ardour/ardour/pannable.h b/libs/ardour/ardour/pannable.h index a357be9cb7..1179b95994 100644 --- a/libs/ardour/ardour/pannable.h +++ b/libs/ardour/ardour/pannable.h @@ -38,7 +38,7 @@ class Panner; class LIBARDOUR_API Pannable : public PBD::Stateful, public Automatable, public SessionHandleRef { public: - Pannable (Session& s, Temporal::TimeDomain); + Pannable (Session& s, Temporal::TimeDomainProvider const &); ~Pannable (); std::shared_ptr pan_azimuth_control; diff --git a/libs/ardour/ardour/panner_shell.h b/libs/ardour/ardour/panner_shell.h index c7e67df5fa..971a74d683 100644 --- a/libs/ardour/ardour/panner_shell.h +++ b/libs/ardour/ardour/panner_shell.h @@ -51,7 +51,7 @@ class Pannable; class LIBARDOUR_API PannerShell : public SessionObject { public: - PannerShell (std::string name, Session&, std::shared_ptr, Temporal::TimeDomain, bool is_send = false); + PannerShell (std::string name, Session&, std::shared_ptr, Temporal::TimeDomainProvider const &, bool is_send = false); virtual ~PannerShell (); std::string describe_parameter (Evoral::Parameter param); diff --git a/libs/ardour/ardour/phase_control.h b/libs/ardour/ardour/phase_control.h index 59e9b6a28c..8ce4e181ab 100644 --- a/libs/ardour/ardour/phase_control.h +++ b/libs/ardour/ardour/phase_control.h @@ -38,7 +38,7 @@ class Session; class LIBARDOUR_API PhaseControl : public AutomationControl { public: - PhaseControl (Session& session, std::string const & name, Temporal::TimeDomain); + PhaseControl (Session& session, std::string const & name, Temporal::TimeDomainProvider const &); /* There are two approaches to designing/using a PhaseControl. One is * to have one such control for every channel of the control's diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h index 30de65b301..883f3ca364 100644 --- a/libs/ardour/ardour/plugin_insert.h +++ b/libs/ardour/ardour/plugin_insert.h @@ -59,7 +59,7 @@ class Plugin; class LIBARDOUR_API PluginInsert : public Processor, public PlugInsertBase, public std::enable_shared_from_this { public: - PluginInsert (Session&, Temporal::TimeDomain td, std::shared_ptr = std::shared_ptr()); + PluginInsert (Session&, Temporal::TimeDomainProvider const & tdp, std::shared_ptr = std::shared_ptr()); ~PluginInsert (); void drop_references (); diff --git a/libs/ardour/ardour/processor.h b/libs/ardour/ardour/processor.h index a92967eeee..c639f25fb1 100644 --- a/libs/ardour/ardour/processor.h +++ b/libs/ardour/ardour/processor.h @@ -51,7 +51,7 @@ class LIBARDOUR_API Processor : public SessionObject, public Automatable, public public: static const std::string state_node_name; - Processor(Session&, const std::string& name, Temporal::TimeDomain); + Processor(Session&, const std::string& name, Temporal::TimeDomainProvider const &); Processor (const Processor& other); virtual ~Processor(); diff --git a/libs/ardour/ardour/record_enable_control.h b/libs/ardour/ardour/record_enable_control.h index 18ec085944..8a79667610 100644 --- a/libs/ardour/ardour/record_enable_control.h +++ b/libs/ardour/ardour/record_enable_control.h @@ -36,7 +36,7 @@ class Session; class LIBARDOUR_API RecordEnableControl : public SlavableAutomationControl { public: - RecordEnableControl (Session& session, std::string const & name, Recordable& m, Temporal::TimeDomain); + RecordEnableControl (Session& session, std::string const & name, Recordable& m, Temporal::TimeDomainProvider const &); ~RecordEnableControl() {} /* Most (Slavable)AutomationControls do not override this, but we need diff --git a/libs/ardour/ardour/record_safe_control.h b/libs/ardour/ardour/record_safe_control.h index 0c09d56c0e..5ff9c4e531 100644 --- a/libs/ardour/ardour/record_safe_control.h +++ b/libs/ardour/ardour/record_safe_control.h @@ -34,7 +34,7 @@ class Session; class LIBARDOUR_API RecordSafeControl : public SlavableAutomationControl { public: - RecordSafeControl (Session& session, std::string const & name, Recordable& m, Temporal::TimeDomain td); + RecordSafeControl (Session& session, std::string const & name, Recordable& m, Temporal::TimeDomainProvider const & td); ~RecordSafeControl() {} protected: diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index d90f5ca887..efc5e4e196 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -68,6 +68,7 @@ #include "lua/luastate.h" #include "temporal/range.h" +#include "temporal/domain_provider.h" #include "midi++/types.h" #include "midi++/mmc.h" @@ -199,7 +200,7 @@ private: }; /** Ardour Session */ -class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionList, public SessionEventManager, public TransportAPI +class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionList, public SessionEventManager, public TransportAPI, public Temporal::TimeDomainProvider { private: diff --git a/libs/ardour/ardour/solo_control.h b/libs/ardour/ardour/solo_control.h index 41e1df381c..168e9a618c 100644 --- a/libs/ardour/ardour/solo_control.h +++ b/libs/ardour/ardour/solo_control.h @@ -34,7 +34,7 @@ class Muteable; class LIBARDOUR_API SoloControl : public SlavableAutomationControl { public: - SoloControl (Session& session, std::string const & name, Soloable& soloable, Muteable& m, Temporal::TimeDomain); + SoloControl (Session& session, std::string const & name, Soloable& soloable, Muteable& m, Temporal::TimeDomainProvider const &); double get_value () const; double get_save_value() const { return self_soloed(); } diff --git a/libs/ardour/ardour/solo_isolate_control.h b/libs/ardour/ardour/solo_isolate_control.h index ec9140eb56..7062d44d01 100644 --- a/libs/ardour/ardour/solo_isolate_control.h +++ b/libs/ardour/ardour/solo_isolate_control.h @@ -36,7 +36,7 @@ class Muteable; class LIBARDOUR_API SoloIsolateControl : public SlavableAutomationControl { public: - SoloIsolateControl (Session& session, std::string const & name, Soloable& soloable, Temporal::TimeDomain); + SoloIsolateControl (Session& session, std::string const & name, Soloable& soloable, Temporal::TimeDomainProvider const &); double get_value () const; diff --git a/libs/ardour/ardour/solo_safe_control.h b/libs/ardour/ardour/solo_safe_control.h index 7c687e60c1..380f47f623 100644 --- a/libs/ardour/ardour/solo_safe_control.h +++ b/libs/ardour/ardour/solo_safe_control.h @@ -34,7 +34,7 @@ class Session; class LIBARDOUR_API SoloSafeControl : public SlavableAutomationControl { public: - SoloSafeControl (Session& session, std::string const & name, Temporal::TimeDomain); + SoloSafeControl (Session& session, std::string const & name, Temporal::TimeDomainProvider const &); double get_value () const; diff --git a/libs/ardour/ardour/stripable.h b/libs/ardour/ardour/stripable.h index 84bbb522aa..509e8d712c 100644 --- a/libs/ardour/ardour/stripable.h +++ b/libs/ardour/ardour/stripable.h @@ -28,7 +28,6 @@ #include - #include "pbd/signals.h" #include "ardour/automatable.h" diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index 8cc2d2eb37..d584658072 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -205,17 +205,17 @@ AudioRegion::register_properties () add_property (_envelope); } -#define AUDIOREGION_STATE_DEFAULT \ +#define AUDIOREGION_STATE_DEFAULT(tdp) \ _envelope_active (Properties::envelope_active, false) \ , _default_fade_in (Properties::default_fade_in, true) \ , _default_fade_out (Properties::default_fade_out, true) \ , _fade_in_active (Properties::fade_in_active, true) \ , _fade_out_active (Properties::fade_out_active, true) \ , _scale_amplitude (Properties::scale_amplitude, 1.0) \ - , _fade_in (Properties::fade_in, std::shared_ptr (new AutomationList (Evoral::Parameter (FadeInAutomation), Temporal::AudioTime))) \ - , _inverse_fade_in (Properties::inverse_fade_in, std::shared_ptr (new AutomationList (Evoral::Parameter (FadeInAutomation), Temporal::AudioTime))) \ - , _fade_out (Properties::fade_out, std::shared_ptr (new AutomationList (Evoral::Parameter (FadeOutAutomation), Temporal::AudioTime))) \ - , _inverse_fade_out (Properties::inverse_fade_out, std::shared_ptr (new AutomationList (Evoral::Parameter (FadeOutAutomation), Temporal::AudioTime))) + , _fade_in (Properties::fade_in, std::shared_ptr (new AutomationList (Evoral::Parameter (FadeInAutomation), tdp))) \ + , _inverse_fade_in (Properties::inverse_fade_in, std::shared_ptr (new AutomationList (Evoral::Parameter (FadeInAutomation), tdp))) \ + , _fade_out (Properties::fade_out, std::shared_ptr (new AutomationList (Evoral::Parameter (FadeOutAutomation), tdp))) \ + , _inverse_fade_out (Properties::inverse_fade_out, std::shared_ptr (new AutomationList (Evoral::Parameter (FadeOutAutomation), tdp))) #define AUDIOREGION_COPY_STATE(other) \ _envelope_active (Properties::envelope_active, other->_envelope_active) \ @@ -248,9 +248,9 @@ AudioRegion::init () /** Constructor for use by derived types only */ AudioRegion::AudioRegion (Session& s, timepos_t const & start, timecnt_t const & len, std::string name) : Region (s, start, len, name, DataType::AUDIO) - , AUDIOREGION_STATE_DEFAULT - , _envelope (Properties::envelope, std::shared_ptr (new AutomationList (Evoral::Parameter(EnvelopeAutomation), Temporal::AudioTime))) - , _automatable (s, Temporal::AudioTime) + , AUDIOREGION_STATE_DEFAULT(Temporal::TimeDomainProvider (Temporal::AudioTime)) + , _envelope (Properties::envelope, std::shared_ptr (new AutomationList (Evoral::Parameter(EnvelopeAutomation), Temporal::TimeDomainProvider (Temporal::AudioTime)))) + , _automatable (s, Temporal::TimeDomainProvider (Temporal::AudioTime)) , _fade_in_suspended (0) , _fade_out_suspended (0) { @@ -261,9 +261,9 @@ AudioRegion::AudioRegion (Session& s, timepos_t const & start, timecnt_t const /** Basic AudioRegion constructor */ AudioRegion::AudioRegion (const SourceList& srcs) : Region (srcs) - , AUDIOREGION_STATE_DEFAULT - , _envelope (Properties::envelope, std::shared_ptr (new AutomationList (Evoral::Parameter(EnvelopeAutomation), Temporal::AudioTime))) - , _automatable(srcs[0]->session(), Temporal::AudioTime) + , AUDIOREGION_STATE_DEFAULT(Temporal::TimeDomainProvider (Temporal::AudioTime)) + , _envelope (Properties::envelope, std::shared_ptr (new AutomationList (Evoral::Parameter(EnvelopeAutomation), Temporal::TimeDomainProvider (Temporal::AudioTime)))) + , _automatable(srcs[0]->session(), Temporal::TimeDomainProvider (Temporal::AudioTime)) , _fade_in_suspended (0) , _fade_out_suspended (0) { @@ -278,7 +278,7 @@ AudioRegion::AudioRegion (std::shared_ptr other) * to do with sources (and hence _start). So when we copy the envelope, we just use the supplied offset. */ , _envelope (Properties::envelope, std::shared_ptr (new AutomationList (*other->_envelope.val(), timepos_t (Temporal::AudioTime), other->len_as_tpos ()))) - , _automatable (other->session(), Temporal::AudioTime) + , _automatable (other->session(), Temporal::TimeDomainProvider (Temporal::AudioTime)) , _fade_in_suspended (0) , _fade_out_suspended (0) { @@ -300,7 +300,7 @@ AudioRegion::AudioRegion (std::shared_ptr other, timecnt_t co to do with sources (and hence _start). So when we copy the envelope, we just use the supplied offset. */ , _envelope (Properties::envelope, std::shared_ptr (new AutomationList (*other->_envelope.val(), timepos_t (offset.samples()), other->len_as_tpos ()))) - , _automatable (other->session(), Temporal::AudioTime) + , _automatable (other->session(), Temporal::TimeDomainProvider (Temporal::AudioTime)) , _fade_in_suspended (0) , _fade_out_suspended (0) { @@ -319,7 +319,7 @@ AudioRegion::AudioRegion (std::shared_ptr other, const Source : Region (std::static_pointer_cast(other), srcs) , AUDIOREGION_COPY_STATE (other) , _envelope (Properties::envelope, std::shared_ptr (new AutomationList (*other->_envelope.val()))) - , _automatable (other->session(), Temporal::AudioTime) + , _automatable (other->session(), Temporal::TimeDomainProvider (Temporal::AudioTime)) , _fade_in_suspended (0) , _fade_out_suspended (0) { @@ -336,9 +336,9 @@ AudioRegion::AudioRegion (std::shared_ptr other, const Source AudioRegion::AudioRegion (SourceList& srcs) : Region (srcs) - , AUDIOREGION_STATE_DEFAULT - , _envelope (Properties::envelope, std::shared_ptr (new AutomationList(Evoral::Parameter(EnvelopeAutomation), Temporal::AudioTime))) - , _automatable(srcs[0]->session(), Temporal::AudioTime) + , AUDIOREGION_STATE_DEFAULT(srcs[0]->session()) + , _envelope (Properties::envelope, std::shared_ptr (new AutomationList(Evoral::Parameter(EnvelopeAutomation), Temporal::TimeDomainProvider (Temporal::AudioTime)))) + , _automatable(srcs[0]->session(), Temporal::TimeDomainProvider (Temporal::AudioTime)) , _fade_in_suspended (0) , _fade_out_suspended (0) { @@ -1037,9 +1037,9 @@ void AudioRegion::set_fade_in (FadeShape shape, samplecnt_t len) { const ARDOUR::ParameterDescriptor desc(FadeInAutomation); - std::shared_ptr c1 (new Evoral::ControlList (FadeInAutomation, desc, Temporal::AudioTime)); - std::shared_ptr c2 (new Evoral::ControlList (FadeInAutomation, desc, Temporal::AudioTime)); - std::shared_ptr c3 (new Evoral::ControlList (FadeInAutomation, desc, Temporal::AudioTime)); + std::shared_ptr c1 (new Evoral::ControlList (FadeInAutomation, desc, Temporal::TimeDomainProvider (Temporal::AudioTime))); + std::shared_ptr c2 (new Evoral::ControlList (FadeInAutomation, desc, Temporal::TimeDomainProvider (Temporal::AudioTime))); + std::shared_ptr c3 (new Evoral::ControlList (FadeInAutomation, desc, Temporal::TimeDomainProvider (Temporal::AudioTime))); _fade_in->freeze (); _fade_in->clear (); @@ -1120,8 +1120,8 @@ void AudioRegion::set_fade_out (FadeShape shape, samplecnt_t len) { const ARDOUR::ParameterDescriptor desc(FadeOutAutomation); - std::shared_ptr c1 (new Evoral::ControlList (FadeOutAutomation, desc, Temporal::AudioTime)); - std::shared_ptr c2 (new Evoral::ControlList (FadeOutAutomation, desc, Temporal::AudioTime)); + std::shared_ptr c1 (new Evoral::ControlList (FadeOutAutomation, desc, Temporal::TimeDomainProvider (Temporal::AudioTime))); + std::shared_ptr c2 (new Evoral::ControlList (FadeOutAutomation, desc, Temporal::TimeDomainProvider (Temporal::AudioTime))); _fade_out->freeze (); _fade_out->clear (); diff --git a/libs/ardour/auditioner.cc b/libs/ardour/auditioner.cc index 6aaaf952fb..174a72595d 100644 --- a/libs/ardour/auditioner.cc +++ b/libs/ardour/auditioner.cc @@ -153,7 +153,7 @@ Auditioner::load_synth () std::shared_ptr p = audition_synth_info->load (_session); if (p) { - asynth = std::shared_ptr (new PluginInsert (_session, time_domain(), p)); + asynth = std::shared_ptr (new PluginInsert (_session, *this, p)); } if (asynth) { diff --git a/libs/ardour/automatable.cc b/libs/ardour/automatable.cc index 7621fabf66..3fe3b0129d 100644 --- a/libs/ardour/automatable.cc +++ b/libs/ardour/automatable.cc @@ -59,17 +59,18 @@ bool Automatable::skip_saving_automation = false; const string Automatable::xml_node_name = X_("Automation"); -Automatable::Automatable(Session& session, Temporal::TimeDomain td) +Automatable::Automatable(Session& session, Temporal::TimeDomainProvider const & tdp) : ControlSet () + , TimeDomainProvider (tdp) , _a_session(session) , _automated_controls (new AutomationControlList ()) - , _time_domain (td) { } Automatable::Automatable (const Automatable& other) : ControlSet (other) , Slavable () + , TimeDomainProvider (other.time_domain(), other._a_session) , _a_session (other._a_session) , _automated_controls (new AutomationControlList) { @@ -554,7 +555,7 @@ Automatable::control_factory(const Evoral::Parameter& param) if (!Variant::type_is_numeric(desc.datatype)) { make_list = false; // Can't automate non-numeric data yet } else { - list = std::shared_ptr(new AutomationList(param, desc, Temporal::AudioTime)); + list = std::shared_ptr(new AutomationList(param, desc, Temporal::TimeDomainProvider (Temporal::AudioTime))); } control = new PluginInsert::PluginPropertyControl(pi, param, desc, list); } @@ -574,35 +575,35 @@ Automatable::control_factory(const Evoral::Parameter& param) } else if (param.type() == PanAzimuthAutomation || param.type() == PanWidthAutomation || param.type() == PanElevationAutomation) { Pannable* pannable = dynamic_cast(this); if (pannable) { - control = new PanControllable (_a_session, describe_parameter (param), pannable, param, time_domain()); + control = new PanControllable (_a_session, describe_parameter (param), pannable, param, *this); } else { warning << "PanAutomation for non-Pannable" << endl; } } else if (param.type() == RecEnableAutomation) { Recordable* re = dynamic_cast (this); if (re) { - control = new RecordEnableControl (_a_session, X_("recenable"), *re, time_domain()); + control = new RecordEnableControl (_a_session, X_("recenable"), *re, *this); } } else if (param.type() == MonitoringAutomation) { Monitorable* m = dynamic_cast(this); if (m) { - control = new MonitorControl (_a_session, X_("monitor"), *m, time_domain()); + control = new MonitorControl (_a_session, X_("monitor"), *m, *this); } } else if (param.type() == SoloAutomation) { Soloable* s = dynamic_cast(this); Muteable* m = dynamic_cast(this); if (s && m) { - control = new SoloControl (_a_session, X_("solo"), *s, *m, time_domain()); + control = new SoloControl (_a_session, X_("solo"), *s, *m, *this); } } else if (param.type() == MuteAutomation) { Muteable* m = dynamic_cast(this); if (m) { - control = new MuteControl (_a_session, X_("mute"), *m, time_domain()); + control = new MuteControl (_a_session, X_("mute"), *m, *this); } } if (make_list && !list) { - list = std::shared_ptr(new AutomationList(param, desc, time_domain())); + list = std::shared_ptr(new AutomationList(param, desc, *this)); } if (!control) { diff --git a/libs/ardour/automation_list.cc b/libs/ardour/automation_list.cc index 15b2440c5c..9569500b69 100644 --- a/libs/ardour/automation_list.cc +++ b/libs/ardour/automation_list.cc @@ -61,8 +61,8 @@ static void dumpit (const AutomationList& al, string prefix = "") cerr << "\n"; } #endif -AutomationList::AutomationList (const Evoral::Parameter& id, const Evoral::ParameterDescriptor& desc, Temporal::TimeDomain time_domain) - : ControlList(id, desc, time_domain) +AutomationList::AutomationList (const Evoral::Parameter& id, const Evoral::ParameterDescriptor& desc, Temporal::TimeDomainProvider const & tdp) + : ControlList(id, desc, tdp) , _before (0) { _state = Off; @@ -75,8 +75,8 @@ AutomationList::AutomationList (const Evoral::Parameter& id, const Evoral::Param AutomationListCreated(this); } -AutomationList::AutomationList (const Evoral::Parameter& id, Temporal::TimeDomain time_domain) - : ControlList(id, ARDOUR::ParameterDescriptor(id), time_domain) +AutomationList::AutomationList (const Evoral::Parameter& id, Temporal::TimeDomainProvider const & tdp) + : ControlList(id, ARDOUR::ParameterDescriptor(id), tdp) , _before (0) { _state = Off; @@ -120,7 +120,7 @@ AutomationList::AutomationList (const AutomationList& other, timepos_t const & s * in or below the AutomationList node. It is used if @p id is non-null. */ AutomationList::AutomationList (const XMLNode& node, Evoral::Parameter id) - : ControlList(id, ARDOUR::ParameterDescriptor(id), Temporal::AudioTime) /* domain may change in ::set_state */ + : ControlList(id, ARDOUR::ParameterDescriptor(id), Temporal::TimeDomainProvider (Temporal::AudioTime)) /* domain may change in ::set_state */ , _before (0) { _touching.store (0); @@ -147,9 +147,9 @@ AutomationList::~AutomationList() std::shared_ptr AutomationList::create(const Evoral::Parameter& id, const Evoral::ParameterDescriptor& desc, - Temporal::TimeDomain time_domain) + Temporal::TimeDomainProvider const & tdp) { - return std::shared_ptr(new AutomationList(id, desc, time_domain)); + return std::shared_ptr(new AutomationList(id, desc, tdp)); } void @@ -449,7 +449,7 @@ AutomationList::set_state (const XMLNode& node, int version) Temporal::TimeDomain time_domain; if (node.get_property ("time-domain", time_domain)) { - set_time_domain_empty (time_domain); + set_time_domain (time_domain); } if (node.name() == X_("events")) { diff --git a/libs/ardour/capturing_processor.cc b/libs/ardour/capturing_processor.cc index 6dd35382d1..3872888ae8 100644 --- a/libs/ardour/capturing_processor.cc +++ b/libs/ardour/capturing_processor.cc @@ -27,7 +27,7 @@ namespace ARDOUR { CapturingProcessor::CapturingProcessor (Session & session, samplecnt_t latency) - : Processor (session, X_("capture point"), Temporal::AudioTime) + : Processor (session, X_("capture point"), Temporal::TimeDomainProvider (Temporal::AudioTime)) , block_size (AudioEngine::instance()->samples_per_cycle()) , _latency (latency) { diff --git a/libs/ardour/delayline.cc b/libs/ardour/delayline.cc index 87af0540bf..64408941f0 100644 --- a/libs/ardour/delayline.cc +++ b/libs/ardour/delayline.cc @@ -36,7 +36,7 @@ using namespace PBD; using namespace ARDOUR; DelayLine::DelayLine (Session& s, const std::string& name) - : Processor (s, string_compose ("latcomp-%1-%2", name, this), Config->get_default_automation_time_domain()) + : Processor (s, string_compose ("latcomp-%1-%2", name, this), Temporal::TimeDomainProvider (Config->get_default_automation_time_domain())) , _bsiz (0) , _delay (0) , _pending_delay (0) diff --git a/libs/ardour/delivery.cc b/libs/ardour/delivery.cc index 9e5cff7b55..e94551df50 100644 --- a/libs/ardour/delivery.cc +++ b/libs/ardour/delivery.cc @@ -57,7 +57,7 @@ bool Delivery::panners_legal = false; Delivery::Delivery (Session& s, std::shared_ptr io, std::shared_ptr pannable, std::shared_ptr mm, const string& name, Role r) - : IOProcessor(s, std::shared_ptr(), (role_requires_output_ports (r) ? io : std::shared_ptr()), name, Temporal::AudioTime, (r == Send || r == Aux || r == Foldback)) + : IOProcessor(s, std::shared_ptr(), (role_requires_output_ports (r) ? io : std::shared_ptr()), name, Temporal::TimeDomainProvider (Temporal::AudioTime), (r == Send || r == Aux || r == Foldback)) , _role (r) , _output_buffers (new BufferSet()) , _current_gain (GAIN_COEFF_ZERO) @@ -68,7 +68,7 @@ Delivery::Delivery (Session& s, std::shared_ptr io, std::shared_ptr(new PannerShell (_name, _session, pannable, time_domain(), is_send)); + _panshell = std::shared_ptr(new PannerShell (_name, _session, pannable, *this, is_send)); } _display_to_user = false; @@ -92,7 +92,7 @@ Delivery::Delivery (Session& s, std::shared_ptr pannable, std::shared_ if (pannable) { bool is_send = false; if (r & (Delivery::Send|Delivery::Aux|Delivery::Foldback)) is_send = true; - _panshell = std::shared_ptr(new PannerShell (_name, _session, pannable, time_domain(), is_send)); + _panshell = std::shared_ptr(new PannerShell (_name, _session, pannable, *this, is_send)); } _display_to_user = false; diff --git a/libs/ardour/disk_io.cc b/libs/ardour/disk_io.cc index 92ab57e1c7..5c37e679b8 100644 --- a/libs/ardour/disk_io.cc +++ b/libs/ardour/disk_io.cc @@ -48,8 +48,8 @@ const string DiskIOProcessor::state_node_name = X_("DiskIOProcessor"); // PBD::Signal0 DiskIOProcessor::DiskOverrun; // PBD::Signal0 DiskIOProcessor::DiskUnderrun; -DiskIOProcessor::DiskIOProcessor (Session& s, Track& t, string const & str, Flag f, Temporal::TimeDomain td) - : Processor (s, str, td) +DiskIOProcessor::DiskIOProcessor (Session& s, Track& t, string const & str, Flag f, Temporal::TimeDomainProvider const & tdp) + : Processor (s, str, tdp) , _flags (f) , _slaved (false) , in_set_state (false) diff --git a/libs/ardour/disk_reader.cc b/libs/ardour/disk_reader.cc index 465bc06ac9..488881064b 100644 --- a/libs/ardour/disk_reader.cc +++ b/libs/ardour/disk_reader.cc @@ -57,8 +57,8 @@ DiskReader::Declicker DiskReader::loop_declick_in; DiskReader::Declicker DiskReader::loop_declick_out; samplecnt_t DiskReader::loop_fade_length (0); -DiskReader::DiskReader (Session& s, Track& t, string const& str, Temporal::TimeDomain td, DiskIOProcessor::Flag f) - : DiskIOProcessor (s, t, X_("player:") + str, f, td) +DiskReader::DiskReader (Session& s, Track& t, string const& str, Temporal::TimeDomainProvider const & tdp, DiskIOProcessor::Flag f) + : DiskIOProcessor (s, t, X_("player:") + str, f, tdp) , overwrite_sample (0) , run_must_resolve (false) , _declick_amp (s.nominal_sample_rate ()) diff --git a/libs/ardour/disk_writer.cc b/libs/ardour/disk_writer.cc index 23aae32c0d..86ee99e79f 100644 --- a/libs/ardour/disk_writer.cc +++ b/libs/ardour/disk_writer.cc @@ -48,7 +48,7 @@ ARDOUR::samplecnt_t DiskWriter::_chunk_samples = DiskWriter::default_chunk_sampl PBD::Signal0 DiskWriter::Overrun; DiskWriter::DiskWriter (Session& s, Track& t, string const & str, DiskIOProcessor::Flag f) - : DiskIOProcessor (s, t, X_("recorder:") + str, f, Config->get_default_automation_time_domain()) + : DiskIOProcessor (s, t, X_("recorder:") + str, f, Temporal::TimeDomainProvider (Config->get_default_automation_time_domain())) , _capture_captured (0) , _was_recording (false) , _xrun_flag (false) diff --git a/libs/ardour/gain_control.cc b/libs/ardour/gain_control.cc index 4c2c471032..e25353ddba 100644 --- a/libs/ardour/gain_control.cc +++ b/libs/ardour/gain_control.cc @@ -67,7 +67,7 @@ static std::shared_ptr automation_list_new (Evoral::Parameter co case InsertReturnLevel: /* fallthrough */ case TrimAutomation: - return std::shared_ptr (new AutomationList (param, Temporal::AudioTime)); + return std::shared_ptr (new AutomationList (param, Temporal::TimeDomainProvider (Temporal::AudioTime))); case MainOutVolume: /* not automatable */ break; diff --git a/libs/ardour/internal_return.cc b/libs/ardour/internal_return.cc index cdade7499f..fb1313b057 100644 --- a/libs/ardour/internal_return.cc +++ b/libs/ardour/internal_return.cc @@ -28,8 +28,8 @@ using namespace std; using namespace ARDOUR; -InternalReturn::InternalReturn (Session& s, Temporal::TimeDomain td, std::string const& name) - : Processor (s, name, td) +InternalReturn::InternalReturn (Session& s, Temporal::TimeDomainProvider const & tdp, std::string const& name) + : Processor (s, name, tdp) { _display_to_user = false; } diff --git a/libs/ardour/io_processor.cc b/libs/ardour/io_processor.cc index 12e3850edd..9025706ccf 100644 --- a/libs/ardour/io_processor.cc +++ b/libs/ardour/io_processor.cc @@ -47,7 +47,7 @@ namespace ARDOUR { class Session; } IOProcessor::IOProcessor (Session& s, bool with_input, bool with_output, const string& proc_name, const string io_name, DataType dtype, bool sendish) - : Processor (s, proc_name, (dtype == DataType::AUDIO ? Temporal::AudioTime : Temporal::BeatTime)) + : Processor (s, proc_name, Temporal::TimeDomainProvider (dtype == DataType::AUDIO ? Temporal::AudioTime : Temporal::BeatTime)) { /* these are true in this constructor whether we actually create the associated IO objects or not. @@ -71,8 +71,8 @@ IOProcessor::IOProcessor (Session& s, bool with_input, bool with_output, /* create an IOProcessor that proxies to an existing IO object */ IOProcessor::IOProcessor (Session& s, std::shared_ptr in, std::shared_ptr out, - const string& proc_name, Temporal::TimeDomain td, bool sendish) - : Processor(s, proc_name, td) + const string& proc_name, Temporal::TimeDomainProvider const & tdp, bool sendish) + : Processor(s, proc_name, tdp) , _input (in) , _output (out) { diff --git a/libs/ardour/lua_api.cc b/libs/ardour/lua_api.cc index a29f75ac2b..b10ea72645 100644 --- a/libs/ardour/lua_api.cc +++ b/libs/ardour/lua_api.cc @@ -115,7 +115,8 @@ ARDOUR::LuaAPI::new_luaproc_with_time_domain (Session *s, const string& name, Te return std::shared_ptr (); } - return std::shared_ptr (new PluginInsert (*s, td, p)); + /* Lua processor takes time domain from session */ + return std::shared_ptr (new PluginInsert (*s, *s, p)); } std::shared_ptr @@ -244,7 +245,8 @@ ARDOUR::LuaAPI::new_plugin_with_time_domain (Session *s, const string& name, ARD } } - return std::shared_ptr (new PluginInsert (*s, td, p)); + /* Lua processor takes time domain from session */ + return std::shared_ptr (new PluginInsert (*s, *s, p)); } bool diff --git a/libs/ardour/meter.cc b/libs/ardour/meter.cc index 3ee76010f4..bb83cb7cdd 100644 --- a/libs/ardour/meter.cc +++ b/libs/ardour/meter.cc @@ -42,7 +42,7 @@ using namespace std; using namespace ARDOUR; PeakMeter::PeakMeter (Session& s, const std::string& name) - : Processor (s, string_compose ("meter-%1", name), Temporal::AudioTime) + : Processor (s, string_compose ("meter-%1", name), Temporal::TimeDomainProvider (Temporal::AudioTime)) { Kmeterdsp::init (s.nominal_sample_rate ()); Iec1ppmdsp::init (s.nominal_sample_rate ()); diff --git a/libs/ardour/midi_model.cc b/libs/ardour/midi_model.cc index 39d868008e..7e993e7d97 100644 --- a/libs/ardour/midi_model.cc +++ b/libs/ardour/midi_model.cc @@ -59,7 +59,7 @@ using namespace ARDOUR; using namespace PBD; MidiModel::MidiModel (MidiSource& s) - : AutomatableSequence (s.session(), Temporal::BeatTime) + : AutomatableSequence (s.session(), Temporal::TimeDomainProvider (Temporal::BeatTime)) , _midi_source (s) { _midi_source.InterpolationChanged.connect_same_thread (_midi_source_connections, boost::bind (&MidiModel::source_interpolation_changed, this, _1, _2)); diff --git a/libs/ardour/monitor_control.cc b/libs/ardour/monitor_control.cc index f489e2617d..cc07e41e38 100644 --- a/libs/ardour/monitor_control.cc +++ b/libs/ardour/monitor_control.cc @@ -24,9 +24,9 @@ using namespace ARDOUR; using namespace PBD; -MonitorControl::MonitorControl (Session& session, std::string const & name, Monitorable& m, Temporal::TimeDomain td) +MonitorControl::MonitorControl (Session& session, std::string const & name, Monitorable& m, Temporal::TimeDomainProvider const & tdp) : SlavableAutomationControl (session, MonitoringAutomation, ParameterDescriptor (MonitoringAutomation), - std::shared_ptr(new AutomationList(Evoral::Parameter(MonitoringAutomation), td)), + std::shared_ptr(new AutomationList(Evoral::Parameter(MonitoringAutomation), tdp)), name) , _monitorable (m) diff --git a/libs/ardour/monitor_processor.cc b/libs/ardour/monitor_processor.cc index b0bb4704ca..91dd07e9d0 100644 --- a/libs/ardour/monitor_processor.cc +++ b/libs/ardour/monitor_processor.cc @@ -48,7 +48,7 @@ namespace ARDOUR { } MonitorProcessor::MonitorProcessor (Session& s) - : Processor (s, X_("MonitorOut"), Temporal::AudioTime) + : Processor (s, X_("MonitorOut"), Temporal::TimeDomainProvider (Temporal::AudioTime)) , solo_cnt (0) , _monitor_active (false) diff --git a/libs/ardour/monitor_return.cc b/libs/ardour/monitor_return.cc index e8a5b2bc09..85d5c8b701 100644 --- a/libs/ardour/monitor_return.cc +++ b/libs/ardour/monitor_return.cc @@ -26,8 +26,8 @@ using namespace ARDOUR; -MonitorReturn::MonitorReturn (Session& s, Temporal::TimeDomain td) - : InternalReturn (s, td, "Monitor Return") +MonitorReturn::MonitorReturn (Session& s, Temporal::TimeDomainProvider const & tdp) + : InternalReturn (s, tdp, "Monitor Return") , _nch (0) , _gain (1.f) { diff --git a/libs/ardour/mute_control.cc b/libs/ardour/mute_control.cc index 361238d1f4..15dfdfc1b5 100644 --- a/libs/ardour/mute_control.cc +++ b/libs/ardour/mute_control.cc @@ -29,9 +29,9 @@ using namespace ARDOUR; using namespace std; -MuteControl::MuteControl (Session& session, std::string const & name, Muteable& m, Temporal::TimeDomain td) +MuteControl::MuteControl (Session& session, std::string const & name, Muteable& m, Temporal::TimeDomainProvider const & tdp) : SlavableAutomationControl (session, MuteAutomation, ParameterDescriptor (MuteAutomation), - std::shared_ptr (new AutomationList (Evoral::Parameter (MuteAutomation), td)), + std::shared_ptr (new AutomationList (Evoral::Parameter (MuteAutomation), tdp)), name) , _muteable (m) { diff --git a/libs/ardour/pannable.cc b/libs/ardour/pannable.cc index ba7e4e1c4b..badacaa4aa 100644 --- a/libs/ardour/pannable.cc +++ b/libs/ardour/pannable.cc @@ -39,14 +39,14 @@ using namespace std; using namespace PBD; using namespace ARDOUR; -Pannable::Pannable (Session& s, Temporal::TimeDomain td) - : Automatable (s, td) +Pannable::Pannable (Session& s, Temporal::TimeDomainProvider const & tdp) + : Automatable (s, tdp) , SessionHandleRef (s) - , pan_azimuth_control (new PanControllable (s, "", this, PanAzimuthAutomation, td)) - , pan_elevation_control (new PanControllable (s, "", this, PanElevationAutomation, td)) - , pan_width_control (new PanControllable (s, "", this, PanWidthAutomation, td)) - , pan_frontback_control (new PanControllable (s, "", this, PanFrontBackAutomation, td)) - , pan_lfe_control (new PanControllable (s, "", this, PanLFEAutomation, td)) + , pan_azimuth_control (new PanControllable (s, "", this, PanAzimuthAutomation, tdp)) + , pan_elevation_control (new PanControllable (s, "", this, PanElevationAutomation, tdp)) + , pan_width_control (new PanControllable (s, "", this, PanWidthAutomation, tdp)) + , pan_frontback_control (new PanControllable (s, "", this, PanFrontBackAutomation, tdp)) + , pan_lfe_control (new PanControllable (s, "", this, PanLFEAutomation, tdp)) , _auto_state (Off) , _has_state (false) , _responding_to_control_auto_state_change (0) diff --git a/libs/ardour/panner_shell.cc b/libs/ardour/panner_shell.cc index b9317be5d3..0e8b0f048c 100644 --- a/libs/ardour/panner_shell.cc +++ b/libs/ardour/panner_shell.cc @@ -66,7 +66,7 @@ using namespace std; using namespace ARDOUR; using namespace PBD; -PannerShell::PannerShell (string name, Session& s, std::shared_ptr p, Temporal::TimeDomain td, bool is_send) +PannerShell::PannerShell (string name, Session& s, std::shared_ptr p, Temporal::TimeDomainProvider const & tdp, bool is_send) : SessionObject (s, name) , _pannable_route (p) , _is_send (is_send) @@ -78,7 +78,7 @@ PannerShell::PannerShell (string name, Session& s, std::shared_ptr p, , _force_reselect (false) { if (is_send) { - _pannable_internal.reset(new Pannable (s, td)); + _pannable_internal.reset(new Pannable (s, tdp)); if (Config->get_link_send_and_route_panner()) { _panlinked = true; } else { diff --git a/libs/ardour/phase_control.cc b/libs/ardour/phase_control.cc index fd3eef7ad1..2fd937f776 100644 --- a/libs/ardour/phase_control.cc +++ b/libs/ardour/phase_control.cc @@ -25,9 +25,9 @@ using namespace std; using namespace PBD; using namespace ARDOUR; -PhaseControl::PhaseControl (Session& session, std::string const & name, Temporal::TimeDomain td) +PhaseControl::PhaseControl (Session& session, std::string const & name, Temporal::TimeDomainProvider const & tdp) : AutomationControl (session, PhaseAutomation, ParameterDescriptor (PhaseAutomation), - std::shared_ptr(new AutomationList(Evoral::Parameter(PhaseAutomation), td)), + std::shared_ptr(new AutomationList(Evoral::Parameter(PhaseAutomation), tdp)), name) { } diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index 9ed1403d4d..0ac4b8c194 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -76,8 +76,8 @@ using namespace PBD; const string PluginInsert::port_automation_node_name = "PortAutomation"; -PluginInsert::PluginInsert (Session& s, Temporal::TimeDomain td, std::shared_ptr plug) - : Processor (s, (plug ? plug->name() : string ("toBeRenamed")), td) +PluginInsert::PluginInsert (Session& s, Temporal::TimeDomainProvider const & tdp, std::shared_ptr plug) + : Processor (s, (plug ? plug->name() : string ("toBeRenamed")), tdp) , _sc_playback_latency (0) , _sc_capture_latency (0) , _plugin_signal_latency (0) @@ -537,7 +537,7 @@ PluginInsert::create_automatable_parameters () const bool automatable = a.find(param) != a.end(); - std::shared_ptr list(new AutomationList(param, desc, time_domain())); + std::shared_ptr list(new AutomationList(param, desc, *this)); std::shared_ptr c (new PluginControl(this, param, desc, list)); if (!automatable || (limit_automatables > 0 && what_can_be_automated ().size() > limit_automatables)) { c->set_flag (Controllable::NotAutomatable); @@ -557,7 +557,7 @@ PluginInsert::create_automatable_parameters () if (desc.datatype != Variant::NOTHING) { std::shared_ptr list; if (Variant::type_is_numeric(desc.datatype)) { - list = std::shared_ptr(new AutomationList(param, desc, time_domain())); + list = std::shared_ptr(new AutomationList(param, desc, *this)); } std::shared_ptr c (new PluginPropertyControl(this, param, desc, list)); if (!Variant::type_is_numeric(desc.datatype)) { @@ -580,7 +580,7 @@ PluginInsert::create_automatable_parameters () desc.lower = 0; desc.upper = 1; - std::shared_ptr list(new AutomationList(param, desc, time_domain())); + std::shared_ptr list(new AutomationList(param, desc, *this)); std::shared_ptr c (new PluginControl(this, param, desc, list)); add_control (c); diff --git a/libs/ardour/polarity_processor.cc b/libs/ardour/polarity_processor.cc index cac6d9539f..b72a4944fb 100644 --- a/libs/ardour/polarity_processor.cc +++ b/libs/ardour/polarity_processor.cc @@ -28,7 +28,7 @@ using namespace ARDOUR; using namespace PBD; PolarityProcessor::PolarityProcessor (Session& s, std::shared_ptr control) - : Processor(s, "Polarity", Temporal::AudioTime) + : Processor(s, "Polarity", Temporal::TimeDomainProvider (Temporal::AudioTime)) , _control (control) { } diff --git a/libs/ardour/port_insert.cc b/libs/ardour/port_insert.cc index 4590b486c1..37b0f7979b 100644 --- a/libs/ardour/port_insert.cc +++ b/libs/ardour/port_insert.cc @@ -57,13 +57,13 @@ PortInsert::PortInsert (Session& s, std::shared_ptr pannable, std::sha , _measured_latency (0) { /* Send */ - _out->set_gain_control (std::shared_ptr (new GainControl (_session, Evoral::Parameter(BusSendLevel), std::shared_ptr (new AutomationList (Evoral::Parameter (BusSendLevel), time_domain()))))); + _out->set_gain_control (std::shared_ptr (new GainControl (_session, Evoral::Parameter(BusSendLevel), std::shared_ptr (new AutomationList (Evoral::Parameter (BusSendLevel), *this))))); - _out->set_polarity_control (std::shared_ptr (new AutomationControl (_session, PhaseAutomation, ParameterDescriptor (PhaseAutomation), std::shared_ptr(new AutomationList(Evoral::Parameter(PhaseAutomation), time_domain())), "polarity-invert"))); + _out->set_polarity_control (std::shared_ptr (new AutomationControl (_session, PhaseAutomation, ParameterDescriptor (PhaseAutomation), std::shared_ptr(new AutomationList(Evoral::Parameter(PhaseAutomation), *this)), "polarity-invert"))); _send_meter.reset (new PeakMeter (_session, name())); /* Return */ - _gain_control = std::shared_ptr (new GainControl (_session, Evoral::Parameter(InsertReturnLevel), std::shared_ptr (new AutomationList (Evoral::Parameter (InsertReturnLevel), time_domain())))); + _gain_control = std::shared_ptr (new GainControl (_session, Evoral::Parameter(InsertReturnLevel), std::shared_ptr (new AutomationList (Evoral::Parameter (InsertReturnLevel), *this)))); _amp.reset (new Amp (_session, _("Return"), _gain_control, true)); _return_meter.reset (new PeakMeter (_session, name())); diff --git a/libs/ardour/processor.cc b/libs/ardour/processor.cc index b47b2e4502..ac7f3dc6c6 100644 --- a/libs/ardour/processor.cc +++ b/libs/ardour/processor.cc @@ -58,9 +58,9 @@ namespace ARDOUR { class Session; } // Always saved as Processor, but may be IOProcessor or Send in legacy sessions const string Processor::state_node_name = "Processor"; -Processor::Processor(Session& session, const string& name, Temporal::TimeDomain td) +Processor::Processor(Session& session, const string& name, Temporal::TimeDomainProvider const & tdp) : SessionObject(session, name) - , Automatable (session, td) + , Automatable (session, tdp) , _pending_active(false) , _active(false) , _next_ab_is_active(false) @@ -82,7 +82,7 @@ Processor::Processor(Session& session, const string& name, Temporal::TimeDomain Processor::Processor (const Processor& other) : Evoral::ControlSet (other) , SessionObject (other.session(), other.name()) - , Automatable (other.session(), other.time_domain()) + , Automatable (other.session(), other) , Latent (other) , _pending_active(other._pending_active) , _active(other._active) diff --git a/libs/ardour/record_enable_control.cc b/libs/ardour/record_enable_control.cc index faccdfd5fe..ec9ea9c5eb 100644 --- a/libs/ardour/record_enable_control.cc +++ b/libs/ardour/record_enable_control.cc @@ -24,9 +24,9 @@ using namespace ARDOUR; using namespace PBD; -RecordEnableControl::RecordEnableControl (Session& session, std::string const & name, Recordable& r, Temporal::TimeDomain td) +RecordEnableControl::RecordEnableControl (Session& session, std::string const & name, Recordable& r, Temporal::TimeDomainProvider const & tdp) : SlavableAutomationControl (session, RecEnableAutomation, ParameterDescriptor (RecEnableAutomation), - std::shared_ptr(new AutomationList(Evoral::Parameter(RecEnableAutomation), td)), + std::shared_ptr(new AutomationList(Evoral::Parameter(RecEnableAutomation), tdp)), name) , _recordable (r) { diff --git a/libs/ardour/record_safe_control.cc b/libs/ardour/record_safe_control.cc index ea71dbf162..c9657d2e69 100644 --- a/libs/ardour/record_safe_control.cc +++ b/libs/ardour/record_safe_control.cc @@ -24,9 +24,9 @@ using namespace ARDOUR; using namespace PBD; -RecordSafeControl::RecordSafeControl (Session& session, std::string const & name, Recordable& r, Temporal::TimeDomain td) +RecordSafeControl::RecordSafeControl (Session& session, std::string const & name, Recordable& r, Temporal::TimeDomainProvider const & tdp) : SlavableAutomationControl (session, RecSafeAutomation, ParameterDescriptor (RecSafeAutomation), - std::shared_ptr(new AutomationList(Evoral::Parameter(RecSafeAutomation), td)), + std::shared_ptr(new AutomationList(Evoral::Parameter(RecSafeAutomation), tdp)), name) , _recordable (r) { diff --git a/libs/ardour/return.cc b/libs/ardour/return.cc index 350b54725b..d3adaf6737 100644 --- a/libs/ardour/return.cc +++ b/libs/ardour/return.cc @@ -51,7 +51,7 @@ Return::Return (Session& s, bool internal) { /* never muted */ - std::shared_ptr gl (new AutomationList (Evoral::Parameter (GainAutomation), time_domain())); + std::shared_ptr gl (new AutomationList (Evoral::Parameter (GainAutomation), *this)); _gain_control = std::shared_ptr (new GainControl (_session, Evoral::Parameter (GainAutomation), gl)); add_control (_gain_control); diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index a94d984d59..2c3f83c88c 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -170,26 +170,28 @@ Route::init () * Automatable API. -- Don't call add_control () here. */ - _solo_control.reset (new SoloControl (_session, X_("solo"), *this, *this, time_domain())); + Temporal::TimeDomainProvider const & tdp (*this); + + _solo_control.reset (new SoloControl (_session, X_("solo"), *this, *this, tdp)); add_control (_solo_control); _solo_control->Changed.connect_same_thread (*this, boost::bind (&Route::solo_control_changed, this, _1, _2)); - _mute_control.reset (new MuteControl (_session, X_("mute"), *this, time_domain())); + _mute_control.reset (new MuteControl (_session, X_("mute"), *this, tdp)); add_control (_mute_control); - _phase_control.reset (new PhaseControl (_session, X_("phase"), time_domain())); + _phase_control.reset (new PhaseControl (_session, X_("phase"), tdp)); add_control (_phase_control); - _solo_isolate_control.reset (new SoloIsolateControl (_session, X_("solo-iso"), *this, time_domain())); + _solo_isolate_control.reset (new SoloIsolateControl (_session, X_("solo-iso"), *this, tdp)); add_control (_solo_isolate_control); - _solo_safe_control.reset (new SoloSafeControl (_session, X_("solo-safe"), time_domain())); + _solo_safe_control.reset (new SoloSafeControl (_session, X_("solo-safe"), tdp)); add_control (_solo_safe_control); /* panning */ if (!(_presentation_info.flags() & PresentationInfo::MonitorOut)) { - _pannable.reset (new Pannable (_session, Config->get_default_automation_time_domain())); + _pannable.reset (new Pannable (_session, Temporal::TimeDomainProvider (Config->get_default_automation_time_domain()))); } /* input and output objects */ @@ -275,7 +277,7 @@ Route::init () if (is_monitor()) { /* where we listen to tracks */ - _intreturn.reset (new MonitorReturn (_session, time_domain())); + _intreturn.reset (new MonitorReturn (_session, tdp)); _intreturn->activate (); /* the thing that provides proper control over a control/monitor/listen bus @@ -956,7 +958,7 @@ Route::add_processor_from_xml_2X (const XMLNode& node, int version) if (_session.get_disable_all_loaded_plugins ()) { processor.reset (new UnknownProcessor (_session, node, this)); } else { - processor.reset (new PluginInsert (_session, time_domain())); + processor.reset (new PluginInsert (_session, *this)); } } else { @@ -966,7 +968,7 @@ Route::add_processor_from_xml_2X (const XMLNode& node, int version) } else if (node.name() == "Send") { - std::shared_ptr sendpan (new Pannable (_session, Config->get_default_automation_time_domain())); + std::shared_ptr sendpan (new Pannable (_session, Temporal::TimeDomainProvider (Config->get_default_automation_time_domain()))); processor.reset (new Send (_session, sendpan, _mute_master)); } else { @@ -3118,6 +3120,7 @@ Route::set_processor_state (const XMLNode& node, int version) XMLNodeConstIterator niter; ProcessorList new_order; bool must_configure = false; + Temporal::TimeDomainProvider const & tdp (*this); for (niter = nlist.begin(); niter != nlist.end(); ++niter) { @@ -3150,7 +3153,7 @@ Route::set_processor_state (const XMLNode& node, int version) _main_outs->set_state (**niter, version); } else if (prop->value() == "monreturn") { if (!_intreturn) { - _intreturn.reset (new MonitorReturn (_session, time_domain())); + _intreturn.reset (new MonitorReturn (_session, tdp)); must_configure = true; } _intreturn->set_state (**niter, version); @@ -3158,9 +3161,9 @@ Route::set_processor_state (const XMLNode& node, int version) if (!_intreturn) { if (is_monitor ()) { - _intreturn.reset (new MonitorReturn (_session, time_domain())); + _intreturn.reset (new MonitorReturn (_session, tdp)); } else { - _intreturn.reset (new InternalReturn (_session, time_domain())); + _intreturn.reset (new InternalReturn (_session, tdp)); } must_configure = true; @@ -3252,6 +3255,7 @@ bool Route::set_processor_state (XMLNode const& node, int version, XMLProperty const* prop, ProcessorList& new_order, bool& must_configure) { ProcessorList::iterator o; + Temporal::TimeDomainProvider const & tdp (*this); for (o = _processors.begin(); o != _processors.end(); ++o) { XMLProperty const * id_prop = node.property(X_("id")); @@ -3284,7 +3288,7 @@ Route::set_processor_state (XMLNode const& node, int version, XMLProperty const* if (_session.get_disable_all_loaded_plugins ()) { processor.reset (new UnknownProcessor (_session, node, this)); } else { - processor.reset (new PluginInsert (_session, time_domain())); + processor.reset (new PluginInsert (_session, tdp)); processor->set_owner (this); } } else if (prop->value() == "port") { @@ -3386,7 +3390,7 @@ void Route::add_internal_return () { if (!_intreturn) { - _intreturn.reset (new InternalReturn (_session, time_domain())); + _intreturn.reset (new InternalReturn (_session, *this)); add_processor (_intreturn, PreFader); } } diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc index 7881118467..f6a20590d1 100644 --- a/libs/ardour/send.cc +++ b/libs/ardour/send.cc @@ -97,7 +97,7 @@ Send::Send (Session& s, std::shared_ptr p, std::shared_ptr { //boost_debug_shared_ptr_mark_interesting (this, "send"); - std::shared_ptr gl (new AutomationList (Evoral::Parameter (BusSendLevel), time_domain())); + std::shared_ptr gl (new AutomationList (Evoral::Parameter (BusSendLevel), *this)); set_gain_control (std::shared_ptr (new GainControl (_session, Evoral::Parameter(BusSendLevel), gl))); gain_control ()->set_flag (Controllable::InlineControl); @@ -110,7 +110,7 @@ Send::Send (Session& s, std::shared_ptr p, std::shared_ptr if (_role == Delivery::Aux || _role == Delivery::Send) { - set_polarity_control (std::shared_ptr (new AutomationControl (_session, PhaseAutomation, ParameterDescriptor (PhaseAutomation), std::shared_ptr(new AutomationList(Evoral::Parameter(PhaseAutomation), time_domain())), "polarity-invert"))); + set_polarity_control (std::shared_ptr (new AutomationControl (_session, PhaseAutomation, ParameterDescriptor (PhaseAutomation), std::shared_ptr(new AutomationList(Evoral::Parameter(PhaseAutomation), *this)), "polarity-invert"))); add_control (polarity_control ()); } diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index e47ea3bacd..53b038a8f0 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -918,7 +918,7 @@ Session::setup_click () { _clicking = false; - std::shared_ptr gl (new AutomationList (Evoral::Parameter (GainAutomation), Temporal::AudioTime)); + std::shared_ptr gl (new AutomationList (Evoral::Parameter (GainAutomation), Temporal::TimeDomainProvider (Temporal::AudioTime))); std::shared_ptr gain_control = std::shared_ptr (new GainControl (*this, Evoral::Parameter(GainAutomation), gl)); _click_io.reset (new ClickIO (*this, X_("Click"))); @@ -3397,7 +3397,7 @@ Session::load_and_connect_instruments (RouteList& new_routes, bool strict_io, st if (pset) { plugin->load_preset (*pset); } - std::shared_ptr pi (new PluginInsert (*this, (*r)->time_domain(), plugin)); + std::shared_ptr pi (new PluginInsert (*this, **r, plugin)); if (strict_io) { pi->set_strict_io (true); } diff --git a/libs/ardour/solo_control.cc b/libs/ardour/solo_control.cc index 65f2d65757..78e3ffd5f2 100644 --- a/libs/ardour/solo_control.cc +++ b/libs/ardour/solo_control.cc @@ -28,9 +28,9 @@ using namespace ARDOUR; using namespace std; using namespace PBD; -SoloControl::SoloControl (Session& session, std::string const & name, Soloable& s, Muteable& m, Temporal::TimeDomain td) +SoloControl::SoloControl (Session& session, std::string const & name, Soloable& s, Muteable& m, Temporal::TimeDomainProvider const & tdp) : SlavableAutomationControl (session, SoloAutomation, ParameterDescriptor (SoloAutomation), - std::shared_ptr(new AutomationList(Evoral::Parameter(SoloAutomation), td)), + std::shared_ptr(new AutomationList(Evoral::Parameter(SoloAutomation), tdp)), name) , _soloable (s) , _muteable (m) diff --git a/libs/ardour/solo_isolate_control.cc b/libs/ardour/solo_isolate_control.cc index f2caf6184c..3e666c0f82 100644 --- a/libs/ardour/solo_isolate_control.cc +++ b/libs/ardour/solo_isolate_control.cc @@ -28,9 +28,9 @@ using namespace ARDOUR; using namespace std; using namespace PBD; -SoloIsolateControl::SoloIsolateControl (Session& session, std::string const & name, Soloable& s, Temporal::TimeDomain td) +SoloIsolateControl::SoloIsolateControl (Session& session, std::string const & name, Soloable& s, Temporal::TimeDomainProvider const & tdp) : SlavableAutomationControl (session, SoloIsolateAutomation, ParameterDescriptor (SoloIsolateAutomation), - std::shared_ptr(new AutomationList(Evoral::Parameter(SoloIsolateAutomation), td)), + std::shared_ptr(new AutomationList(Evoral::Parameter(SoloIsolateAutomation), tdp)), name) , _soloable (s) , _solo_isolated (false) diff --git a/libs/ardour/solo_safe_control.cc b/libs/ardour/solo_safe_control.cc index 45562548b5..66a0f9dd10 100644 --- a/libs/ardour/solo_safe_control.cc +++ b/libs/ardour/solo_safe_control.cc @@ -28,9 +28,9 @@ using namespace ARDOUR; using namespace std; using namespace PBD; -SoloSafeControl::SoloSafeControl (Session& session, std::string const & name, Temporal::TimeDomain td) +SoloSafeControl::SoloSafeControl (Session& session, std::string const & name, Temporal::TimeDomainProvider const & tdp) : SlavableAutomationControl (session, SoloSafeAutomation, ParameterDescriptor (SoloSafeAutomation), - std::shared_ptr(new AutomationList(Evoral::Parameter(SoloSafeAutomation), td)), + std::shared_ptr(new AutomationList(Evoral::Parameter(SoloSafeAutomation), tdp)), name) , _solo_safe (false) { diff --git a/libs/ardour/stripable.cc b/libs/ardour/stripable.cc index e2de8fa72e..adbb00ba94 100644 --- a/libs/ardour/stripable.cc +++ b/libs/ardour/stripable.cc @@ -36,7 +36,7 @@ using std::string; Stripable::Stripable (Session& s, string const & name, PresentationInfo const & pi) : SessionObject (s, name) - , Automatable (s, (pi.flags() & PresentationInfo::MidiIndicatingFlags) ? Temporal::BeatTime : Temporal::AudioTime) + , Automatable (s, Temporal::TimeDomainProvider ((pi.flags() & PresentationInfo::MidiIndicatingFlags) ? Temporal::BeatTime : Temporal::AudioTime)) , _presentation_info (pi) , _active_color_picker (0) { diff --git a/libs/ardour/test/automation_list_property_test.cc b/libs/ardour/test/automation_list_property_test.cc index 25c8489c9a..18d8908073 100644 --- a/libs/ardour/test/automation_list_property_test.cc +++ b/libs/ardour/test/automation_list_property_test.cc @@ -69,7 +69,7 @@ AutomationListPropertyTest::basicTest () descriptor.property_id = g_quark_from_static_string ("FadeIn"); AutomationListProperty property ( descriptor, - std::shared_ptr (new AutomationList (Evoral::Parameter (FadeInAutomation), Temporal::AudioTime)) + std::shared_ptr (new AutomationList (Evoral::Parameter (FadeInAutomation), Temporal::TimeDomainProvider (Temporal::AudioTime))) ); property.clear_changes (); @@ -115,7 +115,7 @@ class Fred : public StatefulDestructible { public: Fred () - : _jim (_descriptor, std::shared_ptr (new AutomationList (Evoral::Parameter (FadeInAutomation), Temporal::AudioTime))) + : _jim (_descriptor, std::shared_ptr (new AutomationList (Evoral::Parameter (FadeInAutomation), Temporal::TimeDomainProvider (Temporal::AudioTime)))) { add_property (_jim); diff --git a/libs/ardour/test/lua_script_test.cc b/libs/ardour/test/lua_script_test.cc index 674aed56a8..82d2e44b43 100644 --- a/libs/ardour/test/lua_script_test.cc +++ b/libs/ardour/test/lua_script_test.cc @@ -91,7 +91,7 @@ LuaScriptTest::dsp_script_test () PluginPtr p = (*i)->load (*_session); CPPUNIT_ASSERT_MESSAGE ((*i)->name, p); - std::shared_ptr processor (new PluginInsert (*_session, r->time_domain(), p)); + std::shared_ptr processor (new PluginInsert (*_session, Temporal::TimeDomainProvider (r->time_domain()), p)); processor->enable (true); int rv = r->add_processor (processor, std::shared_ptr(), 0); diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index 8da0b6e628..ced688a030 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -99,7 +99,7 @@ Track::init () DiskIOProcessor::Flag dflags = DiskIOProcessor::Recordable; - _disk_reader.reset (new DiskReader (_session, *this, name(), Config->get_default_automation_time_domain(), dflags)); + _disk_reader.reset (new DiskReader (_session, *this, name(), Temporal::TimeDomainProvider (Config->get_default_automation_time_domain()), dflags)); _disk_reader->set_block_size (_session.get_block_size ()); _disk_reader->set_owner (this); @@ -116,13 +116,13 @@ Track::init () std::shared_ptr rp (std::dynamic_pointer_cast (shared_from_this())); std::shared_ptr rt = std::dynamic_pointer_cast (rp); - _record_enable_control.reset (new RecordEnableControl (_session, EventTypeMap::instance().to_symbol (RecEnableAutomation), *this, time_domain())); + _record_enable_control.reset (new RecordEnableControl (_session, EventTypeMap::instance().to_symbol (RecEnableAutomation), *this, *this)); add_control (_record_enable_control); - _record_safe_control.reset (new RecordSafeControl (_session, EventTypeMap::instance().to_symbol (RecSafeAutomation), *this, time_domain())); + _record_safe_control.reset (new RecordSafeControl (_session, EventTypeMap::instance().to_symbol (RecSafeAutomation), *this, *this)); add_control (_record_safe_control); - _monitoring_control.reset (new MonitorControl (_session, EventTypeMap::instance().to_symbol (MonitoringAutomation), *this, time_domain())); + _monitoring_control.reset (new MonitorControl (_session, EventTypeMap::instance().to_symbol (MonitoringAutomation), *this, *this)); add_control (_monitoring_control); if (!name().empty()) { diff --git a/libs/ardour/triggerbox.cc b/libs/ardour/triggerbox.cc index 26c70bb900..ec05c5fa85 100644 --- a/libs/ardour/triggerbox.cc +++ b/libs/ardour/triggerbox.cc @@ -3079,7 +3079,7 @@ TriggerBox::static_init (Session & s) } TriggerBox::TriggerBox (Session& s, DataType dt) - : Processor (s, _("TriggerBox"), Temporal::BeatTime) + : Processor (s, _("TriggerBox"), Temporal::TimeDomainProvider (Temporal::BeatTime)) , tracker (dt == DataType::MIDI ? new MidiStateTracker : 0) , _data_type (dt) , _order (-1) @@ -3091,7 +3091,6 @@ TriggerBox::TriggerBox (Session& s, DataType dt) , _locate_armed (false) , _cancel_locate_armed (false) , _fast_forwarding (false) - , requests (1024) { set_display_to_user (false); diff --git a/libs/ardour/unknown_processor.cc b/libs/ardour/unknown_processor.cc index 4c621f3185..5c1abae37f 100644 --- a/libs/ardour/unknown_processor.cc +++ b/libs/ardour/unknown_processor.cc @@ -58,7 +58,7 @@ proc_type_map (std::string const& str) } UnknownProcessor::UnknownProcessor (Session&s, XMLNode const &state, SessionObject* o) - : Processor (s, "", Temporal::AudioTime) + : Processor (s, "", Temporal::TimeDomainProvider (Temporal::AudioTime)) , _state (state) , have_ioconfig (false) , saved_input (0) diff --git a/libs/ardour/vca.cc b/libs/ardour/vca.cc index be2cefdf16..a4edf0d162 100644 --- a/libs/ardour/vca.cc +++ b/libs/ardour/vca.cc @@ -79,8 +79,8 @@ VCA::VCA (Session& s, int32_t num, const string& name) int VCA::init () { - _solo_control.reset (new SoloControl (_session, X_("solo"), *this, *this, time_domain())); - _mute_control.reset (new MuteControl (_session, X_("mute"), *this, time_domain())); + _solo_control.reset (new SoloControl (_session, X_("solo"), *this, *this, *this)); + _mute_control.reset (new MuteControl (_session, X_("mute"), *this, *this)); add_control (_gain_control); add_control (_solo_control); diff --git a/libs/ardour/velocity_control.cc b/libs/ardour/velocity_control.cc index 25ceee59f9..119e2e2375 100644 --- a/libs/ardour/velocity_control.cc +++ b/libs/ardour/velocity_control.cc @@ -32,7 +32,7 @@ using namespace std; VelocityControl::VelocityControl (Session& session) : SlavableAutomationControl (session, Evoral::Parameter (MidiVelocityAutomation), ParameterDescriptor (Evoral::Parameter (MidiVelocityAutomation)), - std::shared_ptr (new AutomationList (Evoral::Parameter (MidiVelocityAutomation), Temporal::BeatTime)), + std::shared_ptr (new AutomationList (Evoral::Parameter (MidiVelocityAutomation), Temporal::TimeDomainProvider (Temporal::BeatTime))), _("Velocity")) { } diff --git a/libs/evoral/ControlList.cc b/libs/evoral/ControlList.cc index c3078047e5..4211b80d83 100644 --- a/libs/evoral/ControlList.cc +++ b/libs/evoral/ControlList.cc @@ -64,33 +64,33 @@ event_time_less_than (ControlEvent* a, ControlEvent* b) return a->when < b->when; } -ControlList::ControlList (const Parameter& id, const ParameterDescriptor& desc, TimeDomain ts) - : _parameter (id) +ControlList::ControlList (const Parameter& id, const ParameterDescriptor& desc, TimeDomainProvider const & tds) + : TimeDomainProvider (tds) + , _parameter (id) , _desc (desc) , _interpolation (default_interpolation ()) - , _time_domain (ts) , _curve (0) { _frozen = 0; _changed_when_thawed = false; - _lookup_cache.left = timepos_t::max (_time_domain); + _lookup_cache.left = timepos_t::max (time_domain()); _lookup_cache.range.first = _events.end (); _lookup_cache.range.second = _events.end (); - _search_cache.left = timepos_t::max (_time_domain); + _search_cache.left = timepos_t::max (time_domain()); _search_cache.first = _events.end (); _sort_pending = false; new_write_pass = true; _in_write_pass = false; did_write_during_pass = false; - insert_position = timepos_t::max (_time_domain); + insert_position = timepos_t::max (time_domain()); most_recent_insert_iterator = _events.end (); } ControlList::ControlList (const ControlList& other) - : _parameter (other._parameter) + : TimeDomainProvider (other) + , _parameter (other._parameter) , _desc (other._desc) , _interpolation (other._interpolation) - , _time_domain (other._time_domain) , _curve (0) { _frozen = 0; @@ -102,7 +102,7 @@ ControlList::ControlList (const ControlList& other) new_write_pass = true; _in_write_pass = false; did_write_during_pass = false; - insert_position = timepos_t::max (_time_domain); + insert_position = timepos_t::max (time_domain()); most_recent_insert_iterator = _events.end (); // XXX copy_events() emits Dirty, but this is just assignment copy/construction @@ -110,10 +110,10 @@ ControlList::ControlList (const ControlList& other) } ControlList::ControlList (const ControlList& other, timepos_t const& start, timepos_t const& end) - : _parameter (other._parameter) + : TimeDomainProvider (other) + , _parameter (other._parameter) , _desc (other._desc) , _interpolation (other._interpolation) - , _time_domain (other._time_domain) , _curve (0) { _frozen = 0; @@ -135,7 +135,7 @@ ControlList::ControlList (const ControlList& other, timepos_t const& start, time new_write_pass = true; _in_write_pass = false; did_write_during_pass = false; - insert_position = timepos_t::max (_time_domain); + insert_position = timepos_t::max (time_domain()); most_recent_insert_iterator = _events.end (); mark_dirty (); @@ -152,9 +152,10 @@ ControlList::~ControlList () } std::shared_ptr -ControlList::create (const Parameter& id, const ParameterDescriptor& desc, TimeDomain time_style) +ControlList::create (const Parameter& id, const ParameterDescriptor& desc, TimeDomainProvider const & tdp) { - return std::shared_ptr (new ControlList (id, desc, time_style)); + ControlList* cl (new ControlList (id, desc, tdp)); + return std::shared_ptr (cl); } bool @@ -176,7 +177,7 @@ ControlList::operator= (const ControlList& other) new_write_pass = true; _in_write_pass = false; did_write_during_pass = false; - insert_position = timepos_t::max (_time_domain); + insert_position = timepos_t::max (time_domain()); _parameter = other._parameter; _desc = other._desc; @@ -267,8 +268,9 @@ ControlList::x_scale (ratio_t const& factor) timepos_t ControlList::ensure_time_domain (timepos_t const& val) const { - if (val.time_domain () != _time_domain) { - switch (_time_domain) { + TimeDomain td (time_domain()); + if (val.time_domain () != td) { + switch (td) { case Temporal::AudioTime: return timepos_t (val.samples ()); break; @@ -527,7 +529,7 @@ ControlList::start_write_pass (timepos_t const& time) */ if (_in_write_pass && !new_write_pass) { #if 1 - add_guard_point (when, timecnt_t (_time_domain)); // also sets most_recent_insert_iterator + add_guard_point (when, timecnt_t (time_domain())); // also sets most_recent_insert_iterator #else const ControlEvent cp (when, 0.0); most_recent_insert_iterator = lower_bound (_events.begin (), _events.end (), &cp, time_comparator); @@ -557,7 +559,7 @@ ControlList::set_in_write_pass (bool yn, bool add_point, timepos_t when) if (yn && add_point) { Glib::Threads::RWLock::WriterLock lm (_lock); - add_guard_point (when, timecnt_t (_time_domain)); + add_guard_point (when, timecnt_t (time_domain())); } } @@ -565,7 +567,7 @@ void ControlList::add_guard_point (timepos_t const& time, timecnt_t const& offset) { /* we do not convert this yet */ - assert (offset.time_domain () == _time_domain); + assert (offset.time_domain () == time_domain()); timepos_t when = ensure_time_domain (time); @@ -686,7 +688,7 @@ ControlList::editor_add (timepos_t const& time, double value, bool with_guard) */ if (when >= 1) { - _events.insert (_events.end (), new ControlEvent (timepos_t (_time_domain), value)); + _events.insert (_events.end (), new ControlEvent (timepos_t (time_domain()), value)); DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 added value %2 at zero\n", this, value)); } } @@ -772,8 +774,8 @@ ControlList::editor_add_ordered (OrderedPoints const & points, bool with_guard) * the same value. */ - if (_events.empty () && when > timecnt_t (_time_domain)) { - _events.insert (_events.end (), new ControlEvent (timepos_t (_time_domain), value)); + if (_events.empty () && when > timecnt_t (time_domain())) { + _events.insert (_events.end (), new ControlEvent (timepos_t (time_domain()), value)); DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 added value %2 at zero\n", this, value)); } @@ -899,11 +901,11 @@ ControlList::add (timepos_t const& time, double value, bool with_guards, bool wi if (when >= 1) { if (_desc.toggled) { const double opp_val = ((value >= 0.5) ? 1.0 : 0.0); - _events.insert (_events.end (), new ControlEvent (timepos_t (_time_domain), opp_val)); + _events.insert (_events.end (), new ControlEvent (timepos_t (time_domain()), opp_val)); DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 added toggled value %2 at zero\n", this, opp_val)); } else { - _events.insert (_events.end (), new ControlEvent (timepos_t (_time_domain), value)); + _events.insert (_events.end (), new ControlEvent (timepos_t (time_domain()), value)); DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 added default value %2 at zero\n", this, _desc.normal)); } } @@ -913,7 +915,7 @@ ControlList::add (timepos_t const& time, double value, bool with_guards, bool wi /* first write in a write pass: add guard point if requested */ if (with_guards) { - add_guard_point (insert_position, timecnt_t (_time_domain)); + add_guard_point (insert_position, timecnt_t (time_domain())); } else { /* not adding a guard, but we need to set iterator appropriately */ const ControlEvent cp (when, 0.0); @@ -1319,10 +1321,10 @@ ControlList::thaw () void ControlList::mark_dirty () const { - _lookup_cache.left = timepos_t::max (_time_domain); + _lookup_cache.left = timepos_t::max (time_domain()); _lookup_cache.range.first = _events.end (); _lookup_cache.range.second = _events.end (); - _search_cache.left = timepos_t::max (_time_domain); + _search_cache.left = timepos_t::max (time_domain()); _search_cache.first = _events.end (); if (_curve) { @@ -1461,7 +1463,7 @@ ControlList::truncate_start (timecnt_t const& overall) if (np < 2) { /* less than 2 points: add a new point */ - _events.push_front (new ControlEvent (timepos_t (_time_domain), _events.front ()->value)); + _events.push_front (new ControlEvent (timepos_t (time_domain()), _events.front ()->value)); } else { /* more than 2 points: check to see if the first 2 values @@ -1474,10 +1476,10 @@ ControlList::truncate_start (timecnt_t const& overall) if (_events.front ()->value == (*second)->value) { /* first segment is flat, just move start point back to zero */ - _events.front ()->when = timepos_t (_time_domain); + _events.front ()->when = timepos_t (time_domain()); } else { /* leave non-flat segment in place, add a new leading point. */ - _events.push_front (new ControlEvent (timepos_t (_time_domain), _events.front ()->value)); + _events.push_front (new ControlEvent (timepos_t (time_domain()), _events.front ()->value)); } } @@ -1518,7 +1520,7 @@ ControlList::truncate_start (timecnt_t const& overall) /* add a new point for the interpolated new value */ - _events.push_front (new ControlEvent (timepos_t (_time_domain), first_legal_value)); + _events.push_front (new ControlEvent (timepos_t (time_domain()), first_legal_value)); } unlocked_invalidate_insert_iterator (); @@ -1620,7 +1622,7 @@ ControlList::multipoint_eval (timepos_t const& xtime) const /* Only do the range lookup if xtime is in a different range than last time * this was called (or if the lookup cache has been marked "dirty" (left<0) */ - if ((_lookup_cache.left == timepos_t::max (_time_domain)) || + if ((_lookup_cache.left == timepos_t::max (time_domain())) || ((_lookup_cache.left > xtime) || (_lookup_cache.range.first == _events.end ()) || ((*_lookup_cache.range.second)->when < xtime))) { @@ -1675,7 +1677,7 @@ ControlList::multipoint_eval (timepos_t const& xtime) const } /* x is a control point in the data */ - _lookup_cache.left = timepos_t::max (_time_domain); + _lookup_cache.left = timepos_t::max (time_domain()); return (*range.first)->value; } @@ -1687,9 +1689,9 @@ ControlList::build_search_cache_if_necessary (timepos_t const& start_time) const if (_events.empty ()) { /* Empty, nothing to cache, move to end. */ _search_cache.first = _events.end (); - _search_cache.left = timepos_t::max (_time_domain); + _search_cache.left = timepos_t::max (time_domain()); return; - } else if ((_search_cache.left == timepos_t::max (_time_domain)) || (_search_cache.left > start)) { + } else if ((_search_cache.left == timepos_t::max (time_domain())) || (_search_cache.left > start)) { /* Marked dirty (left == max), or we're too far forward, re-search. */ const ControlEvent start_point (start, 0); @@ -1920,7 +1922,7 @@ ControlList::rt_safe_earliest_event_linear_unlocked (Temporal::timepos_t const& std::shared_ptr ControlList::cut_copy_clear (timepos_t const& start_time, timepos_t const& end_time, int op) { - std::shared_ptr nal = create (_parameter, _desc, _time_domain); + std::shared_ptr nal = create (_parameter, _desc, *this); iterator s, e; timepos_t start = start_time; @@ -1964,7 +1966,7 @@ ControlList::cut_copy_clear (timepos_t const& start_time, timepos_t const& end_t } if (op != 2) { // ! clear - nal->_events.push_back (new ControlEvent (timepos_t (_time_domain), val)); + nal->_events.push_back (new ControlEvent (timepos_t (time_domain()), val)); } } @@ -2070,10 +2072,10 @@ ControlList::paste (const ControlList& alist, timepos_t const& time) timepos_t adj_pos; - if (_time_domain == (*i)->when.time_domain ()) { + if (time_domain() == (*i)->when.time_domain ()) { adj_pos = (*i)->when + pos; } else { - if (_time_domain == AudioTime) { + if (time_domain() == AudioTime) { adj_pos = timepos_t (((*i)->when + pos).samples ()); } else { adj_pos = timepos_t (((*i)->when + pos).beats ()); @@ -2155,7 +2157,7 @@ ControlList::move_ranges (const list& movements) while (j != old_events.end ()) { timepos_t jtime; - switch (_time_domain) { + switch (time_domain()) { case AudioTime: jtime = (*j)->when; break; @@ -2174,7 +2176,7 @@ ControlList::move_ranges (const list& movements) if (jtime >= i->from) { ControlEvent* ev = new ControlEvent (**j); - switch (_time_domain) { + switch (time_domain()) { case AudioTime: ev->when += dx; break; @@ -2288,22 +2290,4 @@ ControlList::dump (ostream& o) } } -void -ControlList::set_time_domain (Temporal::TimeDomain td) -{ - assert (_events.empty ()); - _time_domain = td; - /* XXX: TODO: apply to all points */ -} - -void -ControlList::set_time_domain_empty (Temporal::TimeDomain td) -{ - /* the event list may or may not be empty, but we act as if it is. This - is used in e.g. ::set_state(), since we do not need to modify the - event time domains there. - */ - _time_domain = td; -} - } // namespace Evoral diff --git a/libs/evoral/evoral/ControlList.h b/libs/evoral/evoral/ControlList.h index 5a92f41e85..b7a208b334 100644 --- a/libs/evoral/evoral/ControlList.h +++ b/libs/evoral/evoral/ControlList.h @@ -34,6 +34,7 @@ #include "pbd/signals.h" +#include "temporal/domain_provider.h" #include "temporal/timeline.h" #include "temporal/types.h" #include "temporal/range.h" @@ -84,7 +85,7 @@ public: /** A list (sequence) of time-stamped values for a control */ -class LIBEVORAL_API ControlList +class LIBEVORAL_API ControlList : public Temporal::TimeDomainProvider { public: typedef std::list EventList; @@ -93,15 +94,12 @@ public: typedef EventList::const_iterator const_iterator; typedef EventList::const_reverse_iterator const_reverse_iterator; - ControlList (const Parameter& id, const ParameterDescriptor& desc, Temporal::TimeDomain); + ControlList (const Parameter& id, const ParameterDescriptor& desc, Temporal::TimeDomainProvider const &); ControlList (const ControlList&, Temporal::timepos_t const & start, Temporal::timepos_t const & end); ControlList (const ControlList&); virtual ~ControlList(); - Temporal::TimeDomain time_domain() const { return _time_domain; } - void set_time_domain (Temporal::TimeDomain td); - - virtual std::shared_ptr create(const Parameter& id, const ParameterDescriptor& desc, Temporal::TimeDomain); + virtual std::shared_ptr create(const Parameter& id, const ParameterDescriptor& desc, Temporal::TimeDomainProvider const &); void dump (std::ostream&); @@ -389,8 +387,6 @@ public: virtual void maybe_signal_changed (); - void set_time_domain_empty (Temporal::TimeDomain td); - void _x_scale (Temporal::ratio_t const &); mutable LookupCache _lookup_cache; @@ -405,7 +401,6 @@ public: int8_t _frozen; bool _changed_when_thawed; bool _sort_pending; - Temporal::TimeDomain _time_domain; Curve* _curve; diff --git a/libs/evoral/test/CurveTest.cc b/libs/evoral/test/CurveTest.cc index a759a6df10..9a2c366430 100644 --- a/libs/evoral/test/CurveTest.cc +++ b/libs/evoral/test/CurveTest.cc @@ -366,7 +366,7 @@ CurveTest::constrainedCubic () Evoral::ParameterDescriptor pd; pd.lower = 5; pd.upper = 325; - Evoral::ControlList l(p, pd, AudioTime); + Evoral::ControlList l(p, pd, Temporal::TimeDomainProvider (AudioTime)); size_t i; l.set_interpolation(Evoral::ControlList::Curved); diff --git a/libs/evoral/test/CurveTest.h b/libs/evoral/test/CurveTest.h index f42e6aaca0..7392b90d55 100644 --- a/libs/evoral/test/CurveTest.h +++ b/libs/evoral/test/CurveTest.h @@ -30,6 +30,6 @@ private: std::shared_ptr TestCtrlList() { Evoral::Parameter param (Evoral::Parameter(0)); const Evoral::ParameterDescriptor desc; - return std::shared_ptr (new Evoral::ControlList(param, desc, Temporal::AudioTime)); + return std::shared_ptr (new Evoral::ControlList(param, desc, Temporal::TimeDomainProvider (Temporal::AudioTime))); } }; diff --git a/libs/evoral/test/SequenceTest.h b/libs/evoral/test/SequenceTest.h index 7a262eeb84..279ec0ccc4 100644 --- a/libs/evoral/test/SequenceTest.h +++ b/libs/evoral/test/SequenceTest.h @@ -63,7 +63,7 @@ public: Evoral::ParameterDescriptor desc; desc.upper = 127; desc.rangesteps = 128; - std::shared_ptr list(new ControlList(param, desc, Temporal::BeatTime)); + std::shared_ptr list(new ControlList(param, desc, Temporal::TimeDomainProvider (Temporal::BeatTime))); return std::shared_ptr(new Control(param, desc, list)); } }; diff --git a/libs/temporal/temporal/domain_provider.h b/libs/temporal/temporal/domain_provider.h index 17c625184a..c4a107be68 100644 --- a/libs/temporal/temporal/domain_provider.h +++ b/libs/temporal/temporal/domain_provider.h @@ -19,26 +19,66 @@ #ifndef __temporal_domain_provider_h__ #define __temporal_domain_provider_h__ +#include "pbd/signals.h" #include "temporal/types.h" namespace Temporal { class TimeDomainProvider { public: - TimeDomainProvider () : have_domain (false), parent (nullptr) {} - TimeDomainProvider (TimeDomain td) : have_domain (true), domain (td), parent (nullptr) {} - TimeDomainProvider (TimeDomain td, TimeDomainProvider const & p) : have_domain (true), domain (td), parent (&p) {} - TimeDomainProvider (TimeDomainProvider const & p) : have_domain (false), parent (&p) {} + explicit TimeDomainProvider () : have_domain (false), parent (nullptr) {} + explicit TimeDomainProvider (TimeDomain td) : have_domain (true), domain (td), parent (nullptr) {} + TimeDomainProvider (TimeDomain td, TimeDomainProvider const & p) : have_domain (true), domain (td), parent (&p) { listen(); } + TimeDomainProvider (TimeDomainProvider const & other) : have_domain (other.have_domain), domain (other.domain), parent (other.parent) { listen(); } virtual ~TimeDomainProvider() {} + TimeDomainProvider& operator= (TimeDomainProvider const & other) { + if (this != &other) { + parent_connection.disconnect (); + have_domain = other.have_domain; + domain = other.domain; + parent = other.parent; + listen (); + } + return *this; + } + TimeDomain time_domain() const { if (have_domain) return domain; if (parent) return parent->time_domain(); return AudioTime; } - void set_time_domain (TimeDomain td) { have_domain = true; domain = td; } - void clear_time_domain () { have_domain = false; } + + void clear_time_domain () { have_domain = false; TimeDomainChanged(); /* EMIT SIGNAL */ } + void set_time_domain (TimeDomain td) { have_domain = true; domain = td; TimeDomainChanged(); /* EMIT SIGNAL */} + + bool has_parent() const { return (bool) parent; } + void clear_time_domain_parent () { parent = nullptr; TimeDomainChanged (); /* EMIT SIGNAL */ } + void set_time_domain_parent (TimeDomainProvider const & p) { + parent_connection.disconnect (); + TimeDomain old_domain = time_domain(); + parent = &p; + TimeDomain new_domain = time_domain (); + if (old_domain != new_domain) { + TimeDomainChanged (); + } + } + + mutable PBD::Signal0 TimeDomainChanged; + + virtual void time_domain_changed() { + /* Forward a time domain change to children */ + TimeDomainChanged(); + } + + protected: + void listen () { + if (parent) { + parent->TimeDomainChanged.connect_same_thread (parent_connection, boost::bind (&TimeDomainProvider::time_domain_changed, this)); + } + } private: bool have_domain; TimeDomain domain; TimeDomainProvider const * parent; + PBD::ScopedConnection parent_connection; }; }