diff options
author | David Robillard <d@drobilla.net> | 2014-12-01 14:28:03 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2014-12-01 23:35:24 -0500 |
commit | 767c0238a34ef4acc4d345e88cd5ddb0c8a8e421 (patch) | |
tree | fed11fb6f4e4e08a7c35eb45f53aea70dc66e4f8 /libs/evoral/src/ControlList.cpp | |
parent | cb8abbe8d2f0e4dfe52bd35613ebba7689628eca (diff) |
Replace half-baked param metadata with descriptor.
Among other things, this means that automation controls/lists have the actual
min/max/normal/toggled of parameters, and not those inferred from the Parameter
ID, which is not correct for things like plugin parameters.
Pushing things down to the Evoral::ParmeterDescriptor may be useful in the
future to have lists do smarter things based on parameter range, but currently
I have just pushed down the above-mentioned currently used attributes.
Diffstat (limited to 'libs/evoral/src/ControlList.cpp')
-rw-r--r-- | libs/evoral/src/ControlList.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/libs/evoral/src/ControlList.cpp b/libs/evoral/src/ControlList.cpp index 0876cdef28..a4b98934c2 100644 --- a/libs/evoral/src/ControlList.cpp +++ b/libs/evoral/src/ControlList.cpp @@ -28,10 +28,14 @@ #endif #include <cassert> -#include <utility> +#include <cmath> #include <iostream> +#include <utility> + #include "evoral/ControlList.hpp" #include "evoral/Curve.hpp" +#include "evoral/ParameterDescriptor.hpp" +#include "evoral/TypeMap.hpp" #include "pbd/compose.h" #include "pbd/debug.h" @@ -46,16 +50,17 @@ inline bool event_time_less_than (ControlEvent* a, ControlEvent* b) return a->when < b->when; } -ControlList::ControlList (const Parameter& id) +ControlList::ControlList (const Parameter& id, const ParameterDescriptor& desc) : _parameter(id) - , _interpolation(id.toggled() ? Discrete : Linear) + , _desc(desc) , _curve(0) { + _interpolation = desc.toggled ? Discrete : Linear; _frozen = 0; _changed_when_thawed = false; - _min_yval = id.min(); - _max_yval = id.max(); - _default_value = id.normal(); + _min_yval = desc.lower; + _max_yval = desc.upper; + _default_value = desc.normal; _lookup_cache.left = -1; _lookup_cache.range.first = _events.end(); _lookup_cache.range.second = _events.end(); @@ -71,6 +76,7 @@ ControlList::ControlList (const Parameter& id) ControlList::ControlList (const ControlList& other) : _parameter(other._parameter) + , _desc(other._desc) , _interpolation(other._interpolation) , _curve(0) { @@ -96,6 +102,7 @@ ControlList::ControlList (const ControlList& other) ControlList::ControlList (const ControlList& other, double start, double end) : _parameter(other._parameter) + , _desc(other._desc) , _interpolation(other._interpolation) , _curve(0) { @@ -136,9 +143,9 @@ ControlList::~ControlList() } boost::shared_ptr<ControlList> -ControlList::create(Parameter id) +ControlList::create(const Parameter& id, const ParameterDescriptor& desc) { - return boost::shared_ptr<ControlList>(new ControlList(id)); + return boost::shared_ptr<ControlList>(new ControlList(id, desc)); } bool @@ -1503,7 +1510,7 @@ ControlList::rt_safe_earliest_event_linear_unlocked (double start, double& x, do boost::shared_ptr<ControlList> ControlList::cut_copy_clear (double start, double end, int op) { - boost::shared_ptr<ControlList> nal = create (_parameter); + boost::shared_ptr<ControlList> nal = create (_parameter, _desc); iterator s, e; ControlEvent cp (start, 0.0); |