From 6c358a842baaf6d211a5c8c1717d815e7813ed96 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Sun, 11 Jul 2021 18:45:38 +0800 Subject: First commit Now I have a kind of piano like instrument. A violin-like instrument is being constructed. --- mix.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 mix.c (limited to 'mix.c') diff --git a/mix.c b/mix.c new file mode 100644 index 0000000..ae1c1ab --- /dev/null +++ b/mix.c @@ -0,0 +1,22 @@ +#include "mix.h" +#include +#include + +/* Mix different sounds together. For now this is just a simple + averaging function. But more sophostigated mixing techniques such + as filters and reverbs might get includede in the future. */ + +U_ATTR +Pulse +mix_sound(Wave w, LENT n) +{ + Pulse result = 0.0f;; + + for (LENT i = 0; i < n;) + result += *(w+i++); + + result /= (float) n; + + return result; +} + -- cgit v1.2.3-18-g5258