revmain.c
1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/***************************************************************
*
* revmain.c
* the generic reverb console interface
*
* 12/15/94 bfs initial version
*
*/
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
void
usage(char *pname){
printf("USAGE: %s -w<wet> -d<dry> < inname > outname\n", pname);
exit(1);
}
main(int argc, char **argv)
{
int c;
extern char *optarg;
float wet=0, dry=0;
int errflg = 0, stereo = 0;
while (( c = getopt(argc, argv, "w:d:sh")) != EOF)
switch(c) {
case 'w':
wet = (float) atof((char *)optarg);
if (wet < 0.0) wet = 0.0;
if (wet > 1.0) wet = 1.0;
break;
case 'd':
dry = (float) atof((char *)optarg);
if (dry < 0.0) wet = 0.0;
if (dry > 1.0) wet = 1.0;
break;
case 's':
stereo = 1;
break;
case 'h':
usage(argv[0]);
break;
case '?':
errflg++;
}
if (errflg) usage(argv[0]);
(void)fprintf(stderr, "wet amount = %f\n", wet);
(void)fprintf(stderr, "dry amount = %f\n", dry);
do_reverb(stdin, stdout, &wet, &dry, stereo);
exit(0);
}