home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.ee.lbl.gov
/
2014.05.ftp.ee.lbl.gov.tar
/
ftp.ee.lbl.gov
/
sst.tar.Z
/
sst.tar
/
sst
/
voxexit.c
< prev
Wrap
C/C++ Source or Header
|
1990-01-10
|
1KB
|
44 lines
/* voxexit.c - exit when sound is heard
**
** Copyright (C) 1989 by Jef Poskanzer.
**
** Permission to use, copy, modify, and distribute this software and its
** documentation for any purpose and without fee is hereby granted, provided
** that the above copyright notice appear in all copies and that both that
** copyright notice and this permission notice appear in supporting
** documentation. This software is provided "as is" without express or
** implied warranty.
*/
#include <stdio.h>
#include "libst.h"
#define abs(a) ((a) >= 0 ? (a) : -(a))
#define Q_DELTA 1000
#define MYBUFSIZ 256
main( argc, argv )
int argc;
char *argv[];
{
char mybuf[MYBUFSIZ];
int c, lc, plc, pplc;
if ( argc != 1 )
{
fprintf( stderr, "usage: %s\n", argv[0] );
exit( 1 );
}
setbuffer( stdout, mybuf, MYBUFSIZ );
for ( pplc = plc = 0; (c = getc( stdin )) != EOF; pplc = plc, plc = lc )
{
lc = st_ulaw_to_linear( c );
if ( abs( pplc - lc ) > Q_DELTA )
break;
}
exit( 0 );
}