diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-01-23 22:21:29 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-04-04 23:09:12 +0200 |
| commit | 0e164ad80f0ceff9d643f3b466690d013c3be19d (patch) | |
| tree | c656a136c12ff3c5d9bf8f7331610162de0c0592 /src/lib/maths_util.h | |
| parent | 8eb951b71fa90e54c8da64e54cf5ddf6bf0809cf (diff) | |
Add fade in/out option to the content audio tab (#1026).
Diffstat (limited to 'src/lib/maths_util.h')
| -rw-r--r-- | src/lib/maths_util.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lib/maths_util.h b/src/lib/maths_util.h index 8adefbbc4..24c4b547f 100644 --- a/src/lib/maths_util.h +++ b/src/lib/maths_util.h @@ -30,6 +30,21 @@ extern double db_to_linear (double db); extern double linear_to_db (double linear); +/** @return linear gain according to a logarithmic curve, for fading in. + * t < 0: linear gain of 0 + * 0 >= t >= 1: logarithmic fade in curve + * t > 1: linear gain of 1 + */ +extern float logarithmic_fade_in_curve (float t); + + +/** @return linear gain according to a logarithmic curve, for fading out. + * t > 1: linear gain of 0 + * 0 >= t >= 1: logarithmic fade out curve + * t < 0: linear gain of 1 + */ +extern float logarithmic_fade_out_curve (float t); + template <class T> T clamp (T val, T minimum, T maximum) |
