Debian Codegraph @

examples/example2.c

raw
1 #include <stdio.h>
2 #include "example2orc.h"
3
4 #define N 10
5
6 short a[N*2];
7 short b[N];
8 short c[N*2];
9
10 int
11 main (int argc, char *argv[])
12 {
13 int i;
14 double volume = 0.5;
15
16 /* Create some data in the source arrays */
17 for(i=0;i<N;i++){
18 a[2*i] = 10*i;
19 a[2*i+1] = 100*i;
20 b[i] = (i&1) ? 10000 : -10000;
21 }
22
23 /* Call a function that uses Orc */
24 audio_add_mono_to_stereo_scaled_s16 (c, a, b, (int) (volume*4096), N);
25
26 /* Print the results */
27 for(i=0;i<N;i++){
28 printf("%d: %d,%d %d -> %d,%d\n", i, a[2*i], a[2*i+1], b[i],
29 c[2*i], c[2*i+1]);
30 }
31
32 return 0;
33 }
34