Set default interpolation type (for new lanes)

This commit is contained in:
Robin Gareus
2017-06-19 16:47:02 +02:00
parent 16624f3139
commit 394bd8f428
2 changed files with 28 additions and 4 deletions

View File

@@ -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&);

View File

@@ -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)) {