Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/audio make recording precision/encoding setting sane.



details:   https://anonhg.NetBSD.org/src/rev/4df731e4bc44
branches:  trunk
changeset: 467714:4df731e4bc44
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sat Mar 27 17:46:00 1999 +0000

description:
make recording precision/encoding setting sane.

diffstat:

 usr.bin/audio/common/audio.c    |  39 +--------------------------------------
 usr.bin/audio/common/libaudio.h |   4 +---
 usr.bin/audio/record/record.c   |  24 ++++++++++--------------
 3 files changed, 12 insertions(+), 55 deletions(-)

diffs (111 lines):

diff -r 25cb4678a63c -r 4df731e4bc44 usr.bin/audio/common/audio.c
--- a/usr.bin/audio/common/audio.c      Sat Mar 27 17:36:30 1999 +0000
+++ b/usr.bin/audio/common/audio.c      Sat Mar 27 17:46:00 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.3 1999/03/27 05:14:37 mrg Exp $    */
+/*     $NetBSD: audio.c,v 1.4 1999/03/27 17:46:00 mrg Exp $    */
 
 /*
  * Copyright (c) 1999 Matthew R. Green
@@ -97,43 +97,6 @@
                return (-1);
 }
 
-int
-audio_parse_encoding(encoding_str, fd, encp, precp)
-       char    *encoding_str;
-       int     fd;
-       int     *encp;
-       int     *precp;
-{
-       int     i, prec = 0;
-       char    *colon, *star;
-
-       colon = strchr(encoding_str, ':');
-       if (colon) {
-               *colon++ = '\0';
-               if (*colon)
-                       prec = atoi(colon);
-       }
-       star = strrchr(encoding_str, '*');
-       if (star)
-               *star = '\0';
-       for (i = 0; ; i++) {
-               audio_encoding_t enc;
-
-               enc.index = i;
-               if (ioctl(fd, AUDIO_GETENC, &enc) < 0)
-                       break;
-
-               if (strcasecmp(enc.name, encoding_str) == 0 &&
-                  (prec == 0 || prec == enc.precision)) {
-                       *encp = enc.encoding;
-                       *precp = enc.precision;
-                       return (0);
-               }
-               
-       }
-       return (1);
-}
-
 /*
  * SunOS/NeXT .au format helpers
  */
diff -r 25cb4678a63c -r 4df731e4bc44 usr.bin/audio/common/libaudio.h
--- a/usr.bin/audio/common/libaudio.h   Sat Mar 27 17:36:30 1999 +0000
+++ b/usr.bin/audio/common/libaudio.h   Sat Mar 27 17:46:00 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: libaudio.h,v 1.2 1999/03/26 15:46:22 mrg Exp $ */
+/*     $NetBSD: libaudio.h,v 1.3 1999/03/27 17:46:00 mrg Exp $ */
 
 /*
  * Copyright (c) 1999 Matthew R. Green
@@ -142,8 +142,6 @@
 /* and something to get a string associated with this error */
 const char *audio_errstring __P((int));
 
-int    audio_parse_encoding __P((char *, int, int *, int *));
-
 /*
  * generic routines?
  */
diff -r 25cb4678a63c -r 4df731e4bc44 usr.bin/audio/record/record.c
--- a/usr.bin/audio/record/record.c     Sat Mar 27 17:36:30 1999 +0000
+++ b/usr.bin/audio/record/record.c     Sat Mar 27 17:46:00 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: record.c,v 1.2 1999/03/26 15:46:22 mrg Exp $   */
+/*     $NetBSD: record.c,v 1.3 1999/03/27 17:46:00 mrg Exp $   */
 
 /*
  * Copyright (c) 1999 Matthew R. Green
@@ -227,21 +227,17 @@
                info.record.channels = channels;
        else
                channels = oinfo.record.channels;
-#if 0
-       /* XXX ??? */
+
+       if (encoding_str) {
+               encoding = audio_enc_to_val(encoding_str);
+               if (encoding == -1)
+                       errx(1, "unknown encoding, bailing...");
+       }
+
        if (precision)
                info.record.precision = precision;
-       else
-               precision = oinfo.record.precision;
-#endif
-       if (encoding) {
-               if (audio_parse_encoding(encoding_str, ctlfd, &info.record.encoding, &info.record.precision))
-                       errx(1, "unknown encoding, bailing...");
-       } else {
-               encoding = oinfo.record.encoding;
-               precision = oinfo.record.precision;
-       }
-
+       if (encoding)
+               info.record.encoding = encoding;
        if (volume)
                info.record.gain = volume;
        if (port)



Home | Main Index | Thread Index | Old Index