diff --git a/control.h b/control.h new file mode 100644 index 0000000..846c033 --- /dev/null +++ b/control.h @@ -0,0 +1,16 @@ + +struct control_t +{ + float value; + float step; +}; + +static inline void control_setstep(struct control_t *control, float value, uint32_t samples) +{ + control->step = (value - control->value) / samples; +} + +static inline void control_tick(struct control_t *control) +{ + control->value += control->step; +}