On Tue, 26 Mar 2013 07:28:20 +0100, Ted Unangst wrote:
> As much as it pains me to submit a diff that contains + in the compat
> directory, this is still mostly -. Calling our mixer devices NetBSD
> devices doesn't make a whole lot of sense. Also kill some other dead
> code.

The below diff reflects your changes to src/lib/libossaudio.

> The comment still doesn't make a lot of sense to me. The comment says
> only 32 devices are available, but OSS_SOUND_MIXER_NRDEVICES is
> defined to be 17. I leave the thinking to somebody else.

> -/* If the NetBSD mixer device should have more than 32 devices
> +/* If the mixer device should have more than 32 devices
>   * some will not be available to Linux */
> -#define NETBSD_MAXDEVS 64
> +#define MAX_MIXER_DEVS 64

Based on the comment in the below diff, I think that NETBSD_MAXDEVS used
to be set to 32. Then someone increased it to 64, but forgot to update
the comment. In that case, the "32" in the above comment should be
changed to "MAX_MIXER_DEVS". But perhaps I shouldn't be doing the
thinking either.

Index: ossaudio.c
===================================================================
RCS file: /cvs/src/lib/libossaudio/ossaudio.c,v
retrieving revision 1.16
diff -p -u -r1.16 ossaudio.c
--- ossaudio.c  26 Jun 2008 05:42:05 -0000      1.16
+++ ossaudio.c  27 Mar 2013 18:52:40 -0000
@@ -456,17 +456,17 @@ audio_ioctl(int fd, unsigned long com, v
 }
 
 
-/* If the NetBSD mixer device should have more than NETBSD_MAXDEVS devices
+/* If the mixer device should have more than MAX_MIXER_DEVS devices
  * some will not be available to Linux */
-#define NETBSD_MAXDEVS 64
+#define MAX_MIXER_DEVS 64
 struct audiodevinfo {
        int done;
        dev_t dev;
        ino_t ino;
        int16_t devmap[SOUND_MIXER_NRDEVICES],
-               rdevmap[NETBSD_MAXDEVS];
-       char names[NETBSD_MAXDEVS][MAX_AUDIO_DEV_LEN];
-       int enum2opaque[NETBSD_MAXDEVS];
+               rdevmap[MAX_MIXER_DEVS];
+       char names[MAX_MIXER_DEVS][MAX_AUDIO_DEV_LEN];
+       int enum2opaque[MAX_MIXER_DEVS];
         u_long devmask, recmask, stereomask;
        u_long caps, recsource;
 };
@@ -476,7 +476,7 @@ opaque_to_enum(struct audiodevinfo *di, 
 {
        int i, o;
 
-       for (i = 0; i < NETBSD_MAXDEVS; i++) {
+       for (i = 0; i < MAX_MIXER_DEVS; i++) {
                o = di->enum2opaque[i];
                if (o == opq)
                        break;
@@ -486,7 +486,7 @@ opaque_to_enum(struct audiodevinfo *di, 
                        break;
                }
        }
-       if (i >= NETBSD_MAXDEVS)
+       if (i >= MAX_MIXER_DEVS)
                i = -1;
        /*printf("opq_to_enum %s %d -> %d\n", label->name, opq, i);*/
        return (i);
@@ -495,7 +495,7 @@ opaque_to_enum(struct audiodevinfo *di, 
 static int
 enum_to_ord(struct audiodevinfo *di, int enm)
 {
-       if (enm >= NETBSD_MAXDEVS)
+       if (enm >= MAX_MIXER_DEVS)
                return (-1);
 
        /*printf("enum_to_ord %d -> %d\n", enm, di->enum2opaque[enm]);*/
@@ -506,7 +506,7 @@ static int
 enum_to_mask(struct audiodevinfo *di, int enm)
 {
        int m;
-       if (enm >= NETBSD_MAXDEVS)
+       if (enm >= MAX_MIXER_DEVS)
                return (0);
 
        m = di->enum2opaque[enm];
@@ -541,16 +541,10 @@ getdevinfo(int fd)
                { AudioNtreble,         SOUND_MIXER_TREBLE },
                { AudioNbass,           SOUND_MIXER_BASS },
                { AudioNspeaker,        SOUND_MIXER_SPEAKER },
-/*             { AudioNheadphone,      ?? },*/
                { AudioNoutput,         SOUND_MIXER_OGAIN },
                { AudioNinput,          SOUND_MIXER_IGAIN },
-/*             { AudioNmaster,         SOUND_MIXER_SPEAKER },*/
-/*             { AudioNstereo,         ?? },*/
-/*             { AudioNmono,           ?? },*/
                { AudioNfmsynth,        SOUND_MIXER_SYNTH },
-/*             { AudioNwave,           SOUND_MIXER_PCM },*/
                { AudioNmidi,           SOUND_MIXER_SYNTH },
-/*             { AudioNmixerout,       ?? },*/
                { 0, -1 }
        };
        static struct audiodevinfo devcache = { 0 };
@@ -575,12 +569,12 @@ getdevinfo(int fd)
        di->caps = 0;
        for(i = 0; i < SOUND_MIXER_NRDEVICES; i++)
                di->devmap[i] = -1;
-       for(i = 0; i < NETBSD_MAXDEVS; i++) {
+       for(i = 0; i < MAX_MIXER_DEVS; i++) {
                di->rdevmap[i] = -1;
                di->names[i][0] = '\0';
                di->enum2opaque[i] = -1;
        }
-       for(i = 0; i < NETBSD_MAXDEVS; i++) {
+       for(i = 0; i < MAX_MIXER_DEVS; i++) {
                mi.index = i;
                if (ioctl(fd, AUDIO_MIXER_DEVINFO, &mi) < 0)
                        break;
@@ -601,7 +595,7 @@ getdevinfo(int fd)
                        break;
                }
        }
-       for(i = 0; i < NETBSD_MAXDEVS; i++) {
+       for(i = 0; i < MAX_MIXER_DEVS; i++) {
                mi.index = i;
                if (ioctl(fd, AUDIO_MIXER_DEVINFO, &mi) < 0)
                        break;
Index: soundcard.h
===================================================================
RCS file: /cvs/src/lib/libossaudio/soundcard.h,v
retrieving revision 1.13
diff -p -u -r1.13 soundcard.h
--- soundcard.h 26 Jun 2008 05:42:05 -0000      1.13
+++ soundcard.h 27 Mar 2013 18:52:40 -0000
@@ -33,7 +33,7 @@
 /*
  * WARNING!  WARNING!
  * This is an OSS (Linux) audio emulator.
- * Use the Native NetBSD API for developing new code, and this
+ * Use the sndio(7) API for developing new code, and this
  * only for compiling Linux programs.
  */
 

Reply via email to