summaryrefslogtreecommitdiff
path: root/sw/Core/Src/lfo.h
diff options
context:
space:
mode:
authorStijn Kuipers <stijnkuipers@gmail.com>2023-06-29 16:26:07 +0200
committerStijn Kuipers <stijnkuipers@gmail.com>2023-06-29 16:26:07 +0200
commitfb5a321dd7c2848128b04b306f3e1e59c87a3f70 (patch)
treea8ef6273f9f331ebb1971a9baf20a8c897955612 /sw/Core/Src/lfo.h
parentbae7568fd4dd0676b370be8548c7ec95d6521ba1 (diff)
downloadplinky-fb5a321dd7c2848128b04b306f3e1e59c87a3f70.tar.gz
Initial Filedump
Tadaaa!!
Diffstat (limited to 'sw/Core/Src/lfo.h')
-rwxr-xr-xsw/Core/Src/lfo.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/sw/Core/Src/lfo.h b/sw/Core/Src/lfo.h
new file mode 100755
index 0000000..74b4b12
--- /dev/null
+++ b/sw/Core/Src/lfo.h
@@ -0,0 +1,13 @@
+typedef struct lfo {
+ float r, i, a;
+} lfo;
+#define LFOINIT(f) {1.f,0.f,(f)+(f)}
+__STATIC_FORCEINLINE void lfo_setfreq(lfo *l, float f) {
+ l->a = f + f;
+}
+__STATIC_FORCEINLINE float lfo_next(lfo *l) {
+ l->r -= l->a * l->i;
+ l->i += l->a * l->r;
+ return l->r;
+}
+