summaryrefslogtreecommitdiff
path: root/libs/evoral/src
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-06-21 13:40:41 +0200
committerRobin Gareus <robin@gareus.org>2017-06-21 18:12:23 +0200
commit36e32e564126e4587e3c2bee829c58876e65d285 (patch)
treecd86f80407311da8b32f5fb68d1c2cce4f162e19 /libs/evoral/src
parentcb48bb0e1ccdd8a8324e53e716b2058c2ef3c297 (diff)
Remove separate ControlList min/max/default, use ParameterDescriptor.
Diffstat (limited to 'libs/evoral/src')
-rw-r--r--libs/evoral/src/Control.cpp2
-rw-r--r--libs/evoral/src/ControlList.cpp37
-rw-r--r--libs/evoral/src/Curve.cpp2
3 files changed, 14 insertions, 27 deletions
diff --git a/libs/evoral/src/Control.cpp b/libs/evoral/src/Control.cpp
index 56f5f70f2c..8d53d3f276 100644
--- a/libs/evoral/src/Control.cpp
+++ b/libs/evoral/src/Control.cpp
@@ -29,7 +29,7 @@ Control::Control(const Parameter& parameter,
const ParameterDescriptor& desc,
boost::shared_ptr<ControlList> list)
: _parameter(parameter)
- , _user_value(list ? list->default_value() : desc.normal)
+ , _user_value(desc.normal)
{
set_list (list);
}
diff --git a/libs/evoral/src/ControlList.cpp b/libs/evoral/src/ControlList.cpp
index 0ec9cad814..3a3737004b 100644
--- a/libs/evoral/src/ControlList.cpp
+++ b/libs/evoral/src/ControlList.cpp
@@ -59,9 +59,6 @@ ControlList::ControlList (const Parameter& id, const ParameterDescriptor& desc)
_interpolation = desc.toggled ? Discrete : Linear;
_frozen = 0;
_changed_when_thawed = false;
- _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();
@@ -83,9 +80,6 @@ ControlList::ControlList (const ControlList& other)
{
_frozen = 0;
_changed_when_thawed = false;
- _min_yval = other._min_yval;
- _max_yval = other._max_yval;
- _default_value = other._default_value;
_lookup_cache.range.first = _events.end();
_lookup_cache.range.second = _events.end();
_search_cache.first = _events.end();
@@ -109,9 +103,6 @@ ControlList::ControlList (const ControlList& other, double start, double end)
{
_frozen = 0;
_changed_when_thawed = false;
- _min_yval = other._min_yval;
- _max_yval = other._max_yval;
- _default_value = other._default_value;
_lookup_cache.range.first = _events.end();
_lookup_cache.range.second = _events.end();
_search_cache.first = _events.end();
@@ -161,12 +152,8 @@ ControlList::operator= (const ControlList& other)
{
if (this != &other) {
- _min_yval = other._min_yval;
- _max_yval = other._max_yval;
-
_interpolation = other._interpolation;
- _default_value = other._default_value;
copy_events (other);
}
@@ -553,8 +540,8 @@ ControlList::editor_add (double when, double value, bool with_guard)
/* clamp new value to allowed range */
- value = max (_min_yval, value);
- value = min (_max_yval, value);
+ value = max ((double)_desc.lower, value);
+ value = min ((double)_desc.upper, value);
iterator result;
DEBUG_TRACE (DEBUG::ControlList, string_compose ("editor_add: actually add when= %1 value= %2\n", when, value));
@@ -663,7 +650,7 @@ ControlList::add (double when, double value, bool with_guards, bool with_initial
} else {
_events.insert (_events.end(), new ControlEvent (0, value));
- DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 added default value %2 at zero\n", this, _default_value));
+ DEBUG_TRACE (DEBUG::ControlList, string_compose ("@%1 added default value %2 at zero\n", this, _desc.normal));
}
}
}
@@ -1085,8 +1072,8 @@ ControlList::truncate_end (double last_coordinate)
/* shortening end */
last_val = unlocked_eval (last_coordinate);
- last_val = max ((double) _min_yval, last_val);
- last_val = min ((double) _max_yval, last_val);
+ last_val = max ((double) _desc.lower, last_val);
+ last_val = min ((double) _desc.upper, last_val);
i = _events.rbegin();
@@ -1187,8 +1174,8 @@ ControlList::truncate_start (double overall_length)
first_legal_coordinate = _events.back()->when - overall_length;
first_legal_value = unlocked_eval (first_legal_coordinate);
- first_legal_value = max (_min_yval, first_legal_value);
- first_legal_value = min (_max_yval, first_legal_value);
+ first_legal_value = max ((double)_desc.lower, first_legal_value);
+ first_legal_value = min ((double)_desc.upper, first_legal_value);
/* remove all events earlier than the new "front" */
@@ -1248,7 +1235,7 @@ ControlList::unlocked_eval (double x) const
switch (npoints) {
case 0:
- return _default_value;
+ return _desc.normal;
case 1:
return _events.front()->value;
@@ -1284,7 +1271,7 @@ ControlList::unlocked_eval (double x) const
}
abort(); /*NOTREACHED*/ /* stupid gcc */
- return _default_value;
+ return _desc.normal;
}
double
@@ -1869,9 +1856,9 @@ ControlList::operator!= (ControlList const & other) const
return (
_parameter != other._parameter ||
_interpolation != other._interpolation ||
- _min_yval != other._min_yval ||
- _max_yval != other._max_yval ||
- _default_value != other._default_value
+ _desc.lower != other._desc.lower ||
+ _desc.upper != other._desc.upper ||
+ _desc.normal != other._desc.normal
);
}
diff --git a/libs/evoral/src/Curve.cpp b/libs/evoral/src/Curve.cpp
index 83fd0756bd..07dd158079 100644
--- a/libs/evoral/src/Curve.cpp
+++ b/libs/evoral/src/Curve.cpp
@@ -203,7 +203,7 @@ Curve::_get_vector (double x0, double x1, float *vec, int32_t veclen) const
if ((npoints = _list.events().size()) == 0) {
/* no events in list, so just fill the entire array with the default value */
for (int32_t i = 0; i < veclen; ++i) {
- vec[i] = _list.default_value();
+ vec[i] = _list.descriptor().normal;
}
return;
}