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

  1. /* tones.c - play sine-wave tones on the 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 <fcntl.h>
  15. #include "libsst.h"
  16.  
  17. main( argc, argv )
  18. int argc;
  19. char *argv[];
  20.     {
  21.     int sst_fd, dhz1, dhz2, thz, rhz;
  22.  
  23.     if ( argc < 2 || argc > 5 )
  24.     {
  25.     fprintf( stderr, "usage:  %s <dhz1> [<dhz2> [<thz> [<rhz>]]]\n", argv[0] );
  26.     exit( 1 );
  27.     }
  28.     dhz1 = atoi( argv[1] );
  29.     dhz2 = thz = rhz = 0;
  30.     if ( argc > 2 )
  31.     {
  32.     dhz2 = atoi( argv[2] );
  33.     if ( argc > 3 )
  34.         {
  35.         thz = atoi( argv[3] );
  36.         if ( argc > 4 )
  37.         {
  38.         rhz = atoi( argv[4] );
  39.         }
  40.         }
  41.     }
  42.  
  43.     sst_fd = sst_open( );
  44.  
  45.     sst_tones( sst_fd, dhz1, dhz2, thz, rhz, 1000000 );
  46.  
  47.     sst_close( sst_fd );
  48.     exit( 0 );
  49.     }
  50.