revmain.c 1.1 KB
/***************************************************************
 *
 *	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);    
}