playtest.c

来自「speech signal process tools」· C语言 代码 · 共 108 行

C
108
字号
/*   This material contains proprietary software of Entropic Processing, Inc.     Any reproduction, distribution, or publication without the the prior	     written permission of Entropic Processing, Inc. is strictly prohibited.  Any public distribution of copies of this work authorized in writing by  Entropic Processing, Inc. must bear the notice			 								               "Copyright 1986 Entropic Processing, Inc."*/#ifdef SCCSstatic char *sccs_id = "@(#)playtest.c	1.2 11/7/86 EPI";#endif#include <stdio.h>#include <sps/sps.h>char *strpbrk();void play();main (argc, argv)char  **argv;int     argc;{    FILE * in, *fopen ();    char    buf[256],            ans[256],	    buf1[256];    int     dorest = 0, item = 0;    if (argc != 2) {	fprintf (stderr, "usage: playtest file\n");	exit (1);    }    TRYOPEN (argv[0], argv[1], "r", in);    while (fgets (buf, 256, in) != NULL) {	item++;        strcpy(index(buf,'\n')," 2>/dev/null \n");	play(buf,item);	play(buf,item);	if (!dorest) {    sw: 	    printf ("Command? [<cr>,r,c,s,q,?] ");	    if (gets (ans) == NULL) {		fprintf (stderr, "playtest: you lose big.\n");		exit (1);	    }	    switch (ans[0]) {		case '\0': 	/* run next line */		    break;		case 'r': 	/* repeat */		    play(buf,item);		    goto sw;		case 'c': 		    dorest = 1;		    break;		case 'q': 		    printf ("bye\n");		    exit(0);		case 's':		    printf("Running sdcomp..\n");		    strcpy(buf1,"sdcomp ");		    strcat(buf1,strpbrk(buf," "));		    play(buf1,item);		    goto sw;		case '?':		    printf("return for next item\n");		    printf("c - continue without stopping\n");		    printf("s - run sdcomp on item\n");		    printf("q - quit\n");		    printf("? - this info\n");	   	    goto sw;		default: 		    printf ("Never heard of that command.\n");		    goto sw;	    }	}	else 	 printf("\n");    }}voidplay(s,item)char *s;int item;{   printf("playtest: Item: %d, ",item);   fflush(stdout);   if (system (s) != NULL) {	fprintf (stderr, "playtest: trouble running play command.\n");	fprintf (stderr, "playtest: %s\n", s);	exit (1);    }}#ifdef DEBUGsystem(s)char *s;{printf(s);}#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?