home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / amiga / 2607 < prev    next >
Encoding:
Text File  |  1992-12-24  |  1.6 KB  |  81 lines

  1. Path: sparky!uunet!spool.mu.edu!olivea!charnel!rat!ucselx!crash!yoda!ag
  2. From: ag@yoda.omnicron.com (Keith Gabryelski)
  3. Newsgroups: comp.unix.amiga
  4. Subject: Re: Working audio driver source.
  5. Message-ID: <1008@yoda.omnicron.com>
  6. Date: 24 Dec 92 17:45:58 GMT
  7. References: <1005@yoda.omnicron.com>
  8. Organization: Omnicron Data Systems
  9. Lines: 70
  10.  
  11. Here is a new version of `au' ( replacing /usr/amiga/src/cmd/clksnd/au.c)
  12. that supports the repeat IOCTL and will send an beep to the audio device.
  13.  
  14. Pax, Keith
  15.  
  16. #include <sys/types.h>
  17. #include <stdio.h>
  18. #include <stdlib.h>
  19. #include <errno.h>
  20. #include "audio.h"
  21.  
  22. static char wavedata[] =
  23. {
  24.     0, 45, 80, 127, 80, 45, 0, -45, -90, -127, -90, -45
  25. };
  26.  
  27. static void usage(void);
  28.  
  29. static char *progname;
  30.  
  31. int
  32. main(int argc, char *argv[])
  33. {
  34.     int c, error_flag=0;
  35.     unsigned int tmp;
  36.  
  37.     progname = *argv;
  38.  
  39.     while((c = getopt(argc, argv, "?p:v:r:b")) != EOF)
  40.     {
  41.     switch(c)
  42.     {
  43.     case 'p':
  44.         tmp = (unsigned int)strtoul(optarg, (char **)NULL, 0); 
  45.         (void) ioctl(1, AUDIO_PERIOD, &tmp);
  46.         break;
  47.         
  48.     case 'v':
  49.         tmp = (unsigned int)strtoul(optarg, (char **)NULL, 0); 
  50.         (void) ioctl(1, AUDIO_VOLUME, &tmp);
  51.         break;
  52.  
  53.     case 'r':
  54.         tmp = (unsigned int)strtoul(optarg, (char **)NULL, 0); 
  55.         (void) ioctl(1, AUDIO_REPEAT, &tmp);
  56.         break;
  57.  
  58.     case 'b':
  59.         (void) write(1, wavedata, sizeof wavedata);
  60.         break;
  61.  
  62.     case '?':
  63.         error_flag++;
  64.         break;
  65.     }
  66.  
  67.     if (error_flag)
  68.         usage();
  69.     }
  70.  
  71.     exit(0);
  72. }
  73.  
  74. static void usage(void)
  75. {
  76.     (void) fprintf(stderr,
  77.            "usage: %s [-b] [-v VOLUME] [-p PERIOD] [-r REPEAT]\n",
  78.            progname);
  79.     exit(1);
  80. }
  81.