From 394bd8f4281b16b1608b36dca28c3ef66e14d90b Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 19 Jun 2017 16:47:02 +0200 Subject: Set default interpolation type (for new lanes) --- libs/ardour/ardour/automation_list.h | 7 +++++-- libs/ardour/automation_list.cc | 25 +++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) (limited to 'libs') diff --git a/libs/ardour/ardour/automation_list.h b/libs/ardour/ardour/automation_list.h index 34f0a99eb1..9810275ed1 100644 --- a/libs/ardour/ardour/automation_list.h +++ b/libs/ardour/ardour/automation_list.h @@ -68,7 +68,7 @@ private: */ class LIBARDOUR_API AutomationList : public Evoral::ControlList, public PBD::StatefulDestructible { - public: +public: AutomationList (const Evoral::Parameter& id, const Evoral::ParameterDescriptor& desc); AutomationList (const Evoral::Parameter& id); AutomationList (const XMLNode&, Evoral::Parameter id); @@ -119,7 +119,10 @@ class LIBARDOUR_API AutomationList : public Evoral::ControlList, public PBD::Sta XMLNode* before () { XMLNode* rv = _before; _before = 0; return rv; } void clear_history (); - private: + + ControlList::InterpolationStyle default_interpolation () const; + +private: void create_curve_if_necessary (); int deserialize_events (const XMLNode&); diff --git a/libs/ardour/automation_list.cc b/libs/ardour/automation_list.cc index f456ac210b..ae78a217f7 100644 --- a/libs/ardour/automation_list.cc +++ b/libs/ardour/automation_list.cc @@ -60,6 +60,7 @@ AutomationList::AutomationList (const Evoral::Parameter& id, const Evoral::Param { _state = Off; g_atomic_int_set (&_touching, 0); + _interpolation = default_interpolation (); create_curve_if_necessary(); @@ -73,6 +74,7 @@ AutomationList::AutomationList (const Evoral::Parameter& id) { _state = Off; g_atomic_int_set (&_touching, 0); + _interpolation = default_interpolation (); create_curve_if_necessary(); @@ -115,6 +117,7 @@ AutomationList::AutomationList (const XMLNode& node, Evoral::Parameter id) , _before (0) { g_atomic_int_set (&_touching, 0); + _interpolation = default_interpolation (); _state = Off; set_state (node, Stateful::loading_state_version); @@ -165,7 +168,6 @@ AutomationList::operator= (const AutomationList& other) { if (this != &other) { - ControlList::operator= (other); _state = other._state; _touching = other._touching; @@ -202,6 +204,25 @@ AutomationList::set_automation_state (AutoState s) } } +Evoral::ControlList::InterpolationStyle +AutomationList::default_interpolation () const +{ + switch (_parameter.type()) { + case GainAutomation: + case BusSendLevel: + case EnvelopeAutomation: + return ControlList::Exponential; + break; + case TrimAutomation: + return ControlList::Logarithmic; + break; + default: + break; + } + /* based on Evoral::ParameterDescriptor log,toggle,.. */ + return ControlList::default_interpolation (); +} + void AutomationList::start_write_pass (double when) { @@ -489,7 +510,7 @@ AutomationList::set_state (const XMLNode& node, int version) } if (!node.get_property (X_("interpolation-style"), _interpolation)) { - _interpolation = Linear; + _interpolation = default_interpolation (); } if (node.get_property (X_("state"), _state)) { -- cgit v1.2.3