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

Last change on this file since 6502 was 3925, checked in by bird, 25 years ago

Added the CVS keyword Id.

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