summaryrefslogtreecommitdiff
path: root/mix.c
blob: ae1c1abd9a36f25eb428b79b7afdaee5fd19d054 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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;
}