Maybe works?

This commit is contained in:
2026-04-30 09:32:14 +02:00
parent a8c231df50
commit bd2ac926b0
7 changed files with 126 additions and 133 deletions
+12 -7
View File
@@ -9,22 +9,22 @@
typedef struct {
float clock_bpm;
float vco_freq;
float vco_volume;
vco_mode_t vco_mode;
float filter_freq;
float filter_resonance;
float env1_attack;
float env1_release;
float env1_decay;
float env2_attack;
float env2_release;
float env2_decay;
float reverb_amount;
bool quant_enabled;
bool amen_enabled;
float beat_samples;
float playback_rate;
float clock_inc;
uint32_t amen_inc_fp;
} state_t;
static inline float map_linear(float v, float min, float max) {
@@ -32,12 +32,17 @@ static inline float map_linear(float v, float min, float max) {
}
static inline float map_exponential(float v, float min, float max) {
return min + powf(max / min, v);
if (min == 0.0f) min = 1e-6f;
return min * powf(max / min, v);
}
static inline float map_squared(float v, float min, float max) {
return min + (v * v) * (max - min);
}
static inline float max_constant(float _0, float val, float _1) {
return val;
}
void update_state(state_t* state, input_t* input);