stfu/Source/timer.c

21 lines
355 B
C
Raw Normal View History

2024-06-13 11:43:53 +00:00
#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;
}