home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!olivea!charnel!rat!ucselx!crash!yoda!ag
- From: ag@yoda.omnicron.com (Keith Gabryelski)
- Newsgroups: comp.unix.amiga
- Subject: Re: Working audio driver source.
- Message-ID: <1008@yoda.omnicron.com>
- Date: 24 Dec 92 17:45:58 GMT
- References: <1005@yoda.omnicron.com>
- Organization: Omnicron Data Systems
- Lines: 70
-
- Here is a new version of `au' ( replacing /usr/amiga/src/cmd/clksnd/au.c)
- that supports the repeat IOCTL and will send an beep to the audio device.
-
- Pax, Keith
-
- #include <sys/types.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <errno.h>
- #include "audio.h"
-
- static char wavedata[] =
- {
- 0, 45, 80, 127, 80, 45, 0, -45, -90, -127, -90, -45
- };
-
- static void usage(void);
-
- static char *progname;
-
- int
- main(int argc, char *argv[])
- {
- int c, error_flag=0;
- unsigned int tmp;
-
- progname = *argv;
-
- while((c = getopt(argc, argv, "?p:v:r:b")) != EOF)
- {
- switch(c)
- {
- case 'p':
- tmp = (unsigned int)strtoul(optarg, (char **)NULL, 0);
- (void) ioctl(1, AUDIO_PERIOD, &tmp);
- break;
-
- case 'v':
- tmp = (unsigned int)strtoul(optarg, (char **)NULL, 0);
- (void) ioctl(1, AUDIO_VOLUME, &tmp);
- break;
-
- case 'r':
- tmp = (unsigned int)strtoul(optarg, (char **)NULL, 0);
- (void) ioctl(1, AUDIO_REPEAT, &tmp);
- break;
-
- case 'b':
- (void) write(1, wavedata, sizeof wavedata);
- break;
-
- case '?':
- error_flag++;
- break;
- }
-
- if (error_flag)
- usage();
- }
-
- exit(0);
- }
-
- static void usage(void)
- {
- (void) fprintf(stderr,
- "usage: %s [-b] [-v VOLUME] [-p PERIOD] [-r REPEAT]\n",
- progname);
- exit(1);
- }
-