|
Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
|
Curve options. More...
#include <src/dsp/curve.h>
Public Types | |
| enum class | Algorithm { Exponent , SuperEllipse , Vital , Pulse , Logarithmic } |
| The algorithm to use for curves. More... | |
Public Member Functions | |
| CurveOptions (double curviness, Algorithm algo) | |
| double | get_normalized_y (double x, bool start_higher) const |
| Returns the Y value on a curve. | |
Data Fields | |
| double | curviness_ { 0.0 } |
| Curviness between -1 and 1, where < 0 tils downwards, > 0 tilts upwards and 0 is a straight line. | |
| Algorithm | algo_ {} |
| Curve algorithm to use. | |
Static Public Attributes | |
| static constexpr double | SUPERELLIPSE_CURVINESS_BOUND = 0.82 |
| Bounds for each algorithm. | |
| static constexpr double | EXPONENT_CURVINESS_BOUND = 0.95 |
| static constexpr double | VITAL_CURVINESS_BOUND = 1.00 |
Friends | |
| bool | operator== (const CurveOptions &a, const CurveOptions &b) |
|
strong |
The algorithm to use for curves.
See https://www.desmos.com/calculator/typjsyykvb
| Enumerator | |
|---|---|
| Exponent | y = x^n 0 < n <= 1, where the whole thing is tilting up and 0 is full tilt and 1 is straight line (when starting at lower point). |
| SuperEllipse | y = 1 - (1 - x^n)^(1/n) 0 < n <= 1, where the whole thing is tilting up and 0 is full tilt and 1 is straight line (when starting at lower point). See https://stackoverflow.com/questions/17623152/how-map-tween-a-number-based-on-a-dynamic-curve |
| Vital | (e^(nx) - 1) / (e^n - 1) -10 <= n <= 10 where positive tilts down and negative tilts up (when starting at lower point). See https://www.desmos.com/calculator/2dnuiptiqc. Taken from Vital synth. |
| Pulse | Pulse (square). |
| Logarithmic | a = log (n) b = 1 / (log (1 + (1 / n))) smaller numbers tilt upy1 = (log (x + n) - a) * b smaller numbers tilt downy2 = (a - log (x + n)) * b where 0 < n <= 10 See https://www.desmos.com/calculator/tdedahsdz8. Taken from Ardour. |
| double zrythm::dsp::CurveOptions::get_normalized_y | ( | double | x, |
| bool | start_higher ) const |
Returns the Y value on a curve.
| x | X-coordinate, normalized. |
| start_higher | Start at higher point. |
| Algorithm zrythm::dsp::CurveOptions::algo_ {} |
| double zrythm::dsp::CurveOptions::curviness_ { 0.0 } |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |