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

  for (LENT i = 0; i < n;)
    result += *(w+i++);

  result /= (NUMT) n;

  return result;
}