Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/audio Retire -C, do all the ioctls on same audio dev...



details:   https://anonhg.NetBSD.org/src/rev/a8071d0441f1
branches:  trunk
changeset: 521654:a8071d0441f1
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sat Feb 02 20:20:23 2002 +0000

description:
Retire -C, do all the ioctls on same audio device we do i/o

diffstat:

 usr.bin/audio/play/audioplay.1     |   8 +-------
 usr.bin/audio/play/play.c          |  21 +++++++--------------
 usr.bin/audio/record/audiorecord.1 |   8 +-------
 usr.bin/audio/record/record.c      |  23 +++++++----------------
 4 files changed, 16 insertions(+), 44 deletions(-)

diffs (240 lines):

diff -r 73b95fa5da9a -r a8071d0441f1 usr.bin/audio/play/audioplay.1
--- a/usr.bin/audio/play/audioplay.1    Sat Feb 02 19:27:18 2002 +0000
+++ b/usr.bin/audio/play/audioplay.1    Sat Feb 02 20:20:23 2002 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: audioplay.1,v 1.15 2002/01/15 09:21:35 wiz Exp $
+.\"    $NetBSD: audioplay.1,v 1.16 2002/02/02 20:20:23 jdolecek Exp $
 .\"
 .\" Copyright (c) 1998-2002 Matthew R. Green
 .\" All rights reserved.
@@ -39,7 +39,6 @@
 .Op Fl b Ar balance
 .Op Fl p Ar port
 .Op Fl d Ar device
-.Op Fl C Ar ctl
 .Oo
 .Fl f
 .Op Fl c Ar channels
@@ -90,11 +89,6 @@
 .Ar device .
 The default is
 .Pa /dev/audio0 .
-.It Fl C
-Set the audio control device to be
-.Ar ctl .
-The default is
-.Pa /dev/audioctl0 .
 .It Fl f
 Force playing, even if the format is unknown.  The
 .Fl f
diff -r 73b95fa5da9a -r a8071d0441f1 usr.bin/audio/play/play.c
--- a/usr.bin/audio/play/play.c Sat Feb 02 19:27:18 2002 +0000
+++ b/usr.bin/audio/play/play.c Sat Feb 02 20:20:23 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: play.c,v 1.33 2002/01/31 00:33:10 augustss Exp $       */
+/*     $NetBSD: play.c,v 1.34 2002/02/02 20:20:24 jdolecek Exp $       */
 
 /*
  * Copyright (c) 1999 Matthew R. Green
@@ -68,7 +68,7 @@
 
 char   const *play_errstring = NULL;
 size_t bufsize;
-int    audiofd, ctlfd;
+int    audiofd;
 int    exitstatus = EXIT_SUCCESS;
 
 int
@@ -80,7 +80,6 @@
        int     ch;
        int     iflag = 0;
        const char *device = NULL;
-       const char *ctldev = NULL;
 
        while ((ch = getopt(argc, argv, "b:C:c:d:e:fhip:P:qs:Vv:")) != -1) {
                switch (ch) {
@@ -95,7 +94,7 @@
                                errx(1, "channels must be positive");
                        break;
                case 'C':
-                       ctldev = optarg;
+                       /* Ignore, compatibility */
                        break;
                case 'd':
                        device = optarg;
@@ -163,23 +162,17 @@
        if (device == NULL && (device = getenv("AUDIODEVICE")) == NULL &&
            (device = getenv("AUDIODEV")) == NULL) /* Sun compatibility */
                device = _PATH_SOUND;
-       if (ctldev == NULL && (ctldev = getenv("AUDIOCTLDEVICE")) == NULL)
-               ctldev = _PATH_AUDIOCTL;
 
        audiofd = open(device, O_WRONLY);
        if (audiofd < 0 && device == _PATH_SOUND) {
                device = _PATH_SOUND0;
-               ctldev = _PATH_AUDIOCTL0;
                audiofd = open(device, O_WRONLY);
        }
 
        if (audiofd < 0)
                err(1, "failed to open %s", device);
-       ctlfd = open(ctldev, O_RDWR);
-       if (ctlfd < 0)
-               err(1, "failed to open %s", ctldev);
 
-       if (ioctl(ctlfd, AUDIO_GETINFO, &info) < 0)
+       if (ioctl(audiofd, AUDIO_GETINFO, &info) < 0)
                err(1, "failed to get audio info");
        bufsize = info.play.buffer_size;
        if (bufsize < 32 * 1024)
@@ -206,7 +199,7 @@
 
        close(audiofd);
        (void)ioctl(audiofd, AUDIO_FLUSH, NULL);
-       (void)ioctl(ctlfd, AUDIO_SETINFO, &info);
+       (void)ioctl(audiofd, AUDIO_SETINFO, &info);
        exit(exitstatus);
 }
 
@@ -264,7 +257,7 @@
         * get the header length and set up the audio device
         */
        if ((hdrlen = audioctl_write_fromhdr(addr,
-           (size_t)filesize, ctlfd, &datasize)) < 0) {
+           (size_t)filesize, audiofd, &datasize)) < 0) {
                if (play_errstring)
                        errx(1, "%s: %s", play_errstring, file);
                else
@@ -320,7 +313,7 @@
                        return;
                err(1, "unexpected EOF");
        }
-       hdrlen = audioctl_write_fromhdr(buffer, nr, ctlfd, &datasize);
+       hdrlen = audioctl_write_fromhdr(buffer, nr, audiofd, &datasize);
        if (hdrlen < 0) {
                if (play_errstring)
                        errx(1, "%s: %s", play_errstring, file);
diff -r 73b95fa5da9a -r a8071d0441f1 usr.bin/audio/record/audiorecord.1
--- a/usr.bin/audio/record/audiorecord.1        Sat Feb 02 19:27:18 2002 +0000
+++ b/usr.bin/audio/record/audiorecord.1        Sat Feb 02 20:20:23 2002 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: audiorecord.1,v 1.22 2002/01/25 15:35:32 mrg Exp $
+.\"    $NetBSD: audiorecord.1,v 1.23 2002/02/02 20:20:25 jdolecek Exp $
 .\"
 .\" Copyright (c) 1998-1999 Matthew R. Green
 .\" All rights reserved.
@@ -36,7 +36,6 @@
 .Nm
 .Op Fl afhV
 .Op Fl b Ar balance
-.Op Fl C Ar ctl
 .Op Fl F Ar format
 .Op Fl c Ar channels
 .Op Fl d Ar device
@@ -69,11 +68,6 @@
 Set the balance to
 .Ar balance .
 This value must be between 0 and 63.
-.It Fl C
-Set the audio control device to be
-.Ar ctl .
-The default is
-.Pa /dev/audioctl0 .
 .It Fl F
 Set the output header format to
 .Ar format .
diff -r 73b95fa5da9a -r a8071d0441f1 usr.bin/audio/record/record.c
--- a/usr.bin/audio/record/record.c     Sat Feb 02 19:27:18 2002 +0000
+++ b/usr.bin/audio/record/record.c     Sat Feb 02 20:20:23 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: record.c,v 1.22 2002/01/31 00:03:24 augustss Exp $     */
+/*     $NetBSD: record.c,v 1.23 2002/02/02 20:20:26 jdolecek Exp $     */
 
 /*
  * Copyright (c) 1999 Matthew R. Green
@@ -53,11 +53,10 @@
 audio_info_t info, oinfo;
 ssize_t        total_size = -1;
 const char *device;
-const char *ctldev;
 int    format = AUDIO_FORMAT_SUN;
 char   *header_info;
 char   default_info[8] = { '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0' };
-int    audiofd, ctlfd, outfd;
+int    audiofd, outfd;
 int    qflag, aflag, fflag;
 int    verbose;
 int    monitor_gain, omonitor_gain;
@@ -103,7 +102,7 @@
                                errx(1, "balance must be between 0 and 63\n");
                        break;
                case 'C':
-                       ctldev = optarg;
+                       /* Ignore, compatibility */
                        break;
                case 'F':
                        format = audio_format_from_str(optarg);
@@ -189,26 +188,20 @@
        if (device == NULL && (device = getenv("AUDIODEVICE")) == NULL &&
            (device = getenv("AUDIODEV")) == NULL) /* Sun compatibility */
                device = _PATH_SOUND;
-       if (ctldev == NULL && (ctldev = getenv("AUDIOCTLDEVICE")) == NULL)
-               ctldev = _PATH_AUDIOCTL;
 
        audiofd = open(device, O_RDONLY);
        if (audiofd < 0 && device == _PATH_SOUND) {
                device = _PATH_SOUND0;
-               ctldev = _PATH_AUDIOCTL0;
                audiofd = open(device, O_WRONLY);
        }
        if (audiofd < 0)
                err(1, "failed to open %s", device);
-       ctlfd = open(ctldev, O_RDWR);
-       if (ctlfd < 0)
-               err(1, "failed to open %s", ctldev);
 
        /*
         * work out the buffer size to use, and allocate it.  also work out
         * what the old monitor gain value is, so that we can reset it later.
         */
-       if (ioctl(ctlfd, AUDIO_GETINFO, &oinfo) < 0)
+       if (ioctl(audiofd, AUDIO_GETINFO, &oinfo) < 0)
                err(1, "failed to get audio info");
        bufsize = oinfo.record.buffer_size;
        if (bufsize < 32 * 1024)
@@ -266,7 +259,7 @@
                monitor_gain = oinfo.monitor_gain;
 
        info.mode = AUMODE_RECORD;
-       if (ioctl(ctlfd, AUDIO_SETINFO, &info) < 0)
+       if (ioctl(audiofd, AUDIO_SETINFO, &info) < 0)
                err(1, "failed to reset audio info");
 
        signal(SIGINT, cleanup);
@@ -305,16 +298,15 @@
        int signo;
 {
 
-       close(audiofd);
        rewrite_header();
        close(outfd);
        if (omonitor_gain) {
                AUDIO_INITINFO(&info);
                info.monitor_gain = omonitor_gain;
-               if (ioctl(ctlfd, AUDIO_SETINFO, &info) < 0)
+               if (ioctl(audiofd, AUDIO_SETINFO, &info) < 0)
                        err(1, "failed to reset audio info");
        }
-       close(ctlfd);
+       close(audiofd);
        exit(0);
 }
 
@@ -655,7 +647,6 @@
        fprintf(stderr, "Usage: %s [-afhqV] [options] {files ...|-}\n",
            getprogname());
        fprintf(stderr, "Options:\n\t"
-           "-C audio control device\n\t"
            "-F format\n\t"
            "-b balance (0-63)\n\t"
            "-c channels\n\t"



Home | Main Index | Thread Index | Old Index