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 / listen.c < prev    next >
C/C++ Source or Header  |  1990-01-10  |  1KB  |  62 lines

  1. /* listen.c - hardware loopback, connect microphone to speaker
  2. **
  3. ** Copyright (C) 1989 by Jef Poskanzer.
  4. **
  5. ** Permission to use, copy, modify, and distribute this software and its
  6. ** documentation for any purpose and without fee is hereby granted, provided
  7. ** that the above copyright notice appear in all copies and that both that
  8. ** copyright notice and this permission notice appear in supporting
  9. ** documentation.  This software is provided "as is" without express or
  10. ** implied warranty.
  11. */
  12.  
  13. #include <stdio.h>
  14. #include <sys/signal.h>
  15. #include "libsst.h"
  16.  
  17. int sst_fd;
  18.  
  19. main( argc, argv )
  20. int argc;
  21. char *argv[];
  22.     {
  23.     struct audio_ioctl ai;
  24.     int junk;
  25.     int sighandler();
  26.  
  27.     sst_fd = sst_open( );
  28.     (void) signal( SIGHUP, sighandler );
  29.     (void) signal( SIGINT, sighandler );
  30.  
  31.     ai.control = AUDIO_MUX_MCR1;
  32.     if ( ioctl( sst_fd, AUDIOGETREG, &ai ) < 0 )
  33.     {
  34.     perror( "GETREG MCR1" );
  35.     exit( 1 );
  36.     }
  37.     ai.data[0] = ( AUDIO_MUX_PORT_BA << 4 ) | AUDIO_MUX_PORT_BA;
  38.     if ( ioctl( sst_fd, AUDIOSETREG, &ai ) < 0 )
  39.     {
  40.     perror( "SETREG MCR1" );
  41.     exit( 1 );
  42.     }
  43.  
  44.     if ( ioctl( sst_fd, AUDIOREADSTART, &junk ) < 0 )
  45.     {
  46.     perror( "AUDIOREADSTART" );
  47.     exit( 1 );
  48.     }
  49.  
  50.     for ( ; ; )
  51.     pause( );
  52.  
  53.     /* NOTREACHED */
  54.     }
  55.  
  56. int
  57. sighandler( )
  58.     {
  59.     sst_close( sst_fd );
  60.     exit( 1 );
  61.     }
  62.