summaryrefslogtreecommitdiff
path: root/mix.c
diff options
context:
space:
mode:
Diffstat (limited to 'mix.c')
-rw-r--r--mix.c22
1 files changed, 22 insertions, 0 deletions
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 <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;
+}
+