diff options
author | JSDurand <mmemmew@gmail.com> | 2021-07-11 18:45:38 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2021-07-11 18:45:38 +0800 |
commit | 6c358a842baaf6d211a5c8c1717d815e7813ed96 (patch) | |
tree | c78122d49e75a540a4f6054b224a90738b554606 /mix.c |
First commit
Now I have a kind of piano like instrument. A violin-like instrument
is being constructed.
Diffstat (limited to 'mix.c')
-rw-r--r-- | mix.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -0,0 +1,22 @@ +#include "mix.h" +#include <stdio.h> +#include <stdlib.h> + +/* 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; +} + |