source: trunk/src/dsound/genvol.c@ 3721

Last change on this file since 3721 was 3099, checked in by sandervl, 25 years ago

replaced dsound by new version

File size: 767 bytes
Line 
1
2/* A quick-n'-dirty DirectSound volume conversion table generator */
3
4#include <stdio.h>
5#include <math.h>
6
7void main (void)
8{
9 FILE *f;
10 int i, j;
11
12 if ((f = fopen("DSVolume.h", "w")) == NULL) {
13 printf("Can't open output file\n");
14 return;
15 }
16
17 fprintf(f, "\n// This is a generated file. Do not edit!\n");
18 fprintf(f, "\n// Volume conversion table for Odin DirectSound\n");
19 fprintf(f, "\nBYTE VolTable[1000] = {\n");
20
21 for (i = 0; i < 100; i++) {
22 fprintf(f, " ");
23 for (j = 0; j < 10; j++) {
24 fprintf(f, "%3d", (unsigned char)(255.0 * pow(4, -(i * 40.0 + j * 4) / 1000.0)));
25 if (i * j != 99 * 9)
26 fprintf(f, ", ");
27 }
28 fprintf(f, "\n");
29 }
30 fprintf(f, "\n};\n");
31
32 fclose(f);
33}
Note: See TracBrowser for help on using the repository browser.