summaryrefslogtreecommitdiff
path: root/libs/evoral/evoral
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-06-19 15:45:47 +0200
committerRobin Gareus <robin@gareus.org>2017-06-21 18:12:26 +0200
commitd6c47def098ebf6c44e1b3e0ca2166d1c990e7d3 (patch)
treec51eaf36673f55cdc07381f05445c22fb0488d7d /libs/evoral/evoral
parent36e32e564126e4587e3c2bee829c58876e65d285 (diff)
Implement additional ControlList interpolation methods.
The Control and ControlList uses the raw value (eg. coefficient for gain, Hz for frequencies) and those Lists are stored in existing sessions. In the vast majority of cases interpolating automation values using exp/log scale for dB, freq makes more sense -- it's also what the fader does. Adding additional interpolation methods is future proof (we might at allow to even add different methods per automation point (to the next) like other DAWs do. Currently it's mainly used in preparation for consistent GUI automation- lanes. Between 2 points there's always a visual straight line.
Diffstat (limited to 'libs/evoral/evoral')
-rw-r--r--libs/evoral/evoral/ControlList.hpp33
1 files changed, 22 insertions, 11 deletions
diff --git a/libs/evoral/evoral/ControlList.hpp b/libs/evoral/evoral/ControlList.hpp
index 99958d79fb..c4051193b8 100644
--- a/libs/evoral/evoral/ControlList.hpp
+++ b/libs/evoral/evoral/ControlList.hpp
@@ -275,7 +275,9 @@ public:
enum InterpolationStyle {
Discrete,
Linear,
- Curved
+ Curved, // spline, used for x-fades
+ Logarithmic,
+ Exponential // fader, gain
};
/** query interpolation style of the automation data
@@ -283,10 +285,18 @@ public:
*/
InterpolationStyle interpolation() const { return _interpolation; }
- /** set the interpolation style of the automation data
+ /** query default interpolation for parameter-descriptor */
+ virtual InterpolationStyle default_interpolation() const;
+
+ /** set the interpolation style of the automation data.
+ *
+ * This will fail when asking for Logarithmic scale and min,max crosses 0
+ * or Exponential scale with min != 0.
+ *
* @param is interpolation style
+ * @returns true if style change was successful
*/
- void set_interpolation (InterpolationStyle is);
+ bool set_interpolation (InterpolationStyle is);
virtual bool touching() const { return false; }
virtual bool writing() const { return false; }
@@ -339,14 +349,15 @@ protected:
Curve* _curve;
- private:
- iterator most_recent_insert_iterator;
- double insert_position;
- bool new_write_pass;
- bool did_write_during_pass;
- bool _in_write_pass;
- void unlocked_invalidate_insert_iterator ();
- void add_guard_point (double when);
+private:
+ iterator most_recent_insert_iterator;
+ double insert_position;
+ bool new_write_pass;
+ bool did_write_during_pass;
+ bool _in_write_pass;
+
+ void unlocked_invalidate_insert_iterator ();
+ void add_guard_point (double when);
};
} // namespace Evoral