Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
curve.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2020, 2023 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
12#ifndef __AUDIO_CURVE_H__
13#define __AUDIO_CURVE_H__
14
15#include "utils/yaml.h"
16
17#include <glib/gi18n.h>
18
19#include "gtk_wrapper.h"
20
27#define CURVE_OPTIONS_SCHEMA_VERSION 1
28
30#define CURVE_SUPERELLIPSE_CURVINESS_BOUND 0.82
31#define CURVE_EXPONENT_CURVINESS_BOUND 0.95
32#define CURVE_VITAL_CURVINESS_BOUND 1.00
33
40{
49
61
72 VITAL,
73
77 PULSE,
78
93};
94
95const char **
96curve_algorithm_get_strings (void);
97
98const char *
99curve_algorithm_to_str (CurveAlgorithm algo);
100
104typedef struct CurveOptions
105{
106 int schema_version;
107
110
113 double curviness;
115
116typedef struct CurveFadePreset
117{
118 char * id;
119 char * label;
120 CurveOptions opts;
122
123NONNULL void
124curve_opts_init (CurveOptions * opts);
125
129RETURNS_NONNULL
130GPtrArray *
132
137void
139
140gboolean
141curve_algorithm_get_g_settings_mapping (
142 GValue * value,
143 GVariant * variant,
144 gpointer user_data);
145
146GVariant *
147curve_algorithm_set_g_settings_mapping (
148 const GValue * value,
149 const GVariantType * expected_type,
150 gpointer user_data);
151
159HOT NONNULL double
160curve_get_normalized_y (double x, CurveOptions * opts, int start_higher);
161
162bool
163curve_options_are_equal (const CurveOptions * a, const CurveOptions * b);
164
169#endif
void curve_algorithm_get_localized_name(CurveAlgorithm algo, char *buf)
Stores the localized name of the algorithm in buf.
CurveAlgorithm
The algorithm to use for curves.
Definition curve.h:40
HOT NONNULL double curve_get_normalized_y(double x, CurveOptions *opts, int start_higher)
Returns the Y value on a curve specified by algo.
RETURNS_NONNULL GPtrArray * curve_get_fade_presets(void)
Returns an array of CurveFadePreset.
@ EXPONENT
y = x^n 0 < n <= 1, where the whole thing is tilting up and 0 is full tilt and 1 is straight line (wh...
@ PULSE
Pulse (square).
@ VITAL
(e^(nx) - 1) / (e^n - 1) -10 <= n <= 10 where positive tilts down and negative tilts up (when startin...
@ LOGARITHMIC
a = log (n) b = 1 / (log (1 + (1 / n)))
@ 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 s...
Curve options.
Definition curve.h:105
double curviness
Curviness between -1 and 1, where < 0 tils downwards, > 0 tilts upwards and 0 is a straight line.
Definition curve.h:113
CurveAlgorithm algo
Curve algorithm to use.
Definition curve.h:109
YAML utils.