Added input processing to state

This commit is contained in:
2026-04-27 14:16:28 +02:00
parent 787bf50957
commit a8c231df50
3 changed files with 45 additions and 36 deletions
+15 -1
View File
@@ -1,7 +1,9 @@
#pragma once
#include <stdint.h>
#include <stdbool.h>
#include <stdint.h>
#include <math.h>
#include "input.h"
#include "vco.h"
@@ -25,5 +27,17 @@ typedef struct {
bool amen_enabled;
} state_t;
static inline float map_linear(float v, float min, float max) {
return min + v * (max - min);
}
static inline float map_exponential(float v, float min, float max) {
return min + powf(max / min, v);
}
static inline float map_squared(float v, float min, float max) {
return min + (v * v) * (max - min);
}
void update_state(state_t* state, input_t* input);