stfu/Source/timer.c
2024-06-13 16:43:53 +05:00

21 lines
355 B
C

#include <math.h>
#include "config.h"
struct stfu_timer {
float v, a;
} stfu_init_timer() {
struct stfu_timer r;
r.v = 0;
r.a = (1.0f / STFU_AUDIO_FRAME_RATE);
return r;
}
// todo: Pass period parameter?
struct stfu_timer stfu_pump_timer(struct stfu_timer wave) {
wave.v += wave.a;
if (wave.v > 1000)
wave.v -= 1000;
return wave;
}