From weigelt at metux.de  Tue Aug  1 07:05:51 2006
From: weigelt at metux.de (Enrico Weigelt)
Date: Tue, 1 Aug 2006 15:05:51 +0200
Subject: [nas] standalone nas client library
In-Reply-To: <Pine.LNX.4.61.0607281821020.30956@m5.radscan.com>
References: <20060728141643.GA15638@nibiru.local> <Pine.LNX.4.61.0607281821020.30956@m5.radscan.com>
Message-ID: <20060801130551.GB9364@nibiru.local>

* Jon Trulson <jon at radscan.com> wrote:

<snip>

> >I'm looking for an standalone nas client library with minimal
> >dependencies and .pc file. All I could find was the big monolithic
> >nas package. Is anyone already working on an standalone libnas ?
> 
> No, there's never been any need or desire to do so... Why not
> just bult it, then take the libaudio lib and go from there?

I need an package contiaining only the nas client library,
wich builds completely by its own with minimal dependencies
and supplies an proper .pc file.


cu
-- 
---------------------------------------------------------------------
 Enrico Weigelt    ==   metux IT service

  phone:     +49 36207 519931         www:       http://www.metux.de/
  fax:       +49 36207 519932         email:     contact at metux.de
  cellphone: +49 174 7066481
---------------------------------------------------------------------


From pgf at foxharp.boston.ma.us  Tue Aug  1 07:13:56 2006
From: pgf at foxharp.boston.ma.us (Paul Fox)
Date: Tue, 01 Aug 2006 09:13:56 -0400
Subject: [nas] standalone nas client library 
In-Reply-To: <20060801130551.GB9364@nibiru.local> 
References: <20060728141643.GA15638@nibiru.local> <Pine.LNX.4.61.0607281821020.30956@m5.radscan.com> <20060801130551.GB9364@nibiru.local>
Message-ID: <22196.1154438036@foxharp.boston.ma.us>

enrico wrote:
 > * Jon Trulson <jon at radscan.com> wrote:
 > 
 > <snip>
 > 
 > > >I'm looking for an standalone nas client library with minimal
 > > >dependencies and .pc file. All I could find was the big monolithic
 > > >nas package. Is anyone already working on an standalone libnas ?
 > > 
 > > No, there's never been any need or desire to do so... Why not
 > > just bult it, then take the libaudio lib and go from there?
 > 
 > I need an package contiaining only the nas client library,
 > wich builds completely by its own with minimal dependencies
 > and supplies an proper .pc file.

"a proper .pc" file should be easy enough to create.  why do you
need a build package that builds only the library?

paul
=---------------------
 paul fox, pgf at foxharp.boston.ma.us (arlington, ma, where it's 73.0 degrees)


From pooly7 at gmail.com  Tue Aug  8 04:49:31 2006
From: pooly7 at gmail.com (Pooly)
Date: Tue, 8 Aug 2006 11:49:31 +0100
Subject: [nas] Re: Can play file with AuSoundPlayFromFile
In-Reply-To: <20060729015342.GA19336@sushi.unix-ag.uni-kl.de>
References: <8db58d6b0607280657r3a578a43g2627d2a2e0d2290a@mail.gmail.com>
	 <8db58d6b0607280809x78354aa9md38524980a6245ba@mail.gmail.com>
	 <20060729015342.GA19336@sushi.unix-ag.uni-kl.de>
Message-ID: <8db58d6b0608080349g26deb65bncf56bddac950e2fb@mail.gmail.com>

2006/7/29, Erik Auerswald <auerswal at unix-ag.uni-kl.de>:
> Hi,
>
> On Fri, Jul 28, 2006 at 04:09:37PM +0100, Pooly wrote:
> > 2006/7/28, Pooly <pooly7 at gmail.com>:
> > >        if ( nas ) {
> > >               AuFixedPoint volume, AuFixedPointFromFraction(100,100);
>                                       =
>
> > >               if ( AuSoundPlayFromFile( nas, soundName, AuNone, volume,
> > >                              NULL, NULL, NULL, NULL, NULL, NULL ) == NULL
> > >                              )
> > >                   fprintf(stderr, "Can't play audio.\n");
> > >              AuFlush(nas);
> > >      }
> >
> > I managed to get a sound by doing :
> >        if ( nas ) {
> >                AuStatus ret;
> >                AuEvent ev;
> >                AuFixedPoint volume, AuFixedPointFromFraction(100,100);
> >               //sync_play_cb is a dummy callback and does not do anything
> >                if ( AuSoundPlayFromFile( nas, soundName, AuNone, volume,
> >                               sync_play_cb, NULL, &autoflowid, NULL,
> > NULL, &ret) == NULL )
> >                    fprintf(stderr, "Can't play audio.\n");
> >
> >               AuNextEvent(nas, AuTrue, &ev);
> >              AuDispatchEvent(nas, &ev);
> >       }
> >
> > Is it the correct way to play a file asynchronously ? I don't want to
> > have AuNextEvent waiting for an incoming event.
>
> Take a look at nas/clients/audio/examples/playSimul.c to see how to wait
> on events only when playing.

Does this ensure that the playing is done asynchronously so that I can
use that method in a near real-time app ?

-- 
http://www.w-fenec.org/


From auerswal at unix-ag.uni-kl.de  Tue Aug  8 05:05:49 2006
From: auerswal at unix-ag.uni-kl.de (Erik Auerswald)
Date: Tue, 8 Aug 2006 13:05:49 +0200
Subject: [nas] Re: Can play file with AuSoundPlayFromFile
In-Reply-To: <8db58d6b0608080349g26deb65bncf56bddac950e2fb@mail.gmail.com>
References: <8db58d6b0607280657r3a578a43g2627d2a2e0d2290a@mail.gmail.com> <8db58d6b0607280809x78354aa9md38524980a6245ba@mail.gmail.com> <20060729015342.GA19336@sushi.unix-ag.uni-kl.de> <8db58d6b0608080349g26deb65bncf56bddac950e2fb@mail.gmail.com>
Message-ID: <20060808110549.GA511@sushi.unix-ag.uni-kl.de>

Hi,

On Tue, Aug 08, 2006 at 11:49:31AM +0100, Pooly wrote:
> 2006/7/29, Erik Auerswald <auerswal at unix-ag.uni-kl.de>:
> >On Fri, Jul 28, 2006 at 04:09:37PM +0100, Pooly wrote:
> >>
> >> Is it the correct way to play a file asynchronously ? I don't want to
> >> have AuNextEvent waiting for an incoming event.
> >
> >Take a look at nas/clients/audio/examples/playSimul.c to see how to wait
> >on events only when playing.
> 
> Does this ensure that the playing is done asynchronously so that I can
> use that method in a near real-time app ?

Yes, this is asynchronous playing. To play synchronously you have to use
AuSoundPlaySynchronousFromFile().

Erik
-- 
When you design for the future, the sanity you save may be your own.
                        -- Eric S. Raymond


From auerswal at unix-ag.uni-kl.de  Thu Aug 10 15:03:05 2006
From: auerswal at unix-ag.uni-kl.de (Erik Auerswald)
Date: Thu, 10 Aug 2006 23:03:05 +0200
Subject: [nas] [PATCH] voxware server: using different in and out devices
Message-ID: <20060810210305.GA3851@sushi.unix-ag.uni-kl.de>

Hi,

when using the voxware server with different input- and output-devices
and the server is configured to close the audio devices when no stream
is active, the configuration for the input-device is lost when playing a
stream. The attached patch fixes this.

To really use two sound cards we would need two mixer devices as well.
At the moment we only use sndStatOut.mixer.

Erik
-------------- next part --------------
Index: server/dda/voxware/auvoxware.c
===================================================================
--- server/dda/voxware/auvoxware.c	(revision 175)
+++ server/dda/voxware/auvoxware.c	(working copy)
@@ -754,8 +754,10 @@
             sndStatOut.curSampleRate = rate;
     }
 
-    if (sndStatIn.fd == sndStatOut.fd)
+    if ((sndStatIn.fd == sndStatOut.fd) && (sndStatIn.fd != -1)) {
         sndStatIn = sndStatOut;
+        osLogMsg("setSampleRate(): setting sndStatIn = sndStatOut\n");
+    }
     else if (sndStatIn.curSampleRate != rate) {
         sndStatIn.curSampleRate = rate;
 
@@ -931,8 +933,8 @@
             }
         } else {
             if (NasConfig.DoDebug)
-                osLogMsg("closeDevice IN %s en %d\n",
-                         sndStatOut.device, sndStatOut.howToOpen);
+                osLogMsg("closeDevice IN %s mode %d\n",
+                         sndStatIn.device, sndStatIn.howToOpen);
 
             while (close(sndStatIn.fd)) {
                 osLogMsg("closeDevice: waiting on input device\n");

From jon at radscan.com  Thu Aug 10 22:16:27 2006
From: jon at radscan.com (Jon Trulson)
Date: Thu, 10 Aug 2006 22:16:27 -0600 (MDT)
Subject: [nas] [PATCH] voxware server: using different in and out devices
In-Reply-To: <20060810210305.GA3851@sushi.unix-ag.uni-kl.de>
References: <20060810210305.GA3851@sushi.unix-ag.uni-kl.de>
Message-ID: <Pine.LNX.4.61.0608102215450.32588@m5.radscan.com>

On Thu, 10 Aug 2006, Erik Auerswald wrote:

> Hi,
>
> when using the voxware server with different input- and output-devices
> and the server is configured to close the audio devices when no stream
> is active, the configuration for the input-device is lost when playing a
> stream. The attached patch fixes this.
>

         Applied, thanks.

> To really use two sound cards we would need two mixer devices as well.
> At the moment we only use sndStatOut.mixer.
>

      I would think you would run a seperate server for each sound
      device wouldn't you?

> Erik
>

-- 
Jon Trulson
mailto:jon at radscan.com http://radscan.com/~jon
#include <std/disclaimer.h>
"No Kill I" -Horta



From auerswal at unix-ag.uni-kl.de  Fri Aug 11 06:31:03 2006
From: auerswal at unix-ag.uni-kl.de (Erik Auerswald)
Date: Fri, 11 Aug 2006 14:31:03 +0200
Subject: [nas] [PATCH] voxware server: using different in and out devices
In-Reply-To: <Pine.LNX.4.61.0608102215450.32588@m5.radscan.com>
References: <20060810210305.GA3851@sushi.unix-ag.uni-kl.de> <Pine.LNX.4.61.0608102215450.32588@m5.radscan.com>
Message-ID: <20060811123103.GA5440@sushi.unix-ag.uni-kl.de>

Hi,

On Thu, Aug 10, 2006 at 10:16:27PM -0600, Jon Trulson wrote:
> On Thu, 10 Aug 2006, Erik Auerswald wrote:
> >when using the voxware server with different input- and output-devices
> >and the server is configured to close the audio devices when no stream
> >is active, the configuration for the input-device is lost when playing a
> >stream. The attached patch fixes this.
> >
> 
>         Applied, thanks.

Thanks.

> >To really use two sound cards we would need two mixer devices as well.
> >At the moment we only use sndStatOut.mixer.
> 
>      I would think you would run a seperate server for each sound
>      device wouldn't you?

That depends. Obviously the idea of different input- and output-devices
was to circumvent the OSS half duplex drivers. Today this problem should
be solved by using ALSA drivers. I don't know if there is actually half
duplex sound hardware used in current consumer devices.

So back in the day one would want to run one NAS server making use of
two half duplex soundcards (sound blaster...) and would have to use two
mixer devices to control them. It seems noone actually did this as it is
not fully supported by the voxware server...

In my case I configured the S/PDIF out of the on-board sound as one OSS
device and the normal "analog" in/out hw as another. The sound card
mixer controls all of these devices so I don't need seperate mixers.

Erik


From jon at radscan.com  Fri Aug 11 18:07:29 2006
From: jon at radscan.com (Jon Trulson)
Date: Fri, 11 Aug 2006 18:07:29 -0600 (MDT)
Subject: [nas] [PATCH] voxware server: using different in and out devices
In-Reply-To: <20060811123103.GA5440@sushi.unix-ag.uni-kl.de>
References: <20060810210305.GA3851@sushi.unix-ag.uni-kl.de>
 <Pine.LNX.4.61.0608102215450.32588@m5.radscan.com>
 <20060811123103.GA5440@sushi.unix-ag.uni-kl.de>
Message-ID: <Pine.LNX.4.61.0608111759300.5755@m5.radscan.com>

yOn Fri, 11 Aug 2006, Erik Auerswald wrote:

> Hi,
>
> On Thu, Aug 10, 2006 at 10:16:27PM -0600, Jon Trulson wrote:
>> On Thu, 10 Aug 2006, Erik Auerswald wrote:
[...]
>>> To really use two sound cards we would need two mixer devices as well.
>>> At the moment we only use sndStatOut.mixer.
>>
>>      I would think you would run a seperate server for each sound
>>      device wouldn't you?
>
> That depends. Obviously the idea of different input- and output-devices
> was to circumvent the OSS half duplex drivers. Today this problem should
> be solved by using ALSA drivers. I don't know if there is actually half
> duplex sound hardware used in current consumer devices.
>

         Hmm... I think this was done (would have to check) for certain
         devices (like 'professional' devices) that actually do use a
         seperate dsp device for input and output... I seem to vaguely
         recall adding this for a user that had one of these devices.

         It may have been a driver implementation detail though for
         this particular device.

         Some devices are indeed only capable of half-duplex operation
         (say in the output section), but do this via the same device.
         You will see code in voxware that checks for failures when
         opening a device read/write, and plays a game when this
         fails.

         I have an old SB PCI - it does support FDX operation; I've
         never been in posession of a half-duplex card, but some nas
         users sure have :)

> So back in the day one would want to run one NAS server making use of
> two half duplex soundcards (sound blaster...) and would have to use two
> mixer devices to control them. It seems noone actually did this as it is
> not fully supported by the voxware server...

   Well, a single nas server should handle a single device, half or
   full duplex.  For multiple devices, a nas server should be run for
   each... Steve McIntyre added a patch back in 2004 that allowed you
   to specify a different nasd.conf file on the nasd commande line
   specifically for this purpose.

>
> In my case I configured the S/PDIF out of the on-board sound as one OSS
> device and the normal "analog" in/out hw as another. The sound card
> mixer controls all of these devices so I don't need seperate mixers.

   I'm confused... You really only have a single sound device right?
   It may have multiple outputs, but it's still a single device?



-- 
Jon Trulson
mailto:jon at radscan.com http://radscan.com/~jon
#include <std/disclaimer.h>
"No Kill I" -Horta



From auerswal at unix-ag.uni-kl.de  Fri Aug 11 19:53:31 2006
From: auerswal at unix-ag.uni-kl.de (Erik Auerswald)
Date: Sat, 12 Aug 2006 03:53:31 +0200
Subject: [nas] [PATCH] voxware server: using different in and out devices
In-Reply-To: <Pine.LNX.4.61.0608111759300.5755@m5.radscan.com>
References: <20060810210305.GA3851@sushi.unix-ag.uni-kl.de> <Pine.LNX.4.61.0608102215450.32588@m5.radscan.com> <20060811123103.GA5440@sushi.unix-ag.uni-kl.de> <Pine.LNX.4.61.0608111759300.5755@m5.radscan.com>
Message-ID: <20060812015331.GA17255@sushi.unix-ag.uni-kl.de>

Hi,

On Fri, Aug 11, 2006 at 06:07:29PM -0600, Jon Trulson wrote:
> On Fri, 11 Aug 2006, Erik Auerswald wrote:
> >On Thu, Aug 10, 2006 at 10:16:27PM -0600, Jon Trulson wrote:
> >>On Thu, 10 Aug 2006, Erik Auerswald wrote:
> [...]
>         I have an old SB PCI - it does support FDX operation; I've
>         never been in posession of a half-duplex card, but some nas
>         users sure have :)

The cards did support full-duplex operation, just the free OSS driver
did not. You had to buy the commercial OSS driver to use this under
linux. I did have a soundblaster pro (ISA bus) with this problem. Today
one would just use ALSA for full-duplex operation.

> >In my case I configured the S/PDIF out of the on-board sound as one OSS
> >device and the normal "analog" in/out hw as another. The sound card
> >mixer controls all of these devices so I don't need seperate mixers.
> 
>   I'm confused... You really only have a single sound device right?
>   It may have multiple outputs, but it's still a single device?

This depends on your definition of "device". ;-)

There is sound hardware on the mainboard included in the (nvidia nforce3)
chipset. ALSA reports this as one card. There is one analog output, one
line input, one microphone input, and one digital output connector. This
could be seen as one device.

ALSA reports 4 devices, two capture and two playback devices. Two of
these ALSA devices have the same prefix: pcm0 (pcm0c and pcm0p), one
device is an additional microphone input (pcm1c) and the last one is the
digital output device (pcm2p).

So there are two independent output devices pcm0p and pcm2p and supposedly
two independant input devices pcm0c and pcm1c (I did not verify the input
part). When using ALSA programs all of these devices can be specified.

When using the OSS emulation of ALSA (e.g. with the voxware NAS server)
I have to specify either /dev/dsp or /dev/adsp as devices. By default
/dev/dsp is mapped to pcm0[cp] and /dev/adsp to pcm1c. By using an option
for the emulation module pcm2p can be mapped to /dev/adsp instead. By
mapping either a capture or a playback device to /dev/adsp this is
half-duplex. This way I have two independent OSS devices I can use. The
voxware server can be configured to use both devices, one for input and
one for output.

There is still only one mixer available, either using ALSA directly or
using /dev/mixer via the OSS mixer emulation module of ALSA.

With regard to one server per device: I would expect a sound server to
be able to export every available sound device. Just like the X server
there are uses for one server on several devices (e.g. Xinerama in X)
and for one server per device (and even for several servers time-sharing
one device).

I have just got a PCI sound card (so that I now have the onboard sound
and a sound card -- the sound card is not yet installed), and if I find
the time I will extend the support for two devices to fully include two
mixers as well. Right now a mixer can be specified in the input section
of nasd.conf, but it is not used.

Erik


From steve at einval.com  Sun Aug 13 14:29:32 2006
From: steve at einval.com (Steve McIntyre)
Date: Sun, 13 Aug 2006 21:29:32 +0100
Subject: [nas] [Petr.Salinger@seznam.cz: Bug#379758: nas: FTBFS on GNU/kFreeBSD]
Message-ID: <20060813202932.GA4530@einval.com>

Extra patches needed for 1.8 on GNU/kFreeBSD...

----- Forwarded message from Petr Salinger <Petr.Salinger at seznam.cz> -----

From: Petr Salinger <Petr.Salinger at seznam.cz>
Date: Tue, 25 Jul 2006 13:56:44 +0200 (CEST)
To: submit at bugs.debian.org
Reply-To: Petr Salinger <Petr.Salinger at seznam.cz>, 379758 at bugs.debian.org
Subject: Bug#379758: nas: FTBFS on GNU/kFreeBSD
X-Debian-PR-Message: report 379758
X-Debian-PR-Package: nas
X-Debian-PR-Keywords: patch
X-Debian-PR-Source: nas
X-X-Sender: salinger at sci.felk.cvut.cz
X-FELK-MailScanner-Information: Please contact the ISP for more information
X-FELK-MailScanner: Found to be clean
X-FELK-MailScanner-SpamCheck: not spam, SpamAssassin (not cached,
	score=1.541, required 5, ALL_TRUSTED -1.80, BAYES_50 0.00,
	DNS_FROM_RFC_POST 1.71, SARE_FREE_WEBM_CZSEZNA 0.25,
	SPF_SOFTFAIL 1.38)
X-FELK-MailScanner-SpamScore: s
X-FELK-MailScanner-From: petr.salinger at seznam.cz
X-Spam-Status: No, hits=-1.5 required=5.0
	tests=BAYES_20,DATE_IN_FUTURE_06_12,USER_AGENT_PINE,X_LOOP
	version=2.55
X-Spam-Level: 
X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp)

Package: nas
Severity: important
Version: 1.8-1
Tags: patch


Hi,

the current version fails to build on GNU/kFreeBSD.
It needs updated libtool and small tweaks.

Please, apply attached patch and after that
perform following steps (to update libtool):

cd config
libtoolize -c -f
aclocal-1.7
autoconf

The patch contains also fix for #368726.

It would also be nice if you can ask upstream
to include this changes.

Thanks in advance

                        Petr

diff -u nas-1.8/lib/audio/Imakefile nas-1.8/lib/audio/Imakefile
--- nas-1.8/lib/audio/Imakefile	2006-07-25 15:44:03.000000000 +0200
+++ nas-1.8/lib/audio/Imakefile	2006-07-25 15:44:03.000000000 +0200
@@ -146,7 +146,7 @@
 
 XAULIB = 
 
-#if defined(LinuxArchitecture) || defined(GNUArchitecture)
+#if defined(LinuxArchitecture) || defined(GNUArchitecture) || defined(__FreeBSD_kernel__)
 REQUIREDLIBS = -L$(USRLIBDIR) -lXt $(XAULIB) -lm 
 #endif
 
diff -u nas-1.8/server/Imakefile nas-1.8/server/Imakefile
--- nas-1.8/server/Imakefile
+++ nas-1.8/server/Imakefile
@@ -96,7 +96,7 @@
 #endif
 
 
-#if defined(i386SVR4Architecture) || defined(__FreeBSD__) || defined(FreeBSDArchitecture) || defined(LinuxArchitecture) || defined(i386BsdArchitecture) || defined(USLArchitecture) || defined(cygwinArchitecture) || defined(__DragonFly__)
+#if defined(i386SVR4Architecture) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__) || defined(FreeBSDArchitecture) || defined(LinuxArchitecture) || defined(i386BsdArchitecture) || defined(USLArchitecture) || defined(cygwinArchitecture) || defined(__DragonFly__)
 # define CanBuildAuServer	YES
 
 #if !defined(GNUMachArchitecture)
only in patch2:
unchanged:
--- nas-1.8.orig/server/dia/auservertype.h
+++ nas-1.8/server/dia/auservertype.h
@@ -14,7 +14,7 @@
 # define SGI_SERVER
 #endif						/* sgi */
 
-#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(linux) || (defined(SVR4) && (defined(SYSV386) || defined(i386))) || defined(__CYGWIN__)
+#if defined(__DragonFly__) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(linux) || (defined(SVR4) && (defined(SYSV386) || defined(i386))) || defined(__CYGWIN__)
 # define VOXWARE_SERVER
 #endif                                          /* voxware */
 
only in patch2:
unchanged:
--- nas-1.8.orig/config/acinclude.m4
+++ nas-1.8/config/acinclude.m4
@@ -0,0 +1,72 @@
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_func_snprintf.html
+
+AC_DEFUN([AC_FUNC_SNPRINTF],
+[AC_CHECK_FUNCS(snprintf vsnprintf)
+AC_MSG_CHECKING(for working snprintf)
+AC_CACHE_VAL(ac_cv_have_working_snprintf,
+[AC_TRY_RUN(
+[#include <stdio.h>
+
+int main(void)
+{
+    char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
+    char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
+    int i;
+    i = snprintf (bufs, 2, "%s", "111");
+    if (strcmp (bufs, "1")) exit (1);
+    if (i != 3) exit (1);
+    i = snprintf (bufd, 2, "%d", 111);
+    if (strcmp (bufd, "1")) exit (1);
+    if (i != 3) exit (1);
+    exit(0);
+}], ac_cv_have_working_snprintf=yes, ac_cv_have_working_snprintf=no, ac_cv_have_working_snprintf=cross)])
+AC_MSG_RESULT([$ac_cv_have_working_snprintf])
+AC_MSG_CHECKING(for working vsnprintf)
+AC_CACHE_VAL(ac_cv_have_working_vsnprintf,
+[AC_TRY_RUN(
+[#include <stdio.h>
+#include <stdarg.h>
+
+int my_vsnprintf (char *buf, const char *tmpl, ...)
+{
+    int i;
+    va_list args;
+    va_start (args, tmpl);
+    i = vsnprintf (buf, 2, tmpl, args);
+    va_end (args);
+    return i;
+}
+
+int main(void)
+{
+    char bufs[5] = { 'x', 'x', 'x', '\0', '\0' };
+    char bufd[5] = { 'x', 'x', 'x', '\0', '\0' };
+    int i;
+    i = my_vsnprintf (bufs, "%s", "111");
+    if (strcmp (bufs, "1")) exit (1);
+    if (i != 3) exit (1);
+    i = my_vsnprintf (bufd, "%d", 111);
+    if (strcmp (bufd, "1")) exit (1);
+    if (i != 3) exit (1);
+    exit(0);
+}], ac_cv_have_working_vsnprintf=yes, ac_cv_have_working_vsnprintf=no, ac_cv_have_working_vsnprintf=cross)])
+AC_MSG_RESULT([$ac_cv_have_working_vsnprintf])
+if test x$ac_cv_have_working_snprintf$ac_cv_have_working_vsnprintf != "xyesyes"; then
+  AC_LIBOBJ(snprintf)
+  AC_MSG_WARN([Replacing missing/broken (v)snprintf() with version from http://www.ijs.si/software/snprintf/.])
+  AC_DEFINE(PREFER_PORTABLE_SNPRINTF, 1, "enable replacement (v)snprintf if system (v)snprintf is broken")
+fi])
+
+
+


----- End forwarded message -----
-- 
Steve McIntyre, Cambridge, UK.                                steve at einval.com
Google-bait:       http://www.debian.org/CD/free-linux-cd
  Debian does NOT ship free CDs. Please do NOT contact the mailing
  lists asking us to send them to you.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://radscan.com/pipermail/nas/attachments/20060813/68e67025/attachment.pgp>

From jon at radscan.com  Sun Aug 13 18:57:45 2006
From: jon at radscan.com (Jon Trulson)
Date: Sun, 13 Aug 2006 18:57:45 -0600 (MDT)
Subject: [nas] [PATCH] voxware server: using different in and out devices
In-Reply-To: <20060812015331.GA17255@sushi.unix-ag.uni-kl.de>
References: <20060810210305.GA3851@sushi.unix-ag.uni-kl.de>
 <Pine.LNX.4.61.0608102215450.32588@m5.radscan.com>
 <20060811123103.GA5440@sushi.unix-ag.uni-kl.de> <Pine.LNX.4.61.0608111759300.5755@m5.radscan.com>
 <20060812015331.GA17255@sushi.unix-ag.uni-kl.de>
Message-ID: <Pine.LNX.4.61.0608131849110.23132@m5.radscan.com>

On Sat, 12 Aug 2006, Erik Auerswald wrote:

> Hi,
>
> On Fri, Aug 11, 2006 at 06:07:29PM -0600, Jon Trulson wrote:
>> On Fri, 11 Aug 2006, Erik Auerswald wrote:
>>> On Thu, Aug 10, 2006 at 10:16:27PM -0600, Jon Trulson wrote:
>>>> On Thu, 10 Aug 2006, Erik Auerswald wrote:
>> [...]
>>         I have an old SB PCI - it does support FDX operation; I've
>>         never been in posession of a half-duplex card, but some nas
>>         users sure have :)
>
> The cards did support full-duplex operation, just the free OSS driver
> did not. You had to buy the commercial OSS driver to use this under
> linux. I did have a soundblaster pro (ISA bus) with this problem. Today
> one would just use ALSA for full-duplex operation.
>

         Huh... I never had a problem with my SB and FDX with pay or free OSS...

>>> In my case I configured the S/PDIF out of the on-board sound as one OSS
>>> device and the normal "analog" in/out hw as another. The sound card
>>> mixer controls all of these devices so I don't need seperate mixers.
>>
>>   I'm confused... You really only have a single sound device right?
>>   It may have multiple outputs, but it's still a single device?
>
> This depends on your definition of "device". ;-)
>
> There is sound hardware on the mainboard included in the (nvidia nforce3)
> chipset. ALSA reports this as one card. There is one analog output, one
> line input, one microphone input, and one digital output connector. This
> could be seen as one device.
>

         Yes, that's is what I am refering to as device - the physical
         card/imbedded chip doing all the work. :)

> ALSA reports 4 devices, two capture and two playback devices. Two of
> these ALSA devices have the same prefix: pcm0 (pcm0c and pcm0p), one
> device is an additional microphone input (pcm1c) and the last one is the
> digital output device (pcm2p).
>
> So there are two independent output devices pcm0p and pcm2p and supposedly
> two independant input devices pcm0c and pcm1c (I did not verify the input
> part). When using ALSA programs all of these devices can be specified.

   Ahh yes... in NAS they cannot.  Currently nas exports a small subset
   of available output 'devices' - mono and stereo.  HP has a hack in
   nasd.conf that allows it to select between External speakers and
   internal headphones, but that's about it.

   Maybe a new 'changable' (see auinfo) should be added to allow more
   specific selection of the output 'device'?

>
> When using the OSS emulation of ALSA (e.g. with the voxware NAS server)
> I have to specify either /dev/dsp or /dev/adsp as devices. By default
> /dev/dsp is mapped to pcm0[cp] and /dev/adsp to pcm1c. By using an option
> for the emulation module pcm2p can be mapped to /dev/adsp instead. By
> mapping either a capture or a playback device to /dev/adsp this is
> half-duplex. This way I have two independent OSS devices I can use. The
> voxware server can be configured to use both devices, one for input and
> one for output.

   Hmm.

>
> There is still only one mixer available, either using ALSA directly or
> using /dev/mixer via the OSS mixer emulation module of ALSA.
>
> With regard to one server per device: I would expect a sound server to
> be able to export every available sound device. Just like the X server
> there are uses for one server on several devices (e.g. Xinerama in X)
> and for one server per device (and even for several servers time-sharing
> one device).

   Hehe, so each sound device (hardware device) would be a seperate
   'X11 Screen'?  I suppose since nas was based on X, this would be
   possible.  Configuration would need significant rework, that's for
   sure.

>
> I have just got a PCI sound card (so that I now have the onboard sound
> and a sound card -- the sound card is not yet installed), and if I find
> the time I will extend the support for two devices to fully include two
> mixers as well. Right now a mixer can be specified in the input section
> of nasd.conf, but it is not used.

   Time to use it! :)

-- 
Jon Trulson
mailto:jon at radscan.com http://radscan.com/~jon
#include <std/disclaimer.h>
"No Kill I" -Horta



From jon at radscan.com  Sun Aug 13 19:12:23 2006
From: jon at radscan.com (Jon Trulson)
Date: Sun, 13 Aug 2006 19:12:23 -0600 (MDT)
Subject: [nas] [Petr.Salinger@seznam.cz: Bug#379758: nas: FTBFS on
 GNU/kFreeBSD]
In-Reply-To: <20060813202932.GA4530@einval.com>
References: <20060813202932.GA4530@einval.com>
Message-ID: <Pine.LNX.4.61.0608131910130.23132@m5.radscan.com>

On Sun, 13 Aug 2006, Steve McIntyre wrote:

> Extra patches needed for 1.8 on GNU/kFreeBSD...
>
> ----- Forwarded message from Petr Salinger <Petr.Salinger at seznam.cz> -----

   Applied.  I had to add the first patch manually - it did not seem to
   be diff'd against the current lib/audio/Imakefile (GNUArchitecture).

   At any rate, the rest went ok.  Thanks.


-- 
Jon Trulson
mailto:jon at radscan.com http://radscan.com/~jon
#include <std/disclaimer.h>
"No Kill I" -Horta



From auerswal at unix-ag.uni-kl.de  Tue Aug 15 21:36:04 2006
From: auerswal at unix-ag.uni-kl.de (Erik Auerswald)
Date: Wed, 16 Aug 2006 05:36:04 +0200
Subject: [nas] [PATCH] use the mixer specified in the input section
Message-ID: <20060816033604.GA1679@sushi.unix-ag.uni-kl.de>

Hi,

the attached patch adds support for a different mixer for the input device
to the voxware server. Without this patch the mixer device specified in
the input section of the config file is not used.

To use the same mixer for input and output just specify the same device
in the input- and output-section of the config file. The empty string ""
can be used to specify no mixer device for the input- or output-section.
This is documented in the nasd.conf man page.

The outputsection keyword is added to the nasd.conf man page by the patch.

While testing this I found a bug in the support of two devices:
If two devices are used and the sample rate of the input device can be
changed the wrong sample size is set by openDevice(). I did not notice
this when testing the digital output because the digital output has
a fixed sample size. This bug is fixed by the patch as well.

The patch removes the unused "stereodevs" variable, too.

I've tested the patch with just one device for input and output, two
devices with seperate mixers, two devices with just one mixer, and two
devices with no mixer for the output, but a mixer for the input device.

Erik
-- 
It gave some error message, or something.
                        -- Agust?n Cernuda del R?o
-------------- next part --------------
Index: server/nasd.conf.man
===================================================================
--- server/nasd.conf.man	(revision 178)
+++ server/nasd.conf.man	(working copy)
@@ -17,7 +17,7 @@
 deals with global options, some of which just turn on verbose messages
 when parsing the config file, and setting debug messages on. The
 remaining two sections will, if present, adjust various parameters of
-the input and output devices, for those server that undersand them.
+the input and output devices, for those servers that understand them.
 .PP
 .B verbose
 Sets a flag telling the server to report what it's trying to do with each
@@ -55,6 +55,10 @@
 (headphone/speakers) or "INT" for the internal output device (internal
 speaker).  Defaults to external.
 .PP
+.B outputsection
+Marks the beginning of the output section, which allows various parameters
+of the output device to be set up.
+.PP
 .B inputsection
 Marks the beginning of the input section, which allows various parameters
 of the input device to be set up.
@@ -67,6 +71,8 @@
 .PP
 .B mixer "mixername"
 Specifies what mixer device is used. An example is \fBmixer "/dev/mixer"\fR.
+If \fBmixername\fR is set to the empty string \fB""\fR no mixer is used in
+this section.
 .PP
 .B gain number
 Specifies the default volume (0-100). The default is 50.
Index: server/dda/voxware/auvoxware.c
===================================================================
--- server/dda/voxware/auvoxware.c	(revision 178)
+++ server/dda/voxware/auvoxware.c	(working copy)
@@ -224,12 +224,13 @@
 static AuBool relinquish_device = 0;
 static AuBool leave_mixer = 0;
 static AuBool share_in_out = 0;
+static AuBool share_mixer = 0;
 
 static int recControlMode = 0;  /* how to control recording level */
-static int mixerfd = -1;        /* The mixer device */
+static int outmixerfd = -1;     /* The output device mixer device */
+static int inmixerfd = -1;      /* The input device mixer device */
 static int devmask = 0;         /* Bitmask for supported mixer devices */
 static int recmask = 0;         /* Supported recording sources */
-static int stereodevs = 0;      /* Channels supporting stereo */
 
 int VOXMixerInit = TRUE;        /* overridden by nasd.conf */
 int VOXReInitMixer = FALSE;     /* overridden by nasd.conf */
@@ -355,11 +356,11 @@
 {
     int pcm_level = 0;
 
-    if (mixerfd != -1) {
-        if (ioctl(mixerfd, MIXER_READ(SOUND_MIXER_PCM), &pcm_level) == -1) {
+    if (outmixerfd != -1) {
+        if (ioctl(outmixerfd, MIXER_READ(SOUND_MIXER_PCM), &pcm_level) == -1) {
             osLogMsg("readMixerOutputGain: "
                      "%s: ioctl(%d, MIXER_READ(SOUND_MIXER_PCM)) failed: %s\n",
-                     sndStatOut.mixer, mixerfd, strerror(errno));
+                     sndStatOut.mixer, outmixerfd, strerror(errno));
             return sndStatOut.gain;
         }
     } else {
@@ -379,11 +380,11 @@
 {
     int input_mode = 0;
 
-    if (mixerfd != -1) {
-        if (ioctl(mixerfd, MIXER_READ(SOUND_MIXER_RECSRC), &input_mode) == -1) {
+    if (inmixerfd != -1) {
+        if (ioctl(inmixerfd,MIXER_READ(SOUND_MIXER_RECSRC),&input_mode) == -1) {
             osLogMsg("readMixerInputMode: "
                      "%s: ioctl(%d, MIXER_READ(SOUND_MIXER_RECSRC)) failed: "
-                     "%s\n", sndStatOut.mixer, mixerfd, strerror(errno));
+                     "%s\n", sndStatIn.mixer, inmixerfd, strerror(errno));
             return 1<<SOUND_MIXER_LINE;
         }
         if (!(input_mode & (SOUND_MASK_MIC | SOUND_MIXER_LINE))) {
@@ -404,43 +405,43 @@
     
     recsrc = readMixerInputMode();
 
-    if (mixerfd != -1) {
+    if (inmixerfd != -1) {
         switch (recControlMode) {
         case useMixerIGain:
-            if (ioctl(mixerfd, MIXER_READ(SOUND_MIXER_IGAIN),&in_level) == -1) {
+            if (ioctl(inmixerfd,MIXER_READ(SOUND_MIXER_IGAIN),&in_level) == -1){
                 osLogMsg("readMixerInputGain: %s: "
                          "ioctl(MIXER_READ(SOUND_MIXER_IGAIN)) failed: %s\n",
-                         sndStatOut.mixer, strerror(errno));
+                         sndStatIn.mixer, strerror(errno));
                 return sndStatIn.gain;
             }
             break;
 
         case useMixerRecLev:
-            if (ioctl(mixerfd, MIXER_READ(SOUND_MIXER_RECLEV),&in_level) == -1){
+            if (ioctl(inmixerfd,MIXER_READ(SOUND_MIXER_RECLEV),&in_level)==-1) {
                 osLogMsg("readMixerInputGain: "
                          "%s: ioctl(%d, MIXER_READ(SOUND_MIXER_RECLEV)) failed:"
-                         " %s\n", sndStatOut.mixer, mixerfd, strerror(errno));
+                         " %s\n", sndStatIn.mixer, inmixerfd, strerror(errno));
                 return sndStatIn.gain;
             }
             break;
 
         case useMixerLineMic:
             if (recsrc & SOUND_MASK_LINE) {
-                if (ioctl(mixerfd, MIXER_READ(SOUND_MIXER_LINE), &in_level)
+                if (ioctl(inmixerfd, MIXER_READ(SOUND_MIXER_LINE), &in_level)
                     == -1) {
                     osLogMsg("readMixerInputGain: "
                              "%s: ioctl(%d, MIXER_READ(SOUND_MIXER_LINE)) "
                              "failed: %s\n",
-                             sndStatOut.mixer, mixerfd, strerror(errno));
+                             sndStatIn.mixer, inmixerfd, strerror(errno));
                     return sndStatIn.gain;
                 }
             } else if (recsrc & SOUND_MASK_MIC) {
-                if (ioctl(mixerfd, MIXER_READ(SOUND_MIXER_MIC), &in_level)
+                if (ioctl(inmixerfd, MIXER_READ(SOUND_MIXER_MIC), &in_level)
                     == -1) {
                     osLogMsg("readMixerInputGain: "
                              "%s: ioctl(%d, MIXER_READ(SOUND_MIXER_MIC)) "
                              "failed: %s\n",
-                             sndStatOut.mixer, mixerfd, strerror(errno));
+                             sndStatIn.mixer, inmixerfd, strerror(errno));
                     return sndStatIn.gain;
                 }
             } else {
@@ -752,11 +753,15 @@
               &(sndStatOut.curSampleRate));
         if (sndStatOut.forceRate)
             sndStatOut.curSampleRate = rate;
+        if (NasConfig.DoDebug)
+            osLogMsg("setSampleRate(): set output sample rate to %d\n",
+                     sndStatOut.curSampleRate);
     }
 
     if ((sndStatIn.fd == sndStatOut.fd) && (sndStatIn.fd != -1)) {
         sndStatIn = sndStatOut;
-        osLogMsg("setSampleRate(): setting sndStatIn = sndStatOut\n");
+        if (NasConfig.DoDebug)
+            osLogMsg("setSampleRate(): setting sndStatIn = sndStatOut\n");
     }
     else if (sndStatIn.curSampleRate != rate) {
         sndStatIn.curSampleRate = rate;
@@ -768,6 +773,9 @@
         ioctl(sndStatIn.fd, SNDCTL_DSP_SPEED, &(sndStatIn.curSampleRate));
         if (sndStatIn.forceRate)
             sndStatIn.curSampleRate = rate;
+        if (NasConfig.DoDebug)
+            osLogMsg("setSampleRate(): set input sample rate to %d\n",
+                     sndStatIn.curSampleRate);
     }
 #if defined(AUDIO_DRAIN)
     if (sndStatOut.isPCSpeaker)
@@ -790,6 +798,7 @@
 {
     unsigned int extramode = 0;
     int retries;
+    int curSampleRate;
 
     setTimer(0);                /* no timers here */
 #if defined(__CYGWIN__)         /* we want the file to be created if necc under
@@ -801,7 +810,15 @@
         osLogMsg("openDevice\n");
     }
 
+    curSampleRate = sndStatOut.curSampleRate;
     if (NasConfig.DoDebug) {
+        osLogMsg("openDevice: current sample rate = %d\n", curSampleRate);
+        if (sndStatOut.curSampleRate != sndStatIn.curSampleRate)
+            osLogMsg("openDevice: sndStatOut.curSampleRate !="
+                     " sndStatIn.curSampleRate\n");
+    }
+
+    if (NasConfig.DoDebug) {
         osLogMsg("openDevice OUT %s mode %d\n",
                  sndStatOut.device, sndStatOut.howToOpen);
     }
@@ -852,26 +869,58 @@
         }
     }
 
-    if (mixerfd == -1) {
-        while ((mixerfd = open(sndStatOut.mixer, O_RDWR | extramode,
-                               0666)) == -1 && wait) {
-            if ((errno == EAGAIN) || (errno == EBUSY)) {
-                osLogMsg("openDevice: waiting on mixer device %s\n",
-                         sndStatOut.mixer);
-                sleep(1);
-            } else {
-                osLogMsg("openDevice: could not open mixer device %s: %s\n",
-                         sndStatOut.mixer, strerror(errno));
-                break;
+    if (outmixerfd == -1) {
+        if (sndStatOut.mixer[0] == '\0') {
+            osLogMsg("openDevice: no output mixer device specified\n");
+        } else {
+            while ((outmixerfd = open(sndStatOut.mixer, O_RDWR | extramode,
+                                   0666)) == -1 && wait) {
+                if ((errno == EAGAIN) || (errno == EBUSY)) {
+                    osLogMsg("openDevice: waiting on mixer device %s\n",
+                             sndStatOut.mixer);
+                    sleep(1);
+                } else {
+                    osLogMsg("openDevice: could not open output mixer device"
+                             " %s: %s\n", sndStatOut.mixer, strerror(errno));
+                    break;
+                }
             }
+            if (outmixerfd != -1)
+                osLogMsg("openDevice: opened mixer %s\n", sndStatOut.mixer);
         }
-        if (mixerfd != -1)
-            osLogMsg("openDevice: opened mixer %s\n", sndStatOut.mixer);
     } else {
         if (NasConfig.DoDebug) {
-            osLogMsg("openDevice: mixer device already open\n");
+            osLogMsg("openDevice: output mixer device already open\n");
         }
     }
+
+    if ((inmixerfd == -1) && !share_mixer) {
+        if (sndStatIn.mixer[0] != '\0') {
+            osLogMsg("openDevice: no input mixer device specified\n");
+        } else {
+            while ((inmixerfd = open(sndStatIn.mixer, O_RDWR | extramode,
+                                   0666)) == -1 && wait) {
+                if ((errno == EAGAIN) || (errno == EBUSY)) {
+                    osLogMsg("openDevice: waiting on mixer device %s\n",
+                             sndStatIn.mixer);
+                    sleep(1);
+                } else {
+                    osLogMsg("openDevice: could not open input mixer device"
+                             " %s: %s\n", sndStatIn.mixer, strerror(errno));
+                    break;
+                }
+            }
+            if (inmixerfd != -1)
+                osLogMsg("openDevice: opened mixer %s\n", sndStatIn.mixer);
+        }
+    } else {
+        if (share_mixer) {
+            inmixerfd = outmixerfd;
+        }
+        if (NasConfig.DoDebug) {
+            osLogMsg("openDevice: input mixer device already open\n");
+        }
+    }
 #endif
 
     ioctl(sndStatOut.fd, SNDCTL_DSP_SYNC, NULL);
@@ -888,7 +937,7 @@
         if (sndStatOut.fd != sndStatIn.fd) {
             ioctl(sndStatIn.fd, SNDCTL_DSP_SYNC, NULL);
 #ifndef sco
-            rate = sndStatOut.curSampleRate;
+            rate = sndStatIn.curSampleRate;
             ioctl(sndStatIn.fd, SNDCTL_DSP_SPEED,
                   &sndStatIn.curSampleRate);
             if (sndStatIn.forceRate)
@@ -897,7 +946,7 @@
         }
     }
 
-    setSampleRate(sndStatIn.curSampleRate);
+    setSampleRate(curSampleRate);
 
     return AuTrue;
 }
@@ -949,21 +998,37 @@
 
     if (NasConfig.DoKeepMixer) {
         if (NasConfig.DoDebug) {
-            osLogMsg("closeDevice: leaving mixerdevice open\n");
+            osLogMsg("closeDevice: leaving mixer device(s) open\n");
         }
-    } else if (-1 == mixerfd) {
-        if (NasConfig.DoDebug) {
-            osLogMsg("closeDevice: mixerdevice already closed\n");
-        }
     } else {
-        while (close(mixerfd)) {
-            osLogMsg("closeDevice: waiting on mixer device\n");
-            sleep(1);
+        if (-1 == outmixerfd) {
+            if (NasConfig.DoDebug) {
+                osLogMsg("closeDevice: output mixer device already closed\n");
+            }
+        } else {
+            while (close(outmixerfd)) {
+                osLogMsg("closeDevice: waiting on output mixer device\n");
+                sleep(1);
+            }
+            if (NasConfig.DoDebug) {
+                osLogMsg("closeDevice: closed output mixer device\n");
+            }
+            outmixerfd = -1;
         }
-        if (NasConfig.DoDebug) {
-            osLogMsg("closeDevice: closed mixer device\n");
+        if (-1 == inmixerfd) {
+            if (NasConfig.DoDebug) {
+                osLogMsg("closeDevice: input mixer device already closed\n");
+            }
+        } else {
+            while (!share_mixer && close(inmixerfd)) {
+                osLogMsg("closeDevice: waiting on input mixer device\n");
+                sleep(1);
+            }
+            if (NasConfig.DoDebug) {
+                osLogMsg("closeDevice: closed input mixer device\n");
+            }
+            inmixerfd = -1;
         }
-        mixerfd = -1;
     }
 
     sndStatIn.fd = -1;
@@ -1080,8 +1145,8 @@
     }
 
     gusvolume = g | (g << 8);
-    if (mixerfd != -1)
-        if (ioctl(mixerfd, MIXER_WRITE(SOUND_MIXER_PCM), &gusvolume) == -1)
+    if (outmixerfd != -1)
+        if (ioctl(outmixerfd, MIXER_WRITE(SOUND_MIXER_PCM), &gusvolume) == -1)
             osLogMsg("setPhysicalOutputGain: "
                      "%s: ioctl(MIXER_WRITE(SOUND_MIXER_PCM)) failed: %s\n",
                      sndStatOut.mixer, strerror(errno));
@@ -1123,54 +1188,54 @@
 
     inputAttenuation = inputAttenuation << 8 | inputAttenuation;
 
-    if (mixerfd != -1) {
+    if (inmixerfd != -1) {
         switch (recControlMode) {
         case useMixerNone:
             break;
 
         case useMixerIGain:
             if (ioctl
-                (mixerfd, MIXER_WRITE(SOUND_MIXER_IGAIN),
+                (inmixerfd, MIXER_WRITE(SOUND_MIXER_IGAIN),
                  &inputAttenuation) == -1)
                 osLogMsg("setPhysicalInputGainAndLineMode: "
                          "%s: ioctl(MIXER_WRITE(SOUND_MIXER_IGAIN)) failed: "
-                         "%s\n", sndStatOut.mixer, strerror(errno));
+                         "%s\n", sndStatIn.mixer, strerror(errno));
             break;
 
         case useMixerRecLev:
             if (ioctl
-                (mixerfd, MIXER_WRITE(SOUND_MIXER_RECLEV),
+                (inmixerfd, MIXER_WRITE(SOUND_MIXER_RECLEV),
                  &inputAttenuation) == -1)
                 osLogMsg("setPhysicalInputGainAndLineMode: "
                          "%s: ioctl(MIXER_WRITE(SOUND_MIXER_RECLEV)) failed: "
-                         "%s\n", sndStatOut.mixer, strerror(errno));
+                         "%s\n", sndStatIn.mixer, strerror(errno));
             break;
 
         case useMixerLineMic:
             if (lineMode == AuDeviceLineModeHigh) {
-                if (ioctl(mixerfd, MIXER_WRITE(SOUND_MIXER_LINE), &zero) ==
+                if (ioctl(inmixerfd, MIXER_WRITE(SOUND_MIXER_LINE), &zero) ==
                     -1)
                     osLogMsg("setPhysicalInputGainAndLineMode: "
                              "%s: ioctl(MIXER_WRITE(SOUND_MIXER_LINE)) failed: "
-                             "%s\n", sndStatOut.mixer, strerror(errno));
+                             "%s\n", sndStatIn.mixer, strerror(errno));
                 if (ioctl
-                    (mixerfd, MIXER_WRITE(SOUND_MIXER_MIC),
+                    (inmixerfd, MIXER_WRITE(SOUND_MIXER_MIC),
                      &inputAttenuation) == -1)
                     osLogMsg("setPhysicalInputGainAndLineMode: "
                              "%s: ioctl(MIXER_WRITE(SOUND_MIXER_MIC)) failed: "
-                             "%s\n", sndStatOut.mixer, strerror(errno));
+                             "%s\n", sndStatIn.mixer, strerror(errno));
             } else if (lineMode == AuDeviceLineModeLow) {
                 if (ioctl
-                    (mixerfd, MIXER_WRITE(SOUND_MIXER_LINE),
+                    (inmixerfd, MIXER_WRITE(SOUND_MIXER_LINE),
                      &inputAttenuation) == -1)
                     osLogMsg("setPhysicalInputGainAndLineMode: "
                              "%s: ioctl(MIXER_WRITE(SOUND_MIXER_LINE)) failed: "
-                             "%s\n", sndStatOut.mixer, strerror(errno));
-                if (ioctl(mixerfd, MIXER_WRITE(SOUND_MIXER_MIC), &zero) ==
+                             "%s\n", sndStatIn.mixer, strerror(errno));
+                if (ioctl(inmixerfd, MIXER_WRITE(SOUND_MIXER_MIC), &zero) ==
                     -1)
                     osLogMsg("setPhysicalInputGainAndLineMode: "
                              "%s: ioctl(MIXER_WRITE(SOUND_MIXER_MIC)) failed: "
-                             "%s\n", sndStatOut.mixer, strerror(errno));
+                             "%s\n", sndStatIn.mixer, strerror(errno));
             }
             break;
 
@@ -1180,10 +1245,10 @@
             break;
         }
 
-        if (ioctl(mixerfd, MIXER_WRITE(SOUND_MIXER_RECSRC), &recsrc) == -1)
+        if (ioctl(inmixerfd, MIXER_WRITE(SOUND_MIXER_RECSRC), &recsrc) == -1)
             osLogMsg("setPhysicalInputGainAndLineMode: "
                      "%s: ioctl(MIXER_WRITE(SOUND_MIXER_RECSRC)) failed: %s\n",
-                     sndStatOut.mixer, strerror(errno));
+                     sndStatIn.mixer, strerror(errno));
     }
 }
 
@@ -1643,24 +1708,55 @@
     extramode = O_CREAT;
 #endif
 
-    if ((mixerfd = open(sndStatOut.mixer, O_RDWR | extramode,
-                        0666)) == -1) {
-        UNIDENTMSG;
-        osLogMsg("initMixer: could not open mixer device %s: %s\n",
-                 sndStatOut.mixer, strerror(errno));
-        return AuFalse;
+    /* open output mixer device */
+    if (sndStatOut.mixer[0] != '\0') {
+        if ((outmixerfd=open(sndStatOut.mixer, O_RDWR|extramode, 0666)) == -1) {
+            UNIDENTMSG;
+            osLogMsg("initMixer: could not open output mixer device %s: %s\n",
+                     sndStatOut.mixer, strerror(errno));
+            return AuFalse;
+        }
+        if (NasConfig.DoDebug)
+            osLogMsg("initMixer: opened output mixer device %s\n",
+                     sndStatOut.mixer, outmixerfd);
+    } else {
+        if (NasConfig.DoDebug)
+            osLogMsg("initMixer: no output mixer device specified\n");
     }
 
-    if (NasConfig.DoDebug)
-        osLogMsg("initMixer: opened mixer device %s\n",
-                 sndStatOut.mixer, mixerfd);
+    /* open input mixer device */
+    if (sndStatIn.mixer[0] != '\0') {
+        if (strcmp(sndStatIn.mixer, sndStatOut.mixer) != 0) {
+            if ((inmixerfd = open(sndStatIn.mixer, O_RDWR | extramode,
+                                0666)) == -1) {
+                UNIDENTMSG;
+                osLogMsg("initMixer: could not open input mixer device %s: %s\n"
+                         , sndStatIn.mixer, strerror(errno));
+                return AuFalse;
+            }
+        } else {
+            share_mixer = AuTrue;
+            inmixerfd = outmixerfd;
+            if (NasConfig.DoDebug)
+                osLogMsg("initMixer: using the same mixer device for"
+                         " in- and output\n");
+        }
+        if (NasConfig.DoDebug)
+            osLogMsg("initMixer: opened input mixer device %s\n",
+                     sndStatIn.mixer, inmixerfd);
+    } else {
+        if (NasConfig.DoDebug)
+            osLogMsg("initMixer: no input mixer device specified\n");
+        return AuTrue;
+    }
 
-    if (ioctl(mixerfd, SOUND_MIXER_READ_DEVMASK, &devmask) == -1) {
+    /* get recording devices of input mixer */
+    if (ioctl(inmixerfd, SOUND_MIXER_READ_DEVMASK, &devmask) == -1) {
         osLogMsg("initMixer: %s: ioctl(SOUND_MIXER_READ_DEVMASK) failed: %s\n",
-                 sndStatOut.mixer, strerror(errno));
-        osLogMsg("initMixer: closing mixer device\n");
-        close(mixerfd);
-        mixerfd = -1;
+                 sndStatIn.mixer, strerror(errno));
+        osLogMsg("initMixer: closing input mixer device\n");
+        close(inmixerfd);
+        inmixerfd = -1;
     } else {
         if (devmask & (1 << SOUND_MIXER_IGAIN)) {
             recControlMode = useMixerIGain;
@@ -1672,25 +1768,18 @@
         } else {
             recControlMode = useMixerNone;
             osLogMsg("initMixer: %s: can't control recording level\n",
-                     sndStatOut.mixer);
+                     sndStatIn.mixer);
         }
 
         if (NasConfig.DoDebug)
             osLogMsg("initMixer: %s: using recording level control method %d\n",
-                     sndStatOut.mixer, recControlMode);
+                     sndStatIn.mixer, recControlMode);
 
-        if (ioctl(mixerfd, SOUND_MIXER_READ_RECMASK, &recmask) == -1) {
+        if (ioctl(inmixerfd, SOUND_MIXER_READ_RECMASK, &recmask) == -1) {
             osLogMsg("initMixer: %s: ioctl(SOUND_MIXER_READ_RECMASK) failed: "
-                     "%s\n", sndStatOut.mixer, strerror(errno));
+                     "%s\n", sndStatIn.mixer, strerror(errno));
             return AuFalse;
         }
-
-        if (ioctl(mixerfd, SOUND_MIXER_READ_STEREODEVS, &stereodevs) == -1) {
-            UNIDENTMSG;
-            osLogMsg("initMixer: %s: ioctl(SOUND_MIXER_READ_STEREODEVS) failed:"
-                     " %s\n", sndStatOut.mixer, strerror(errno));
-            return AuFalse;
-        }
     }
     return AuTrue;
 }
@@ -1813,11 +1902,16 @@
         if (!sndStatOut.isPCSpeaker) {
             if (initMixer() == AuFalse) {
                 osLogMsg("Init: initMixer failed\n");
-                if (mixerfd != -1) {
-                    osLogMsg("Init: closing mixer devcie\n");
-                    close(mixerfd);
-                    mixerfd = -1;
+                if (outmixerfd != -1) {
+                    osLogMsg("Init: closing output mixer device\n");
+                    close(outmixerfd);
+                    outmixerfd = -1;
                 }
+                if (inmixerfd != -1) {
+                    osLogMsg("Init: closing input mixer device\n");
+                    close(inmixerfd);
+                    inmixerfd = -1;
+                }
             } else {
                 if (NasConfig.DoDebug)
                     osLogMsg("Init: initMixer was successful\n");

From pgf at foxharp.boston.ma.us  Tue Aug 15 22:12:33 2006
From: pgf at foxharp.boston.ma.us (Paul Fox)
Date: Wed, 16 Aug 2006 00:12:33 -0400
Subject: [nas] [PATCH] use the mixer specified in the input section 
In-Reply-To: <20060816033604.GA1679@sushi.unix-ag.uni-kl.de> 
References: <20060816033604.GA1679@sushi.unix-ag.uni-kl.de>
Message-ID: <4224.1155701553@foxharp.boston.ma.us>

erik wrote:
 > the attached patch adds support for a different mixer for the input device
 > to the voxware server. Without this patch the mixer device specified in
 > the input section of the config file is not used.
 > 
 > To use the same mixer for input and output just specify the same device
 > in the input- and output-section of the config file. The empty string ""

the default config seems to specify too different mixers
(/dev/mixer, and /dev/mixer1).  this means that this patch
changes the default behavior? 

paul
=---------------------
 paul fox, pgf at foxharp.boston.ma.us (arlington, ma, where it's 63.7 degrees)


From auerswal at unix-ag.uni-kl.de  Wed Aug 16 11:14:48 2006
From: auerswal at unix-ag.uni-kl.de (Erik Auerswald)
Date: Wed, 16 Aug 2006 19:14:48 +0200
Subject: [nas] [PATCH] use the mixer specified in the input section
In-Reply-To: <4224.1155701553@foxharp.boston.ma.us>
References: <20060816033604.GA1679@sushi.unix-ag.uni-kl.de> <4224.1155701553@foxharp.boston.ma.us>
Message-ID: <20060816171448.GA32552@sushi.unix-ag.uni-kl.de>

Hi,

On Wed, Aug 16, 2006 at 12:12:33AM -0400, Paul Fox wrote:
> erik wrote:
>  > the attached patch adds support for a different mixer for the input device
>  > to the voxware server. Without this patch the mixer device specified in
>  > the input section of the config file is not used.
>  > 
>  > To use the same mixer for input and output just specify the same device
>  > in the input- and output-section of the config file. The empty string ""
> 
> the default config seems to specify too different mixers
> (/dev/mixer, and /dev/mixer1).  this means that this patch
> changes the default behavior? 

Yes, the default behaviour is changed. The default config should be
adjusted as well to use /dev/mixer for in- and output. Sorry that I
forgot to do this.

Erik


From pgf at foxharp.boston.ma.us  Wed Aug 16 11:36:42 2006
From: pgf at foxharp.boston.ma.us (Paul Fox)
Date: Wed, 16 Aug 2006 13:36:42 -0400
Subject: [nas] [PATCH] use the mixer specified in the input section 
In-Reply-To: <20060816171448.GA32552@sushi.unix-ag.uni-kl.de> 
References: <20060816033604.GA1679@sushi.unix-ag.uni-kl.de> <4224.1155701553@foxharp.boston.ma.us> <20060816171448.GA32552@sushi.unix-ag.uni-kl.de>
Message-ID: <1405.1155749802@foxharp.boston.ma.us>

erik wrote:
 > Yes, the default behaviour is changed. The default config should be
 > adjusted as well to use /dev/mixer for in- and output. Sorry that I
 > forgot to do this.

i'm also concerned about people with pre-installed configs that
install a new nas daemon, and get surprising results.  but i
guess that's progress.  :-)

i'm sure jon will mention this change prominently in the changelog
and any announcement materials.

paul
=---------------------
 paul fox, pgf at foxharp.boston.ma.us (arlington, ma, where it's 74.8 degrees)


From auerswal at unix-ag.uni-kl.de  Wed Aug 16 12:26:20 2006
From: auerswal at unix-ag.uni-kl.de (Erik Auerswald)
Date: Wed, 16 Aug 2006 20:26:20 +0200
Subject: [nas] [PATCH] use the mixer specified in the input section
In-Reply-To: <1405.1155749802@foxharp.boston.ma.us>
References: <20060816033604.GA1679@sushi.unix-ag.uni-kl.de> <4224.1155701553@foxharp.boston.ma.us> <20060816171448.GA32552@sushi.unix-ag.uni-kl.de> <1405.1155749802@foxharp.boston.ma.us>
Message-ID: <20060816182620.GA4577@sushi.unix-ag.uni-kl.de>

Hi,

On Wed, Aug 16, 2006 at 01:36:42PM -0400, Paul Fox wrote:
> erik wrote:
>  > Yes, the default behaviour is changed. The default config should be
>  > adjusted as well to use /dev/mixer for in- and output. Sorry that I
>  > forgot to do this.
> 
> i'm also concerned about people with pre-installed configs that
> install a new nas daemon, and get surprising results.  but i
> guess that's progress.  :-)

Indeed, the current default of /dev/mixer1 is a bit problematic, because
it does not break any setup so the default and the example nasd.conf
file need not be changed to the real devices.

Attached is a second version of my patch that implements an _untested_
fallback for incorrect config files specifying a non-existant mixer
device in the input section. It's modelled after the equivalent
functionality to fall back from /dev/dsp1 to /dev/dsp.

I did not change the defaults in auvoxware.c because everyone without
/dev/mixer1 should have the old behaviour (via the fallback) and those
with /dev/mixer1 will get the "expected" behaviour (and debug messages
telling them what happens).

Please test this patch carefully, right now I can't reach my development
machine to do this myself.

> i'm sure jon will mention this change prominently in the changelog
> and any announcement materials.

I'm sure he will. :-)

Erik
-------------- next part --------------
Index: server/nasd.conf.man
===================================================================
--- server/nasd.conf.man	(revision 178)
+++ server/nasd.conf.man	(working copy)
@@ -17,7 +17,7 @@
 deals with global options, some of which just turn on verbose messages
 when parsing the config file, and setting debug messages on. The
 remaining two sections will, if present, adjust various parameters of
-the input and output devices, for those server that undersand them.
+the input and output devices, for those servers that understand them.
 .PP
 .B verbose
 Sets a flag telling the server to report what it's trying to do with each
@@ -55,6 +55,10 @@
 (headphone/speakers) or "INT" for the internal output device (internal
 speaker).  Defaults to external.
 .PP
+.B outputsection
+Marks the beginning of the output section, which allows various parameters
+of the output device to be set up.
+.PP
 .B inputsection
 Marks the beginning of the input section, which allows various parameters
 of the input device to be set up.
@@ -67,6 +71,8 @@
 .PP
 .B mixer "mixername"
 Specifies what mixer device is used. An example is \fBmixer "/dev/mixer"\fR.
+If \fBmixername\fR is set to the empty string \fB""\fR no mixer is used in
+this section.
 .PP
 .B gain number
 Specifies the default volume (0-100). The default is 50.
Index: server/dda/voxware/auvoxware.c
===================================================================
--- server/dda/voxware/auvoxware.c	(revision 178)
+++ server/dda/voxware/auvoxware.c	(working copy)
@@ -224,12 +224,13 @@
 static AuBool relinquish_device = 0;
 static AuBool leave_mixer = 0;
 static AuBool share_in_out = 0;
+static AuBool share_mixer = 0;
 
 static int recControlMode = 0;  /* how to control recording level */
-static int mixerfd = -1;        /* The mixer device */
+static int outmixerfd = -1;     /* The output device mixer device */
+static int inmixerfd = -1;      /* The input device mixer device */
 static int devmask = 0;         /* Bitmask for supported mixer devices */
 static int recmask = 0;         /* Supported recording sources */
-static int stereodevs = 0;      /* Channels supporting stereo */
 
 int VOXMixerInit = TRUE;        /* overridden by nasd.conf */
 int VOXReInitMixer = FALSE;     /* overridden by nasd.conf */
@@ -355,11 +356,11 @@
 {
     int pcm_level = 0;
 
-    if (mixerfd != -1) {
-        if (ioctl(mixerfd, MIXER_READ(SOUND_MIXER_PCM), &pcm_level) == -1) {
+    if (outmixerfd != -1) {
+        if (ioctl(outmixerfd, MIXER_READ(SOUND_MIXER_PCM), &pcm_level) == -1) {
             osLogMsg("readMixerOutputGain: "
                      "%s: ioctl(%d, MIXER_READ(SOUND_MIXER_PCM)) failed: %s\n",
-                     sndStatOut.mixer, mixerfd, strerror(errno));
+                     sndStatOut.mixer, outmixerfd, strerror(errno));
             return sndStatOut.gain;
         }
     } else {
@@ -379,11 +380,11 @@
 {
     int input_mode = 0;
 
-    if (mixerfd != -1) {
-        if (ioctl(mixerfd, MIXER_READ(SOUND_MIXER_RECSRC), &input_mode) == -1) {
+    if (inmixerfd != -1) {
+        if (ioctl(inmixerfd,MIXER_READ(SOUND_MIXER_RECSRC),&input_mode) == -1) {
             osLogMsg("readMixerInputMode: "
                      "%s: ioctl(%d, MIXER_READ(SOUND_MIXER_RECSRC)) failed: "
-                     "%s\n", sndStatOut.mixer, mixerfd, strerror(errno));
+                     "%s\n", sndStatIn.mixer, inmixerfd, strerror(errno));
             return 1<<SOUND_MIXER_LINE;
         }
         if (!(input_mode & (SOUND_MASK_MIC | SOUND_MIXER_LINE))) {
@@ -404,43 +405,43 @@
     
     recsrc = readMixerInputMode();
 
-    if (mixerfd != -1) {
+    if (inmixerfd != -1) {
         switch (recControlMode) {
         case useMixerIGain:
-            if (ioctl(mixerfd, MIXER_READ(SOUND_MIXER_IGAIN),&in_level) == -1) {
+            if (ioctl(inmixerfd,MIXER_READ(SOUND_MIXER_IGAIN),&in_level) == -1){
                 osLogMsg("readMixerInputGain: %s: "
                          "ioctl(MIXER_READ(SOUND_MIXER_IGAIN)) failed: %s\n",
-                         sndStatOut.mixer, strerror(errno));
+                         sndStatIn.mixer, strerror(errno));
                 return sndStatIn.gain;
             }
             break;
 
         case useMixerRecLev:
-            if (ioctl(mixerfd, MIXER_READ(SOUND_MIXER_RECLEV),&in_level) == -1){
+            if (ioctl(inmixerfd,MIXER_READ(SOUND_MIXER_RECLEV),&in_level)==-1) {
                 osLogMsg("readMixerInputGain: "
                          "%s: ioctl(%d, MIXER_READ(SOUND_MIXER_RECLEV)) failed:"
-                         " %s\n", sndStatOut.mixer, mixerfd, strerror(errno));
+                         " %s\n", sndStatIn.mixer, inmixerfd, strerror(errno));
                 return sndStatIn.gain;
             }
             break;
 
         case useMixerLineMic:
             if (recsrc & SOUND_MASK_LINE) {
-                if (ioctl(mixerfd, MIXER_READ(SOUND_MIXER_LINE), &in_level)
+                if (ioctl(inmixerfd, MIXER_READ(SOUND_MIXER_LINE), &in_level)
                     == -1) {
                     osLogMsg("readMixerInputGain: "
                              "%s: ioctl(%d, MIXER_READ(SOUND_MIXER_LINE)) "
                              "failed: %s\n",
-                             sndStatOut.mixer, mixerfd, strerror(errno));
+                             sndStatIn.mixer, inmixerfd, strerror(errno));
                     return sndStatIn.gain;
                 }
             } else if (recsrc & SOUND_MASK_MIC) {
-                if (ioctl(mixerfd, MIXER_READ(SOUND_MIXER_MIC), &in_level)
+                if (ioctl(inmixerfd, MIXER_READ(SOUND_MIXER_MIC), &in_level)
                     == -1) {
                     osLogMsg("readMixerInputGain: "
                              "%s: ioctl(%d, MIXER_READ(SOUND_MIXER_MIC)) "
                              "failed: %s\n",
-                             sndStatOut.mixer, mixerfd, strerror(errno));
+                             sndStatIn.mixer, inmixerfd, strerror(errno));
                     return sndStatIn.gain;
                 }
             } else {
@@ -752,11 +753,15 @@
               &(sndStatOut.curSampleRate));
         if (sndStatOut.forceRate)
             sndStatOut.curSampleRate = rate;
+        if (NasConfig.DoDebug)
+            osLogMsg("setSampleRate(): set output sample rate to %d\n",
+                     sndStatOut.curSampleRate);
     }
 
     if ((sndStatIn.fd == sndStatOut.fd) && (sndStatIn.fd != -1)) {
         sndStatIn = sndStatOut;
-        osLogMsg("setSampleRate(): setting sndStatIn = sndStatOut\n");
+        if (NasConfig.DoDebug)
+            osLogMsg("setSampleRate(): setting sndStatIn = sndStatOut\n");
     }
     else if (sndStatIn.curSampleRate != rate) {
         sndStatIn.curSampleRate = rate;
@@ -768,6 +773,9 @@
         ioctl(sndStatIn.fd, SNDCTL_DSP_SPEED, &(sndStatIn.curSampleRate));
         if (sndStatIn.forceRate)
             sndStatIn.curSampleRate = rate;
+        if (NasConfig.DoDebug)
+            osLogMsg("setSampleRate(): set input sample rate to %d\n",
+                     sndStatIn.curSampleRate);
     }
 #if defined(AUDIO_DRAIN)
     if (sndStatOut.isPCSpeaker)
@@ -790,6 +798,7 @@
 {
     unsigned int extramode = 0;
     int retries;
+    int curSampleRate;
 
     setTimer(0);                /* no timers here */
 #if defined(__CYGWIN__)         /* we want the file to be created if necc under
@@ -801,7 +810,15 @@
         osLogMsg("openDevice\n");
     }
 
+    curSampleRate = sndStatOut.curSampleRate;
     if (NasConfig.DoDebug) {
+        osLogMsg("openDevice: current sample rate = %d\n", curSampleRate);
+        if (sndStatOut.curSampleRate != sndStatIn.curSampleRate)
+            osLogMsg("openDevice: sndStatOut.curSampleRate !="
+                     " sndStatIn.curSampleRate\n");
+    }
+
+    if (NasConfig.DoDebug) {
         osLogMsg("openDevice OUT %s mode %d\n",
                  sndStatOut.device, sndStatOut.howToOpen);
     }
@@ -852,26 +869,58 @@
         }
     }
 
-    if (mixerfd == -1) {
-        while ((mixerfd = open(sndStatOut.mixer, O_RDWR | extramode,
-                               0666)) == -1 && wait) {
-            if ((errno == EAGAIN) || (errno == EBUSY)) {
-                osLogMsg("openDevice: waiting on mixer device %s\n",
-                         sndStatOut.mixer);
-                sleep(1);
-            } else {
-                osLogMsg("openDevice: could not open mixer device %s: %s\n",
-                         sndStatOut.mixer, strerror(errno));
-                break;
+    if (outmixerfd == -1) {
+        if (sndStatOut.mixer[0] == '\0') {
+            osLogMsg("openDevice: no output mixer device specified\n");
+        } else {
+            while ((outmixerfd = open(sndStatOut.mixer, O_RDWR | extramode,
+                                   0666)) == -1 && wait) {
+                if ((errno == EAGAIN) || (errno == EBUSY)) {
+                    osLogMsg("openDevice: waiting on mixer device %s\n",
+                             sndStatOut.mixer);
+                    sleep(1);
+                } else {
+                    osLogMsg("openDevice: could not open output mixer device"
+                             " %s: %s\n", sndStatOut.mixer, strerror(errno));
+                    break;
+                }
             }
+            if (outmixerfd != -1)
+                osLogMsg("openDevice: opened mixer %s\n", sndStatOut.mixer);
         }
-        if (mixerfd != -1)
-            osLogMsg("openDevice: opened mixer %s\n", sndStatOut.mixer);
     } else {
         if (NasConfig.DoDebug) {
-            osLogMsg("openDevice: mixer device already open\n");
+            osLogMsg("openDevice: output mixer device already open\n");
         }
     }
+
+    if ((inmixerfd == -1) && !share_mixer) {
+        if (sndStatIn.mixer[0] != '\0') {
+            osLogMsg("openDevice: no input mixer device specified\n");
+        } else {
+            while ((inmixerfd = open(sndStatIn.mixer, O_RDWR | extramode,
+                                   0666)) == -1 && wait) {
+                if ((errno == EAGAIN) || (errno == EBUSY)) {
+                    osLogMsg("openDevice: waiting on mixer device %s\n",
+                             sndStatIn.mixer);
+                    sleep(1);
+                } else {
+                    osLogMsg("openDevice: could not open input mixer device"
+                             " %s: %s\n", sndStatIn.mixer, strerror(errno));
+                    break;
+                }
+            }
+            if (inmixerfd != -1)
+                osLogMsg("openDevice: opened mixer %s\n", sndStatIn.mixer);
+        }
+    } else {
+        if (share_mixer) {
+            inmixerfd = outmixerfd;
+        }
+        if (NasConfig.DoDebug) {
+            osLogMsg("openDevice: input mixer device already open\n");
+        }
+    }
 #endif
 
     ioctl(sndStatOut.fd, SNDCTL_DSP_SYNC, NULL);
@@ -888,7 +937,7 @@
         if (sndStatOut.fd != sndStatIn.fd) {
             ioctl(sndStatIn.fd, SNDCTL_DSP_SYNC, NULL);
 #ifndef sco
-            rate = sndStatOut.curSampleRate;
+            rate = sndStatIn.curSampleRate;
             ioctl(sndStatIn.fd, SNDCTL_DSP_SPEED,
                   &sndStatIn.curSampleRate);
             if (sndStatIn.forceRate)
@@ -897,7 +946,7 @@
         }
     }
 
-    setSampleRate(sndStatIn.curSampleRate);
+    setSampleRate(curSampleRate);
 
     return AuTrue;
 }
@@ -949,21 +998,37 @@
 
     if (NasConfig.DoKeepMixer) {
         if (NasConfig.DoDebug) {
-            osLogMsg("closeDevice: leaving mixerdevice open\n");
+            osLogMsg("closeDevice: leaving mixer device(s) open\n");
         }
-    } else if (-1 == mixerfd) {
-        if (NasConfig.DoDebug) {
-            osLogMsg("closeDevice: mixerdevice already closed\n");
-        }
     } else {
-        while (close(mixerfd)) {
-            osLogMsg("closeDevice: waiting on mixer device\n");
-            sleep(1);
+        if (-1 == outmixerfd) {
+            if (NasConfig.DoDebug) {
+                osLogMsg("closeDevice: output mixer device already closed\n");
+            }
+        } else {
+            while (close(outmixerfd)) {
+                osLogMsg("closeDevice: waiting on output mixer device\n");
+                sleep(1);
+            }
+            if (NasConfig.DoDebug) {
+                osLogMsg("closeDevice: closed output mixer device\n");
+            }
+            outmixerfd = -1;
         }
-        if (NasConfig.DoDebug) {
-            osLogMsg("closeDevice: closed mixer device\n");
+        if (-1 == inmixerfd) {
+            if (NasConfig.DoDebug) {
+                osLogMsg("closeDevice: input mixer device already closed\n");
+            }
+        } else {
+            while (!share_mixer && close(inmixerfd)) {
+                osLogMsg("closeDevice: waiting on input mixer device\n");
+                sleep(1);
+            }
+            if (NasConfig.DoDebug) {
+                osLogMsg("closeDevice: closed input mixer device\n");
+            }
+            inmixerfd = -1;
         }
-        mixerfd = -1;
     }
 
     sndStatIn.fd = -1;
@@ -1080,8 +1145,8 @@
     }
 
     gusvolume = g | (g << 8);
-    if (mixerfd != -1)
-        if (ioctl(mixerfd, MIXER_WRITE(SOUND_MIXER_PCM), &gusvolume) == -1)
+    if (outmixerfd != -1)
+        if (ioctl(outmixerfd, MIXER_WRITE(SOUND_MIXER_PCM), &gusvolume) == -1)
             osLogMsg("setPhysicalOutputGain: "
                      "%s: ioctl(MIXER_WRITE(SOUND_MIXER_PCM)) failed: %s\n",
                      sndStatOut.mixer, strerror(errno));
@@ -1123,54 +1188,54 @@
 
     inputAttenuation = inputAttenuation << 8 | inputAttenuation;
 
-    if (mixerfd != -1) {
+    if (inmixerfd != -1) {
         switch (recControlMode) {
         case useMixerNone:
             break;
 
         case useMixerIGain:
             if (ioctl
-                (mixerfd, MIXER_WRITE(SOUND_MIXER_IGAIN),
+                (inmixerfd, MIXER_WRITE(SOUND_MIXER_IGAIN),
                  &inputAttenuation) == -1)
                 osLogMsg("setPhysicalInputGainAndLineMode: "
                          "%s: ioctl(MIXER_WRITE(SOUND_MIXER_IGAIN)) failed: "
-                         "%s\n", sndStatOut.mixer, strerror(errno));
+                         "%s\n", sndStatIn.mixer, strerror(errno));
             break;
 
         case useMixerRecLev:
             if (ioctl
-                (mixerfd, MIXER_WRITE(SOUND_MIXER_RECLEV),
+                (inmixerfd, MIXER_WRITE(SOUND_MIXER_RECLEV),
                  &inputAttenuation) == -1)
                 osLogMsg("setPhysicalInputGainAndLineMode: "
                          "%s: ioctl(MIXER_WRITE(SOUND_MIXER_RECLEV)) failed: "
-                         "%s\n", sndStatOut.mixer, strerror(errno));
+                         "%s\n", sndStatIn.mixer, strerror(errno));
             break;
 
         case useMixerLineMic:
             if (lineMode == AuDeviceLineModeHigh) {
-                if (ioctl(mixerfd, MIXER_WRITE(SOUND_MIXER_LINE), &zero) ==
+                if (ioctl(inmixerfd, MIXER_WRITE(SOUND_MIXER_LINE), &zero) ==
                     -1)
                     osLogMsg("setPhysicalInputGainAndLineMode: "
                              "%s: ioctl(MIXER_WRITE(SOUND_MIXER_LINE)) failed: "
-                             "%s\n", sndStatOut.mixer, strerror(errno));
+                             "%s\n", sndStatIn.mixer, strerror(errno));
                 if (ioctl
-                    (mixerfd, MIXER_WRITE(SOUND_MIXER_MIC),
+                    (inmixerfd, MIXER_WRITE(SOUND_MIXER_MIC),
                      &inputAttenuation) == -1)
                     osLogMsg("setPhysicalInputGainAndLineMode: "
                              "%s: ioctl(MIXER_WRITE(SOUND_MIXER_MIC)) failed: "
-                             "%s\n", sndStatOut.mixer, strerror(errno));
+                             "%s\n", sndStatIn.mixer, strerror(errno));
             } else if (lineMode == AuDeviceLineModeLow) {
                 if (ioctl
-                    (mixerfd, MIXER_WRITE(SOUND_MIXER_LINE),
+                    (inmixerfd, MIXER_WRITE(SOUND_MIXER_LINE),
                      &inputAttenuation) == -1)
                     osLogMsg("setPhysicalInputGainAndLineMode: "
                              "%s: ioctl(MIXER_WRITE(SOUND_MIXER_LINE)) failed: "
-                             "%s\n", sndStatOut.mixer, strerror(errno));
-                if (ioctl(mixerfd, MIXER_WRITE(SOUND_MIXER_MIC), &zero) ==
+                             "%s\n", sndStatIn.mixer, strerror(errno));
+                if (ioctl(inmixerfd, MIXER_WRITE(SOUND_MIXER_MIC), &zero) ==
                     -1)
                     osLogMsg("setPhysicalInputGainAndLineMode: "
                              "%s: ioctl(MIXER_WRITE(SOUND_MIXER_MIC)) failed: "
-                             "%s\n", sndStatOut.mixer, strerror(errno));
+                             "%s\n", sndStatIn.mixer, strerror(errno));
             }
             break;
 
@@ -1180,10 +1245,10 @@
             break;
         }
 
-        if (ioctl(mixerfd, MIXER_WRITE(SOUND_MIXER_RECSRC), &recsrc) == -1)
+        if (ioctl(inmixerfd, MIXER_WRITE(SOUND_MIXER_RECSRC), &recsrc) == -1)
             osLogMsg("setPhysicalInputGainAndLineMode: "
                      "%s: ioctl(MIXER_WRITE(SOUND_MIXER_RECSRC)) failed: %s\n",
-                     sndStatOut.mixer, strerror(errno));
+                     sndStatIn.mixer, strerror(errno));
     }
 }
 
@@ -1643,24 +1708,62 @@
     extramode = O_CREAT;
 #endif
 
-    if ((mixerfd = open(sndStatOut.mixer, O_RDWR | extramode,
-                        0666)) == -1) {
-        UNIDENTMSG;
-        osLogMsg("initMixer: could not open mixer device %s: %s\n",
-                 sndStatOut.mixer, strerror(errno));
-        return AuFalse;
+    /* open output mixer device */
+    if (sndStatOut.mixer[0] != '\0') {
+        if ((outmixerfd=open(sndStatOut.mixer, O_RDWR|extramode, 0666)) == -1) {
+            UNIDENTMSG;
+            osLogMsg("initMixer: could not open output mixer device %s: %s\n",
+                     sndStatOut.mixer, strerror(errno));
+            return AuFalse;
+        }
+        if (NasConfig.DoDebug)
+            osLogMsg("initMixer: opened output mixer device %s\n",
+                     sndStatOut.mixer, outmixerfd);
+    } else {
+        if (NasConfig.DoDebug)
+            osLogMsg("initMixer: no output mixer device specified\n");
     }
 
-    if (NasConfig.DoDebug)
-        osLogMsg("initMixer: opened mixer device %s\n",
-                 sndStatOut.mixer, mixerfd);
+    /* open input mixer device */
+    if (sndStatIn.mixer[0] != '\0') {
+        if (strcmp(sndStatIn.mixer, sndStatOut.mixer) != 0) {
+            if ((inmixerfd = open(sndStatIn.mixer, O_RDWR | extramode,
+                                0666)) == -1) {
+                UNIDENTMSG;
+                osLogMsg("initMixer: could not open input mixer device %s: %s\n"
+                         , sndStatIn.mixer, strerror(errno));
+                if (outmixerfd != -1) {
+                    osLogMsg("initMixer: using output mixer %s for input\n",
+                             sndStatOut.mixer);
+                    share_mixer = AuTrue;
+                    inmixerfd = outmixerfd;
+                } else {
+                    return AuFalse;
+                }
+            }
+        } else {
+            share_mixer = AuTrue;
+            inmixerfd = outmixerfd;
+            if (NasConfig.DoDebug)
+                osLogMsg("initMixer: using the same mixer device for"
+                         " in- and output\n");
+        }
+        if (NasConfig.DoDebug)
+            osLogMsg("initMixer: opened input mixer device %s\n",
+                     sndStatIn.mixer, inmixerfd);
+    } else {
+        if (NasConfig.DoDebug)
+            osLogMsg("initMixer: no input mixer device specified\n");
+        return AuTrue;
+    }
 
-    if (ioctl(mixerfd, SOUND_MIXER_READ_DEVMASK, &devmask) == -1) {
+    /* get recording devices of input mixer */
+    if (ioctl(inmixerfd, SOUND_MIXER_READ_DEVMASK, &devmask) == -1) {
         osLogMsg("initMixer: %s: ioctl(SOUND_MIXER_READ_DEVMASK) failed: %s\n",
-                 sndStatOut.mixer, strerror(errno));
-        osLogMsg("initMixer: closing mixer device\n");
-        close(mixerfd);
-        mixerfd = -1;
+                 sndStatIn.mixer, strerror(errno));
+        osLogMsg("initMixer: closing input mixer device\n");
+        close(inmixerfd);
+        inmixerfd = -1;
     } else {
         if (devmask & (1 << SOUND_MIXER_IGAIN)) {
             recControlMode = useMixerIGain;
@@ -1672,25 +1775,18 @@
         } else {
             recControlMode = useMixerNone;
             osLogMsg("initMixer: %s: can't control recording level\n",
-                     sndStatOut.mixer);
+                     sndStatIn.mixer);
         }
 
         if (NasConfig.DoDebug)
             osLogMsg("initMixer: %s: using recording level control method %d\n",
-                     sndStatOut.mixer, recControlMode);
+                     sndStatIn.mixer, recControlMode);
 
-        if (ioctl(mixerfd, SOUND_MIXER_READ_RECMASK, &recmask) == -1) {
+        if (ioctl(inmixerfd, SOUND_MIXER_READ_RECMASK, &recmask) == -1) {
             osLogMsg("initMixer: %s: ioctl(SOUND_MIXER_READ_RECMASK) failed: "
-                     "%s\n", sndStatOut.mixer, strerror(errno));
+                     "%s\n", sndStatIn.mixer, strerror(errno));
             return AuFalse;
         }
-
-        if (ioctl(mixerfd, SOUND_MIXER_READ_STEREODEVS, &stereodevs) == -1) {
-            UNIDENTMSG;
-            osLogMsg("initMixer: %s: ioctl(SOUND_MIXER_READ_STEREODEVS) failed:"
-                     " %s\n", sndStatOut.mixer, strerror(errno));
-            return AuFalse;
-        }
     }
     return AuTrue;
 }
@@ -1813,11 +1909,16 @@
         if (!sndStatOut.isPCSpeaker) {
             if (initMixer() == AuFalse) {
                 osLogMsg("Init: initMixer failed\n");
-                if (mixerfd != -1) {
-                    osLogMsg("Init: closing mixer devcie\n");
-                    close(mixerfd);
-                    mixerfd = -1;
+                if (outmixerfd != -1) {
+                    osLogMsg("Init: closing output mixer device\n");
+                    close(outmixerfd);
+                    outmixerfd = -1;
                 }
+                if (inmixerfd != -1) {
+                    osLogMsg("Init: closing input mixer device\n");
+                    close(inmixerfd);
+                    inmixerfd = -1;
+                }
             } else {
                 if (NasConfig.DoDebug)
                     osLogMsg("Init: initMixer was successful\n");

From auerswal at unix-ag.uni-kl.de  Wed Aug 16 16:00:52 2006
From: auerswal at unix-ag.uni-kl.de (Erik Auerswald)
Date: Thu, 17 Aug 2006 00:00:52 +0200
Subject: [nas] [PATCH] use the mixer specified in the input section
In-Reply-To: <20060816182620.GA4577@sushi.unix-ag.uni-kl.de>
References: <20060816033604.GA1679@sushi.unix-ag.uni-kl.de> <4224.1155701553@foxharp.boston.ma.us> <20060816171448.GA32552@sushi.unix-ag.uni-kl.de> <1405.1155749802@foxharp.boston.ma.us> <20060816182620.GA4577@sushi.unix-ag.uni-kl.de>
Message-ID: <20060816220052.GA28389@sushi.unix-ag.uni-kl.de>

Hi,

On Wed, Aug 16, 2006 at 08:26:20PM +0200, Erik Auerswald wrote:
> On Wed, Aug 16, 2006 at 01:36:42PM -0400, Paul Fox wrote:
> > erik wrote:
> >  > Yes, the default behaviour is changed. The default config should be
> >  > adjusted as well to use /dev/mixer for in- and output. Sorry that I
> >  > forgot to do this.
> > 
> > i'm also concerned about people with pre-installed configs that
> > install a new nas daemon, and get surprising results.  but i
> > guess that's progress.  :-)
> 
> Attached is a second version of my patch that implements an _untested_
> fallback for incorrect config files specifying a non-existant mixer
> device in the input section. It's modelled after the equivalent
> functionality to fall back from /dev/dsp1 to /dev/dsp.

I've just tested that patch and updated it to report the correct mixer
device name after switching to the shared device case. See the
attachement.

Erik
-------------- next part --------------
Index: server/nasd.conf.man
===================================================================
--- server/nasd.conf.man	(revision 178)
+++ server/nasd.conf.man	(working copy)
@@ -17,7 +17,7 @@
 deals with global options, some of which just turn on verbose messages
 when parsing the config file, and setting debug messages on. The
 remaining two sections will, if present, adjust various parameters of
-the input and output devices, for those server that undersand them.
+the input and output devices, for those servers that understand them.
 .PP
 .B verbose
 Sets a flag telling the server to report what it's trying to do with each
@@ -55,6 +55,10 @@
 (headphone/speakers) or "INT" for the internal output device (internal
 speaker).  Defaults to external.
 .PP
+.B outputsection
+Marks the beginning of the output section, which allows various parameters
+of the output device to be set up.
+.PP
 .B inputsection
 Marks the beginning of the input section, which allows various parameters
 of the input device to be set up.
@@ -67,6 +71,8 @@
 .PP
 .B mixer "mixername"
 Specifies what mixer device is used. An example is \fBmixer "/dev/mixer"\fR.
+If \fBmixername\fR is set to the empty string \fB""\fR no mixer is used in
+this section.
 .PP
 .B gain number
 Specifies the default volume (0-100). The default is 50.
Index: server/dda/voxware/auvoxware.c
===================================================================
--- server/dda/voxware/auvoxware.c	(revision 178)
+++ server/dda/voxware/auvoxware.c	(working copy)
@@ -224,12 +224,13 @@
 static AuBool relinquish_device = 0;
 static AuBool leave_mixer = 0;
 static AuBool share_in_out = 0;
+static AuBool share_mixer = 0;
 
 static int recControlMode = 0;  /* how to control recording level */
-static int mixerfd = -1;        /* The mixer device */
+static int outmixerfd = -1;     /* The output device mixer device */
+static int inmixerfd = -1;      /* The input device mixer device */
 static int devmask = 0;         /* Bitmask for supported mixer devices */
 static int recmask = 0;         /* Supported recording sources */
-static int stereodevs = 0;      /* Channels supporting stereo */
 
 int VOXMixerInit = TRUE;        /* overridden by nasd.conf */
 int VOXReInitMixer = FALSE;     /* overridden by nasd.conf */
@@ -355,11 +356,11 @@
 {
     int pcm_level = 0;
 
-    if (mixerfd != -1) {
-        if (ioctl(mixerfd, MIXER_READ(SOUND_MIXER_PCM), &pcm_level) == -1) {
+    if (outmixerfd != -1) {
+        if (ioctl(outmixerfd, MIXER_READ(SOUND_MIXER_PCM), &pcm_level) == -1) {
             osLogMsg("readMixerOutputGain: "
                      "%s: ioctl(%d, MIXER_READ(SOUND_MIXER_PCM)) failed: %s\n",
-                     sndStatOut.mixer, mixerfd, strerror(errno));
+                     sndStatOut.mixer, outmixerfd, strerror(errno));
             return sndStatOut.gain;
         }
     } else {
@@ -379,11 +380,11 @@
 {
     int input_mode = 0;
 
-    if (mixerfd != -1) {
-        if (ioctl(mixerfd, MIXER_READ(SOUND_MIXER_RECSRC), &input_mode) == -1) {
+    if (inmixerfd != -1) {
+        if (ioctl(inmixerfd,MIXER_READ(SOUND_MIXER_RECSRC),&input_mode) == -1) {
             osLogMsg("readMixerInputMode: "
                      "%s: ioctl(%d, MIXER_READ(SOUND_MIXER_RECSRC)) failed: "
-                     "%s\n", sndStatOut.mixer, mixerfd, strerror(errno));
+                     "%s\n", sndStatIn.mixer, inmixerfd, strerror(errno));
             return 1<<SOUND_MIXER_LINE;
         }
         if (!(input_mode & (SOUND_MASK_MIC | SOUND_MIXER_LINE))) {
@@ -404,43 +405,43 @@
     
     recsrc = readMixerInputMode();
 
-    if (mixerfd != -1) {
+    if (inmixerfd != -1) {
         switch (recControlMode) {
         case useMixerIGain:
-            if (ioctl(mixerfd, MIXER_READ(SOUND_MIXER_IGAIN),&in_level) == -1) {
+            if (ioctl(inmixerfd,MIXER_READ(SOUND_MIXER_IGAIN),&in_level) == -1){
                 osLogMsg("readMixerInputGain: %s: "
                          "ioctl(MIXER_READ(SOUND_MIXER_IGAIN)) failed: %s\n",
-                         sndStatOut.mixer, strerror(errno));
+                         sndStatIn.mixer, strerror(errno));
                 return sndStatIn.gain;
             }
             break;
 
         case useMixerRecLev:
-            if (ioctl(mixerfd, MIXER_READ(SOUND_MIXER_RECLEV),&in_level) == -1){
+            if (ioctl(inmixerfd,MIXER_READ(SOUND_MIXER_RECLEV),&in_level)==-1) {
                 osLogMsg("readMixerInputGain: "
                          "%s: ioctl(%d, MIXER_READ(SOUND_MIXER_RECLEV)) failed:"
-                         " %s\n", sndStatOut.mixer, mixerfd, strerror(errno));
+                         " %s\n", sndStatIn.mixer, inmixerfd, strerror(errno));
                 return sndStatIn.gain;
             }
             break;
 
         case useMixerLineMic:
             if (recsrc & SOUND_MASK_LINE) {
-                if (ioctl(mixerfd, MIXER_READ(SOUND_MIXER_LINE), &in_level)
+                if (ioctl(inmixerfd, MIXER_READ(SOUND_MIXER_LINE), &in_level)
                     == -1) {
                     osLogMsg("readMixerInputGain: "
                              "%s: ioctl(%d, MIXER_READ(SOUND_MIXER_LINE)) "
                              "failed: %s\n",
-                             sndStatOut.mixer, mixerfd, strerror(errno));
+                             sndStatIn.mixer, inmixerfd, strerror(errno));
                     return sndStatIn.gain;
                 }
             } else if (recsrc & SOUND_MASK_MIC) {
-                if (ioctl(mixerfd, MIXER_READ(SOUND_MIXER_MIC), &in_level)
+                if (ioctl(inmixerfd, MIXER_READ(SOUND_MIXER_MIC), &in_level)
                     == -1) {
                     osLogMsg("readMixerInputGain: "
                              "%s: ioctl(%d, MIXER_READ(SOUND_MIXER_MIC)) "
                              "failed: %s\n",
-                             sndStatOut.mixer, mixerfd, strerror(errno));
+                             sndStatIn.mixer, inmixerfd, strerror(errno));
                     return sndStatIn.gain;
                 }
             } else {
@@ -752,11 +753,15 @@
               &(sndStatOut.curSampleRate));
         if (sndStatOut.forceRate)
             sndStatOut.curSampleRate = rate;
+        if (NasConfig.DoDebug)
+            osLogMsg("setSampleRate(): set output sample rate to %d\n",
+                     sndStatOut.curSampleRate);
     }
 
     if ((sndStatIn.fd == sndStatOut.fd) && (sndStatIn.fd != -1)) {
         sndStatIn = sndStatOut;
-        osLogMsg("setSampleRate(): setting sndStatIn = sndStatOut\n");
+        if (NasConfig.DoDebug)
+            osLogMsg("setSampleRate(): setting sndStatIn = sndStatOut\n");
     }
     else if (sndStatIn.curSampleRate != rate) {
         sndStatIn.curSampleRate = rate;
@@ -768,6 +773,9 @@
         ioctl(sndStatIn.fd, SNDCTL_DSP_SPEED, &(sndStatIn.curSampleRate));
         if (sndStatIn.forceRate)
             sndStatIn.curSampleRate = rate;
+        if (NasConfig.DoDebug)
+            osLogMsg("setSampleRate(): set input sample rate to %d\n",
+                     sndStatIn.curSampleRate);
     }
 #if defined(AUDIO_DRAIN)
     if (sndStatOut.isPCSpeaker)
@@ -790,6 +798,7 @@
 {
     unsigned int extramode = 0;
     int retries;
+    int curSampleRate;
 
     setTimer(0);                /* no timers here */
 #if defined(__CYGWIN__)         /* we want the file to be created if necc under
@@ -801,7 +810,15 @@
         osLogMsg("openDevice\n");
     }
 
+    curSampleRate = sndStatOut.curSampleRate;
     if (NasConfig.DoDebug) {
+        osLogMsg("openDevice: current sample rate = %d\n", curSampleRate);
+        if (sndStatOut.curSampleRate != sndStatIn.curSampleRate)
+            osLogMsg("openDevice: sndStatOut.curSampleRate !="
+                     " sndStatIn.curSampleRate\n");
+    }
+
+    if (NasConfig.DoDebug) {
         osLogMsg("openDevice OUT %s mode %d\n",
                  sndStatOut.device, sndStatOut.howToOpen);
     }
@@ -852,26 +869,58 @@
         }
     }
 
-    if (mixerfd == -1) {
-        while ((mixerfd = open(sndStatOut.mixer, O_RDWR | extramode,
-                               0666)) == -1 && wait) {
-            if ((errno == EAGAIN) || (errno == EBUSY)) {
-                osLogMsg("openDevice: waiting on mixer device %s\n",
-                         sndStatOut.mixer);
-                sleep(1);
-            } else {
-                osLogMsg("openDevice: could not open mixer device %s: %s\n",
-                         sndStatOut.mixer, strerror(errno));
-                break;
+    if (outmixerfd == -1) {
+        if (sndStatOut.mixer[0] == '\0') {
+            osLogMsg("openDevice: no output mixer device specified\n");
+        } else {
+            while ((outmixerfd = open(sndStatOut.mixer, O_RDWR | extramode,
+                                   0666)) == -1 && wait) {
+                if ((errno == EAGAIN) || (errno == EBUSY)) {
+                    osLogMsg("openDevice: waiting on mixer device %s\n",
+                             sndStatOut.mixer);
+                    sleep(1);
+                } else {
+                    osLogMsg("openDevice: could not open output mixer device"
+                             " %s: %s\n", sndStatOut.mixer, strerror(errno));
+                    break;
+                }
             }
+            if (outmixerfd != -1)
+                osLogMsg("openDevice: opened mixer %s\n", sndStatOut.mixer);
         }
-        if (mixerfd != -1)
-            osLogMsg("openDevice: opened mixer %s\n", sndStatOut.mixer);
     } else {
         if (NasConfig.DoDebug) {
-            osLogMsg("openDevice: mixer device already open\n");
+            osLogMsg("openDevice: output mixer device already open\n");
         }
     }
+
+    if ((inmixerfd == -1) && !share_mixer) {
+        if (sndStatIn.mixer[0] != '\0') {
+            osLogMsg("openDevice: no input mixer device specified\n");
+        } else {
+            while ((inmixerfd = open(sndStatIn.mixer, O_RDWR | extramode,
+                                   0666)) == -1 && wait) {
+                if ((errno == EAGAIN) || (errno == EBUSY)) {
+                    osLogMsg("openDevice: waiting on mixer device %s\n",
+                             sndStatIn.mixer);
+                    sleep(1);
+                } else {
+                    osLogMsg("openDevice: could not open input mixer device"
+                             " %s: %s\n", sndStatIn.mixer, strerror(errno));
+                    break;
+                }
+            }
+            if (inmixerfd != -1)
+                osLogMsg("openDevice: opened mixer %s\n", sndStatIn.mixer);
+        }
+    } else {
+        if (share_mixer) {
+            inmixerfd = outmixerfd;
+        }
+        if (NasConfig.DoDebug) {
+            osLogMsg("openDevice: input mixer device already open\n");
+        }
+    }
 #endif
 
     ioctl(sndStatOut.fd, SNDCTL_DSP_SYNC, NULL);
@@ -888,7 +937,7 @@
         if (sndStatOut.fd != sndStatIn.fd) {
             ioctl(sndStatIn.fd, SNDCTL_DSP_SYNC, NULL);
 #ifndef sco
-            rate = sndStatOut.curSampleRate;
+            rate = sndStatIn.curSampleRate;
             ioctl(sndStatIn.fd, SNDCTL_DSP_SPEED,
                   &sndStatIn.curSampleRate);
             if (sndStatIn.forceRate)
@@ -897,7 +946,7 @@
         }
     }
 
-    setSampleRate(sndStatIn.curSampleRate);
+    setSampleRate(curSampleRate);
 
     return AuTrue;
 }
@@ -949,21 +998,37 @@
 
     if (NasConfig.DoKeepMixer) {
         if (NasConfig.DoDebug) {
-            osLogMsg("closeDevice: leaving mixerdevice open\n");
+            osLogMsg("closeDevice: leaving mixer device(s) open\n");
         }
-    } else if (-1 == mixerfd) {
-        if (NasConfig.DoDebug) {
-            osLogMsg("closeDevice: mixerdevice already closed\n");
-        }
     } else {
-        while (close(mixerfd)) {
-            osLogMsg("closeDevice: waiting on mixer device\n");
-            sleep(1);
+        if (-1 == outmixerfd) {
+            if (NasConfig.DoDebug) {
+                osLogMsg("closeDevice: output mixer device already closed\n");
+            }
+        } else {
+            while (close(outmixerfd)) {
+                osLogMsg("closeDevice: waiting on output mixer device\n");
+                sleep(1);
+            }
+            if (NasConfig.DoDebug) {
+                osLogMsg("closeDevice: closed output mixer device\n");
+            }
+            outmixerfd = -1;
         }
-        if (NasConfig.DoDebug) {
-            osLogMsg("closeDevice: closed mixer device\n");
+        if (-1 == inmixerfd) {
+            if (NasConfig.DoDebug) {
+                osLogMsg("closeDevice: input mixer device already closed\n");
+            }
+        } else {
+            while (!share_mixer && close(inmixerfd)) {
+                osLogMsg("closeDevice: waiting on input mixer device\n");
+                sleep(1);
+            }
+            if (NasConfig.DoDebug) {
+                osLogMsg("closeDevice: closed input mixer device\n");
+            }
+            inmixerfd = -1;
         }
-        mixerfd = -1;
     }
 
     sndStatIn.fd = -1;
@@ -1080,8 +1145,8 @@
     }
 
     gusvolume = g | (g << 8);
-    if (mixerfd != -1)
-        if (ioctl(mixerfd, MIXER_WRITE(SOUND_MIXER_PCM), &gusvolume) == -1)
+    if (outmixerfd != -1)
+        if (ioctl(outmixerfd, MIXER_WRITE(SOUND_MIXER_PCM), &gusvolume) == -1)
             osLogMsg("setPhysicalOutputGain: "
                      "%s: ioctl(MIXER_WRITE(SOUND_MIXER_PCM)) failed: %s\n",
                      sndStatOut.mixer, strerror(errno));
@@ -1123,54 +1188,54 @@
 
     inputAttenuation = inputAttenuation << 8 | inputAttenuation;
 
-    if (mixerfd != -1) {
+    if (inmixerfd != -1) {
         switch (recControlMode) {
         case useMixerNone:
             break;
 
         case useMixerIGain:
             if (ioctl
-                (mixerfd, MIXER_WRITE(SOUND_MIXER_IGAIN),
+                (inmixerfd, MIXER_WRITE(SOUND_MIXER_IGAIN),
                  &inputAttenuation) == -1)
                 osLogMsg("setPhysicalInputGainAndLineMode: "
                          "%s: ioctl(MIXER_WRITE(SOUND_MIXER_IGAIN)) failed: "
-                         "%s\n", sndStatOut.mixer, strerror(errno));
+                         "%s\n", sndStatIn.mixer, strerror(errno));
             break;
 
         case useMixerRecLev:
             if (ioctl
-                (mixerfd, MIXER_WRITE(SOUND_MIXER_RECLEV),
+                (inmixerfd, MIXER_WRITE(SOUND_MIXER_RECLEV),
                  &inputAttenuation) == -1)
                 osLogMsg("setPhysicalInputGainAndLineMode: "
                          "%s: ioctl(MIXER_WRITE(SOUND_MIXER_RECLEV)) failed: "
-                         "%s\n", sndStatOut.mixer, strerror(errno));
+                         "%s\n", sndStatIn.mixer, strerror(errno));
             break;
 
         case useMixerLineMic:
             if (lineMode == AuDeviceLineModeHigh) {
-                if (ioctl(mixerfd, MIXER_WRITE(SOUND_MIXER_LINE), &zero) ==
+                if (ioctl(inmixerfd, MIXER_WRITE(SOUND_MIXER_LINE), &zero) ==
                     -1)
                     osLogMsg("setPhysicalInputGainAndLineMode: "
                              "%s: ioctl(MIXER_WRITE(SOUND_MIXER_LINE)) failed: "
-                             "%s\n", sndStatOut.mixer, strerror(errno));
+                             "%s\n", sndStatIn.mixer, strerror(errno));
                 if (ioctl
-                    (mixerfd, MIXER_WRITE(SOUND_MIXER_MIC),
+                    (inmixerfd, MIXER_WRITE(SOUND_MIXER_MIC),
                      &inputAttenuation) == -1)
                     osLogMsg("setPhysicalInputGainAndLineMode: "
                              "%s: ioctl(MIXER_WRITE(SOUND_MIXER_MIC)) failed: "
-                             "%s\n", sndStatOut.mixer, strerror(errno));
+                             "%s\n", sndStatIn.mixer, strerror(errno));
             } else if (lineMode == AuDeviceLineModeLow) {
                 if (ioctl
-                    (mixerfd, MIXER_WRITE(SOUND_MIXER_LINE),
+                    (inmixerfd, MIXER_WRITE(SOUND_MIXER_LINE),
                      &inputAttenuation) == -1)
                     osLogMsg("setPhysicalInputGainAndLineMode: "
                              "%s: ioctl(MIXER_WRITE(SOUND_MIXER_LINE)) failed: "
-                             "%s\n", sndStatOut.mixer, strerror(errno));
-                if (ioctl(mixerfd, MIXER_WRITE(SOUND_MIXER_MIC), &zero) ==
+                             "%s\n", sndStatIn.mixer, strerror(errno));
+                if (ioctl(inmixerfd, MIXER_WRITE(SOUND_MIXER_MIC), &zero) ==
                     -1)
                     osLogMsg("setPhysicalInputGainAndLineMode: "
                              "%s: ioctl(MIXER_WRITE(SOUND_MIXER_MIC)) failed: "
-                             "%s\n", sndStatOut.mixer, strerror(errno));
+                             "%s\n", sndStatIn.mixer, strerror(errno));
             }
             break;
 
@@ -1180,10 +1245,10 @@
             break;
         }
 
-        if (ioctl(mixerfd, MIXER_WRITE(SOUND_MIXER_RECSRC), &recsrc) == -1)
+        if (ioctl(inmixerfd, MIXER_WRITE(SOUND_MIXER_RECSRC), &recsrc) == -1)
             osLogMsg("setPhysicalInputGainAndLineMode: "
                      "%s: ioctl(MIXER_WRITE(SOUND_MIXER_RECSRC)) failed: %s\n",
-                     sndStatOut.mixer, strerror(errno));
+                     sndStatIn.mixer, strerror(errno));
     }
 }
 
@@ -1643,24 +1708,64 @@
     extramode = O_CREAT;
 #endif
 
-    if ((mixerfd = open(sndStatOut.mixer, O_RDWR | extramode,
-                        0666)) == -1) {
-        UNIDENTMSG;
-        osLogMsg("initMixer: could not open mixer device %s: %s\n",
-                 sndStatOut.mixer, strerror(errno));
-        return AuFalse;
+    /* open output mixer device */
+    if (sndStatOut.mixer[0] != '\0') {
+        if ((outmixerfd=open(sndStatOut.mixer, O_RDWR|extramode, 0666)) == -1) {
+            UNIDENTMSG;
+            osLogMsg("initMixer: could not open output mixer device %s: %s\n",
+                     sndStatOut.mixer, strerror(errno));
+            return AuFalse;
+        }
+        if (NasConfig.DoDebug)
+            osLogMsg("initMixer: opened output mixer device %s\n",
+                     sndStatOut.mixer, outmixerfd);
+    } else {
+        if (NasConfig.DoDebug)
+            osLogMsg("initMixer: no output mixer device specified\n");
     }
 
-    if (NasConfig.DoDebug)
-        osLogMsg("initMixer: opened mixer device %s\n",
-                 sndStatOut.mixer, mixerfd);
+    /* open input mixer device */
+    if (sndStatIn.mixer[0] != '\0') {
+        if (strcmp(sndStatIn.mixer, sndStatOut.mixer) != 0) {
+            if ((inmixerfd = open(sndStatIn.mixer, O_RDWR | extramode,
+                                0666)) == -1) {
+                UNIDENTMSG;
+                osLogMsg("initMixer: could not open input mixer device %s: %s\n"
+                         , sndStatIn.mixer, strerror(errno));
+                if (outmixerfd != -1) {
+                    osLogMsg("initMixer: using output mixer %s for input\n",
+                             sndStatOut.mixer);
+                    share_mixer = AuTrue;
+                    inmixerfd = outmixerfd;
+                    sndStatIn.mixer = sndStatOut.mixer;
+                } else {
+                    return AuFalse;
+                }
+            }
+        } else {
+            share_mixer = AuTrue;
+            inmixerfd = outmixerfd;
+            sndStatIn.mixer = sndStatOut.mixer;
+            if (NasConfig.DoDebug)
+                osLogMsg("initMixer: using the same mixer device for"
+                         " in- and output\n");
+        }
+        if (NasConfig.DoDebug)
+            osLogMsg("initMixer: opened input mixer device %s\n",
+                     sndStatIn.mixer, inmixerfd);
+    } else {
+        if (NasConfig.DoDebug)
+            osLogMsg("initMixer: no input mixer device specified\n");
+        return AuTrue;
+    }
 
-    if (ioctl(mixerfd, SOUND_MIXER_READ_DEVMASK, &devmask) == -1) {
+    /* get recording devices of input mixer */
+    if (ioctl(inmixerfd, SOUND_MIXER_READ_DEVMASK, &devmask) == -1) {
         osLogMsg("initMixer: %s: ioctl(SOUND_MIXER_READ_DEVMASK) failed: %s\n",
-                 sndStatOut.mixer, strerror(errno));
-        osLogMsg("initMixer: closing mixer device\n");
-        close(mixerfd);
-        mixerfd = -1;
+                 sndStatIn.mixer, strerror(errno));
+        osLogMsg("initMixer: closing input mixer device\n");
+        close(inmixerfd);
+        inmixerfd = -1;
     } else {
         if (devmask & (1 << SOUND_MIXER_IGAIN)) {
             recControlMode = useMixerIGain;
@@ -1672,25 +1777,18 @@
         } else {
             recControlMode = useMixerNone;
             osLogMsg("initMixer: %s: can't control recording level\n",
-                     sndStatOut.mixer);
+                     sndStatIn.mixer);
         }
 
         if (NasConfig.DoDebug)
             osLogMsg("initMixer: %s: using recording level control method %d\n",
-                     sndStatOut.mixer, recControlMode);
+                     sndStatIn.mixer, recControlMode);
 
-        if (ioctl(mixerfd, SOUND_MIXER_READ_RECMASK, &recmask) == -1) {
+        if (ioctl(inmixerfd, SOUND_MIXER_READ_RECMASK, &recmask) == -1) {
             osLogMsg("initMixer: %s: ioctl(SOUND_MIXER_READ_RECMASK) failed: "
-                     "%s\n", sndStatOut.mixer, strerror(errno));
+                     "%s\n", sndStatIn.mixer, strerror(errno));
             return AuFalse;
         }
-
-        if (ioctl(mixerfd, SOUND_MIXER_READ_STEREODEVS, &stereodevs) == -1) {
-            UNIDENTMSG;
-            osLogMsg("initMixer: %s: ioctl(SOUND_MIXER_READ_STEREODEVS) failed:"
-                     " %s\n", sndStatOut.mixer, strerror(errno));
-            return AuFalse;
-        }
     }
     return AuTrue;
 }
@@ -1813,11 +1911,16 @@
         if (!sndStatOut.isPCSpeaker) {
             if (initMixer() == AuFalse) {
                 osLogMsg("Init: initMixer failed\n");
-                if (mixerfd != -1) {
-                    osLogMsg("Init: closing mixer devcie\n");
-                    close(mixerfd);
-                    mixerfd = -1;
+                if (outmixerfd != -1) {
+                    osLogMsg("Init: closing output mixer device\n");
+                    close(outmixerfd);
+                    outmixerfd = -1;
                 }
+                if (inmixerfd != -1) {
+                    osLogMsg("Init: closing input mixer device\n");
+                    close(inmixerfd);
+                    inmixerfd = -1;
+                }
             } else {
                 if (NasConfig.DoDebug)
                     osLogMsg("Init: initMixer was successful\n");

From jon at radscan.com  Wed Aug 16 19:20:11 2006
From: jon at radscan.com (Jon Trulson)
Date: Wed, 16 Aug 2006 19:20:11 -0600 (MDT)
Subject: [nas] [PATCH] use the mixer specified in the input section
In-Reply-To: <20060816220052.GA28389@sushi.unix-ag.uni-kl.de>
References: <20060816033604.GA1679@sushi.unix-ag.uni-kl.de>
 <4224.1155701553@foxharp.boston.ma.us> <20060816171448.GA32552@sushi.unix-ag.uni-kl.de>
 <1405.1155749802@foxharp.boston.ma.us> <20060816182620.GA4577@sushi.unix-ag.uni-kl.de>
 <20060816220052.GA28389@sushi.unix-ag.uni-kl.de>
Message-ID: <Pine.LNX.4.61.0608161907210.10619@m5.radscan.com>

On Thu, 17 Aug 2006, Erik Auerswald wrote:

> Hi,
>
> On Wed, Aug 16, 2006 at 08:26:20PM +0200, Erik Auerswald wrote:
>> On Wed, Aug 16, 2006 at 01:36:42PM -0400, Paul Fox wrote:
>>> erik wrote:
>>> > Yes, the default behaviour is changed. The default config should be
>>> > adjusted as well to use /dev/mixer for in- and output. Sorry that I
>>> > forgot to do this.
>>>
>>> i'm also concerned about people with pre-installed configs that
>>> install a new nas daemon, and get surprising results.  but i
>>> guess that's progress.  :-)
>>
>> Attached is a second version of my patch that implements an _untested_
>> fallback for incorrect config files specifying a non-existant mixer
>> device in the input section. It's modelled after the equivalent
>> functionality to fall back from /dev/dsp1 to /dev/dsp.
>
> I've just tested that patch and updated it to report the correct mixer
> device name after switching to the shared device case. See the
> attachement.
>
> Erik
>

         Ok, I've committed this patch.  Nice work! :)

         I do not have an input device to test with, but it worked just
         fine on my setup - I noticed no ill behavior.

         FWIW, this is the output I get (pretty much default config on
         an SB PCI using alsa oss emulation):

         ...
         initMixer: opened output mixer device /dev/mixer
         initMixer: opened input mixer device /dev/mixer1
         initMixer: /dev/mixer1: using recording level control method 1
         Init: initMixer was successful
         ...

         Here is some suggested wording for a Note/Warning regarding
         the possible changed behavior.  To be honest, I doubt it will
         be an issue for anyone, other than the fact that input works a
         heck of a lot better than 2 months ago :)

             NOTE: Prior to this patch, the mixer device parameter for
                   the input section was completely ignored.  The
                   default value for this ignored parameter was
                   "/dev/mixer1".

                   With this patch, this parameter is honored.  If your
                   configuration depends on the input mixer being the
                   same as the output mixer, you will need to edit your
                   /etc/nas/nasd.conf and set the mixer parameter in
                   the inputsection to '/dev/mixer', or to whatever
                   mixer device your outputsection is using.

                   If your system contains a /dev/mixer1 device (the
                   default input mixer device), nasd will now use it.
                   This is a good thing. :)


-- 
Jon Trulson
mailto:jon at radscan.com http://radscan.com/~jon
#include <std/disclaimer.h>
"No Kill I" -Horta



From auerswal at unix-ag.uni-kl.de  Wed Aug 16 20:01:57 2006
From: auerswal at unix-ag.uni-kl.de (Erik Auerswald)
Date: Thu, 17 Aug 2006 04:01:57 +0200
Subject: [nas] [PATCH] use the mixer specified in the input section
In-Reply-To: <Pine.LNX.4.61.0608161907210.10619@m5.radscan.com>
References: <20060816033604.GA1679@sushi.unix-ag.uni-kl.de> <4224.1155701553@foxharp.boston.ma.us> <20060816171448.GA32552@sushi.unix-ag.uni-kl.de> <1405.1155749802@foxharp.boston.ma.us> <20060816182620.GA4577@sushi.unix-ag.uni-kl.de> <20060816220052.GA28389@sushi.unix-ag.uni-kl.de> <Pine.LNX.4.61.0608161907210.10619@m5.radscan.com>
Message-ID: <20060817020157.GA2863@sushi.unix-ag.uni-kl.de>

Hi,

On Wed, Aug 16, 2006 at 07:20:11PM -0600, Jon Trulson wrote:
> On Thu, 17 Aug 2006, Erik Auerswald wrote:
> >On Wed, Aug 16, 2006 at 08:26:20PM +0200, Erik Auerswald wrote:
> >>On Wed, Aug 16, 2006 at 01:36:42PM -0400, Paul Fox wrote:
> >>>erik wrote:
> >>>> Yes, the default behaviour is changed. The default config should be
> >>>> adjusted as well to use /dev/mixer for in- and output. Sorry that I
> >>>> forgot to do this.
> >>>
> >>>i'm also concerned about people with pre-installed configs that
> >>>install a new nas daemon, and get surprising results.  but i
> >>>guess that's progress.  :-)
> >>
> >>Attached is a second version of my patch that implements an _untested_
> >>fallback for incorrect config files specifying a non-existant mixer
> >>device in the input section. It's modelled after the equivalent
> >>functionality to fall back from /dev/dsp1 to /dev/dsp.
> >
> >I've just tested that patch and updated it to report the correct mixer
> >device name after switching to the shared device case. See the
> >attachement.
> 
>         Ok, I've committed this patch.  Nice work! :)

Thanks.

>         I do not have an input device to test with, but it worked just
>         fine on my setup - I noticed no ill behavior.

Good.

>         FWIW, this is the output I get (pretty much default config on
>         an SB PCI using alsa oss emulation):
> 
>         ...
>         initMixer: opened output mixer device /dev/mixer
>         initMixer: opened input mixer device /dev/mixer1
>         initMixer: /dev/mixer1: using recording level control method 1
>         Init: initMixer was successful
>         ...

This means that there are 2 mixer devices. According to the ALSA
documentation this means that there are 2 sound "cards" configured. If
you were to use the input jack of your SB PCI you would probably not be
able to record anything with NAS.

To check the ALSA configuration you can do a "cat /proc/asound/cards",
which produces the following output on my machine:

[erik at fal ~]$ cat /proc/asound/cards
0 [CK8S           ]: NFORCE - NVidia CK8S
                     NVidia CK8S with ALC850 at 0xe7000000, irq 12
1 [Live           ]: EMU10K1 - Sound Blaster Live!
                     Sound Blaster Live! (rev.8, serial:0x80271102) at 0xa000, irq 10

The file /proc/asound/oss/sndstat contains information about the OSS
emulation of ALSA:

[erik at fal ~]$ cat /proc/asound/oss/sndstat
Sound Driver:3.8.1a-980706 (ALSA v1.0.8 emulation code)
Kernel: Linux fal.fast.net 2.6.11-1.27_FC3 #1 Tue May 17 20:27:37 EDT 2005 i686
Config options: 0

Installed drivers: 
Type 10: ALSA emulation

Card config: 
NVidia CK8S with ALC850 at 0xe7000000, irq 12
Sound Blaster Live! (rev.8, serial:0x80271102) at 0xa000, irq 10

Audio devices:
0: NVidia CK8S (DUPLEX)
1: EMU10K1 (DUPLEX)

Synth devices: NOT ENABLED IN CONFIG

Midi devices:
1: EMU10K1 MPU-401 (UART)

Timers:
7: system timer

Mixers:
0: Realtek ALC850 rev 0
1: SigmaTel STAC9721/23

The ALSA documentation states that the OSS emulation module creates one
/dev/dsp, /dev/adsp and /dev/mixer device per sound card. If there is a
/dev/dsp1, /dev/adsp1 or /dev/mixer1 this belongs to another sound card.
This could be on-board sound hardware or a TV card.

>         Here is some suggested wording for a Note/Warning regarding
>         the possible changed behavior. [...]

I like it. :-)

Erik


From jon at radscan.com  Wed Aug 16 20:21:08 2006
From: jon at radscan.com (Jon Trulson)
Date: Wed, 16 Aug 2006 20:21:08 -0600 (MDT)
Subject: [nas] [PATCH] use the mixer specified in the input section
In-Reply-To: <20060817020157.GA2863@sushi.unix-ag.uni-kl.de>
References: <20060816033604.GA1679@sushi.unix-ag.uni-kl.de>
 <4224.1155701553@foxharp.boston.ma.us> <20060816171448.GA32552@sushi.unix-ag.uni-kl.de>
 <1405.1155749802@foxharp.boston.ma.us> <20060816182620.GA4577@sushi.unix-ag.uni-kl.de>
 <20060816220052.GA28389@sushi.unix-ag.uni-kl.de> <Pine.LNX.4.61.0608161907210.10619@m5.radscan.com>
 <20060817020157.GA2863@sushi.unix-ag.uni-kl.de>
Message-ID: <Pine.LNX.4.61.0608162015400.11205@m5.radscan.com>

On Thu, 17 Aug 2006, Erik Auerswald wrote:

> Hi,
>
> On Wed, Aug 16, 2006 at 07:20:11PM -0600, Jon Trulson wrote:
>> On Thu, 17 Aug 2006, Erik Auerswald wrote:
>>> On Wed, Aug 16, 2006 at 08:26:20PM +0200, Erik Auerswald wrote:
>>>> On Wed, Aug 16, 2006 at 01:36:42PM -0400, Paul Fox wrote:
>>>>> erik wrote:
[...]
>>         ...
>>         initMixer: opened output mixer device /dev/mixer
>>         initMixer: opened input mixer device /dev/mixer1
>>         initMixer: /dev/mixer1: using recording level control method 1
>>         Init: initMixer was successful
>>         ...
>
> This means that there are 2 mixer devices. According to the ALSA
> documentation this means that there are 2 sound "cards" configured. If
> you were to use the input jack of your SB PCI you would probably not be
> able to record anything with NAS.
>

         Ahh, you are correct.  You can see now that I use input alot
         with nas :)

[ landru: nas ] cat /proc/asound/cards
  0 [AudioPCI       ]: ENS1371 - Ensoniq AudioPCI
                       Ensoniq AudioPCI ENS1371 at 0xbc00, irq 22
  1 [Bt878          ]: Bt87x - Brooktree Bt878
                       Brooktree Bt878 at 0xcfa00000, irq 18

[ landru: nas ] cat /proc/asound/oss/sndstat
Sound Driver:3.8.1a-980706 (ALSA v1.0.11 emulation code)
Kernel: Linux landru 2.4.31 #2 SMP Sun Aug 13 04:37:51 MDT 2006 i686
Config options: 0

Installed drivers:
Type 10: ALSA emulation

Card config:
Ensoniq AudioPCI ENS1371 at 0xbc00, irq 22
Brooktree Bt878 at 0xcfa00000, irq 18

Audio devices:
0: ES1371 DAC2/ADC (DUPLEX)
1: Bt87x Digital

Synth devices: NOT ENABLED IN CONFIG

Midi devices:
0: ES1371

Timers:
7: system timer

Mixers:
0: SigmaTel STAC9708,11
1: Bt87x

[...]
> The ALSA documentation states that the OSS emulation module creates one
> /dev/dsp, /dev/adsp and /dev/mixer device per sound card. If there is a
> /dev/dsp1, /dev/adsp1 or /dev/mixer1 this belongs to another sound card.
> This could be on-board sound hardware or a TV card.
>

         TV card it is! :)

>>         Here is some suggested wording for a Note/Warning regarding
>>         the possible changed behavior. [...]
>
> I like it. :-)
>

         Ok, I'll put it near the top for the next dev release announcement.


-- 
Jon Trulson
mailto:jon at radscan.com http://radscan.com/~jon
#include <std/disclaimer.h>
"No Kill I" -Horta



From stefan at huehner.org  Sat Aug 19 05:44:50 2006
From: stefan at huehner.org (Stefan Huehner)
Date: Sat, 19 Aug 2006 13:44:50 +0200
Subject: [nas] [patch] remove unused miscstruct.h
Message-ID: <20060819114450.GA28947@pro4u.org>

Hi,

the file server/include/miscstruct.h is apparently not used anywhere in
the source tree. I propose its removal.


The attached trivial patch removes its line in 'filelist'. Additionally
please invoke a 'svn remove server/include/miscstruct.h'.

Regards,
Stefan


From stefan at huehner.org  Sat Aug 19 05:51:58 2006
From: stefan at huehner.org (Stefan Huehner)
Date: Sat, 19 Aug 2006 13:51:58 +0200
Subject: [nas] [patch] more include file cleanup
Message-ID: <20060819115158.GB28947@pro4u.org>

Hi,

attached patch removes some more unsused part of various header files:

- server/include/os.h
	leftovers from the x-headers
- server/dia/globals.[ch]
  server/include/dicstruct.h
  server/include/misc.h
	The two variables 'globalSerialNumber' and 'lastDeviceEventTime'
	are only once assigned in globals.c but are never read or
	modified afterwards.
	The patch removes the initialization and the declaration in the
	various headers.
	As globals.h is linked to the include/ directory this also
	removes these two declarations from the externally visible
	portion of the api. But as these aren't used inside nas i would
	wonder if any code linking to nas would use them. A mentioning
	in some document should imho be sufficient.

Regards,
Stefan

-------------- next part --------------
Index: server/include/dixstruct.h
===================================================================
--- server/include/dixstruct.h	(revision 179)
+++ server/include/dixstruct.h	(working copy)
@@ -77,7 +77,6 @@
 } WorkQueueRec;
 
 extern TimeStamp currentTime;
-extern TimeStamp lastDeviceEventTime;
 extern void CloseDownClient();
 
 extern TimeStamp ClientTimeToServerTime();
Index: server/include/misc.h
===================================================================
--- server/include/misc.h	(revision 179)
+++ server/include/misc.h	(working copy)
@@ -30,7 +30,6 @@
  */
 
 
-extern unsigned long globalSerialNumber;
 extern unsigned long serverGeneration;
 
 #include <X11/Xosdefs.h>
Index: server/include/os.h
===================================================================
--- server/include/os.h	(revision 179)
+++ server/include/os.h	(working copy)
@@ -133,9 +133,6 @@
 int ReadRequestFromClient();
 void CloseDownConnection();
 void CreateWellKnownSockets();
-int SetDefaultFontPath();
-void FreeFontRecord();
-int SetFontPath();
 void ErrorF();
 void Error();
 void FatalError();
Index: server/dia/globals.c
===================================================================
--- server/dia/globals.c	(revision 179)
+++ server/dia/globals.c	(working copy)
@@ -82,13 +82,10 @@
     serverClient = (ClientPtr) NULL;
     currentMaxClients = 0;
 
-    globalSerialNumber = 0;
     serverGeneration = 0;
 
     currentTime.months = 0;
     currentTime.milliseconds = 0;
-    lastDeviceEventTime.months = 0;
-    lastDeviceEventTime.milliseconds = 0;
 
 
     display = NULL;
Index: server/dia/globals.h
===================================================================
--- server/dia/globals.h	(revision 179)
+++ server/dia/globals.h	(working copy)
@@ -21,11 +21,9 @@
 GEXTERN ClientPtr serverClient;
 GEXTERN int currentMaxClients;  /* current size of clients array */
 
-GEXTERN unsigned long globalSerialNumber;
 GEXTERN unsigned long serverGeneration;
 
 GEXTERN TimeStamp currentTime;
-GEXTERN TimeStamp lastDeviceEventTime;
 
 GEXTERN char *display;
 

From stefan at huehner.org  Sat Aug 19 06:34:54 2006
From: stefan at huehner.org (Stefan Huehner)
Date: Sat, 19 Aug 2006 14:34:54 +0200
Subject: [nas] [patch] more include file cleanup
Message-ID: <20060819123454.GC28947@pro4u.org>

Hi,

attached patch removes most the the content of site.h as it is unused
inside the nas code.

Regards,
Stefan

-------------- next part --------------
--- server/include/site.h	(revision 179)
+++ server/include/site.h	(working copy)
@@ -42,50 +42,11 @@
 #endif
 
 /*
- * The following constants are provided solely as a last line of defense.  The
- * normal build ALWAYS overrides them using a special rule given in
- * server/dix/Imakefile.  If you want to change either of these constants, 
- * you should set the DefaultFontPath or DefaultRGBDatabase configuration 
- * parameters.
- * DO NOT CHANGE THESE VALUES OR THE DIX IMAKEFILE!
- */
-#ifndef COMPILEDDEFAULTFONTPATH
-#define COMPILEDDEFAULTFONTPATH "/usr/lib/X11/fonts/misc/"
-#endif
-#ifndef RGB_DB
-#define RGB_DB                  "/usr/lib/X11/rgb"
-#endif
-
-/*
  * The following constants contain default values for all of the variables 
  * that can be initialized on the server command line or in the environment.
  */
-#define COMPILEDDEFAULTFONT     "fixed"
-#define COMPILEDCURSORFONT      "cursor"
-#ifndef COMPILEDDISPLAYCLASS
-#define COMPILEDDISPLAYCLASS    "MIT-unspecified"
-#endif
 #define DEFAULT_TIMEOUT         60      /* seconds */
-#define DEFAULT_KEYBOARD_CLICK  0
-#define DEFAULT_BELL            50
-#define DEFAULT_BELL_PITCH      400
-#define DEFAULT_BELL_DURATION   100
-#define DEFAULT_AUTOREPEAT      FALSE
-#define DEFAULT_AUTOREPEATS     {\
-        0, 0, 0, 0, 0, 0, 0, 0,\
-        0, 0, 0, 0, 0, 0, 0, 0,\
-        0, 0, 0, 0, 0, 0, 0, 0,\
-        0, 0, 0, 0, 0, 0, 0, 0 }
-#define DEFAULT_LEDS            0x0     /* all off */
-#define DEFAULT_LEDS_MASK       0xffffffff      /* 32 */
-#define DEFAULT_INT_RESOLUTION          1000
-#define DEFAULT_INT_MIN_VALUE           0
-#define DEFAULT_INT_MAX_VALUE           100
-#define DEFAULT_INT_DISPLAYED           0
 
-#define DEFAULT_PTR_NUMERATOR   2
-#define DEFAULT_PTR_DENOMINATOR 1
-#define DEFAULT_PTR_THRESHOLD   4
 
 #ifndef DEFAULT_ACCESS_CONTROL
 #define DEFAULT_ACCESS_CONTROL TRUE

From jon at radscan.com  Sat Aug 19 23:00:38 2006
From: jon at radscan.com (Jon Trulson)
Date: Sat, 19 Aug 2006 23:00:38 -0600 (MDT)
Subject: [nas] [patch] remove unused miscstruct.h
In-Reply-To: <20060819114450.GA28947@pro4u.org>
References: <20060819114450.GA28947@pro4u.org>
Message-ID: <Pine.LNX.4.61.0608192259350.30660@m5.radscan.com>

On Sat, 19 Aug 2006, Stefan Huehner wrote:

> Hi,
>
> the file server/include/miscstruct.h is apparently not used anywhere in
> the source tree. I propose its removal.
>

         motion seconded, motion carries.

>
> The attached trivial patch removes its line in 'filelist'. Additionally
> please invoke a 'svn remove server/include/miscstruct.h'.
>

         Applied.

         I did not see the patch for filelist, but removed it
         manually anyway.

-- 
Jon Trulson
mailto:jon at radscan.com http://radscan.com/~jon
#include <std/disclaimer.h>
"No Kill I" -Horta



From jon at radscan.com  Sat Aug 19 23:08:22 2006
From: jon at radscan.com (Jon Trulson)
Date: Sat, 19 Aug 2006 23:08:22 -0600 (MDT)
Subject: [nas] [patch] more include file cleanup
In-Reply-To: <20060819115158.GB28947@pro4u.org>
References: <20060819115158.GB28947@pro4u.org>
Message-ID: <Pine.LNX.4.61.0608192306290.30660@m5.radscan.com>

On Sat, 19 Aug 2006, Stefan Huehner wrote:

> Hi,
>
> attached patch removes some more unsused part of various header files:
>
> - server/include/os.h
> 	leftovers from the x-headers
> - server/dia/globals.[ch]
>  server/include/dicstruct.h
>  server/include/misc.h
> 	The two variables 'globalSerialNumber' and 'lastDeviceEventTime'
> 	are only once assigned in globals.c but are never read or
> 	modified afterwards.
> 	The patch removes the initialization and the declaration in the
> 	various headers.
> 	As globals.h is linked to the include/ directory this also
> 	removes these two declarations from the externally visible
> 	portion of the api. But as these aren't used inside nas i would
> 	wonder if any code linking to nas would use them. A mentioning
> 	in some document should imho be sufficient.
>

         applied.  No external clients should be accessing the server
         includes anyway (global.h).


-- 
Jon Trulson
mailto:jon at radscan.com http://radscan.com/~jon
#include <std/disclaimer.h>
"No Kill I" -Horta



From jon at radscan.com  Sat Aug 19 23:08:37 2006
From: jon at radscan.com (Jon Trulson)
Date: Sat, 19 Aug 2006 23:08:37 -0600 (MDT)
Subject: [nas] [patch] more include file cleanup
In-Reply-To: <20060819123454.GC28947@pro4u.org>
References: <20060819123454.GC28947@pro4u.org>
Message-ID: <Pine.LNX.4.61.0608192308270.30660@m5.radscan.com>

On Sat, 19 Aug 2006, Stefan Huehner wrote:

> Hi,
>
> attached patch removes most the the content of site.h as it is unused
> inside the nas code.
>

         applied.

-- 
Jon Trulson
mailto:jon at radscan.com http://radscan.com/~jon
#include <std/disclaimer.h>
"No Kill I" -Horta



From stefan at huehner.org  Sun Aug 20 04:28:38 2006
From: stefan at huehner.org (Stefan Huehner)
Date: Sun, 20 Aug 2006 12:28:38 +0200
Subject: [nas] [patch] clients cleanup
Message-ID: <20060820102838.GD28947@pro4u.org>

Hi,

attached patch cleans up several of the client programs. Mostly adding
const to parameter/variable declarations. Additionally an unsused variable was removed and some prototype in audemo.c were fixed.

While modifying i noticed that at least the fatalError method is
included in every client program as a copy. What about extracting this
and perhaps more common code (i.e. argument parsing) in an extra object
file and linking this into each binary?

Regards,
Stefan

-------------- next part --------------
Index: clients/audio/aupanel/aupanel.c
===================================================================
--- clients/audio/aupanel/aupanel.c	(revision 180)
+++ clients/audio/aupanel/aupanel.c	(working copy)
@@ -149,7 +149,7 @@
 };
 
 static void
-fatalError(char *message, char *arg)
+fatalError(const char *message, const char *arg)
 {
     fprintf(stderr, message, arg);
     fprintf(stderr, "\n");
Index: clients/audio/auwave/auwave.c
===================================================================
--- clients/audio/auwave/auwave.c	(revision 180)
+++ clients/audio/auwave/auwave.c	(working copy)
@@ -154,7 +154,7 @@
 };
 
 static void
-fatalError(char *message, char *arg)
+fatalError(const char *message, const char *arg)
 {
     fprintf(stderr, message, arg);
     fprintf(stderr, "\n");
Index: clients/audio/audial/audial.c
===================================================================
--- clients/audio/audial/audial.c	(revision 180)
+++ clients/audio/audial/audial.c	(working copy)
@@ -161,7 +161,7 @@
 #endif						/* NEEDUSLEEP */
 
 static void
-fatalError(char *message, char *arg1)
+fatalError(const char *message, const char *arg1)
 {
     fprintf(stderr, message, arg1);
     fprintf(stderr, "\n");
Index: clients/audio/auphone/auphone.c
===================================================================
--- clients/audio/auphone/auphone.c	(revision 180)
+++ clients/audio/auphone/auphone.c	(working copy)
@@ -220,7 +220,7 @@
                *busyData;
 
 static int
-fatalError(char *message, char *arg)
+fatalError(const char *message, const char *arg)
 {
     fprintf(stderr, message, arg);
     fprintf(stderr, "\n");
Index: clients/audio/autool/audiotool.c
===================================================================
--- clients/audio/autool/audiotool.c	(revision 180)
+++ clients/audio/autool/audiotool.c	(working copy)
@@ -116,7 +116,7 @@
     NULL
 };
 
-static void     fatalError(char *message, char *arg);
+static void     fatalError(const char *message, const char *arg);
 
 #define Invert(w)							       \
 {									       \
@@ -608,7 +608,7 @@
 }
 
 static void
-fatalError(char *message, char *arg)
+fatalError(const char *message, const char *arg)
 {
     fprintf(stderr, message, arg);
     fprintf(stderr, ".\n");
Index: clients/audio/aurecord/aurecord.c
===================================================================
--- clients/audio/aurecord/aurecord.c	(revision 180)
+++ clients/audio/aurecord/aurecord.c	(working copy)
@@ -96,7 +96,7 @@
 }
 
 static void
-fatalError(char *message, char *arg)
+fatalError(const char *message, const char *arg)
 {
     fprintf(stderr, message, arg);
     fprintf(stderr, "\n");
Index: clients/audio/auconvert/auconvert.c
===================================================================
--- clients/audio/auconvert/auconvert.c	(revision 180)
+++ clients/audio/auconvert/auconvert.c	(working copy)
@@ -65,7 +65,7 @@
 
 static struct
 {
-    char           *string;
+    const char     *string;
     int             value;
 }
                 dataFormats[] =
@@ -80,7 +80,7 @@
 };
 
 static void
-fatalError(char *message, char *arg)
+fatalError(const char *message, const char *arg)
 {
     fprintf(stderr, message, arg);
     fprintf(stderr, "\n");
@@ -112,10 +112,9 @@
 }
 
 static int
-convertDataFormat(char *s)
+convertDataFormat(const char *s)
 {
-    int             f,
-                    i;
+    int             i;
 
     for (i = 0; i < sizeof(dataFormats) / sizeof(dataFormats[0]); i++)
 	if (!strcasecmp(s, dataFormats[i].string))
@@ -125,7 +124,7 @@
 }
 
 static int
-convertFileFormat(char *s)
+convertFileFormat(const char *s)
 {
     int             f;
 
Index: clients/audio/auctl/execute.c
===================================================================
--- clients/audio/auctl/execute.c	(revision 180)
+++ clients/audio/auctl/execute.c	(working copy)
@@ -44,7 +44,7 @@
 int execute_command (AuServer *aud, int argc, char **argv, AuBool *donep)
 {
     static struct {
-	char *name;
+	const char *name;
 	int (*proc) PROTO((AuServer *, int, char **));
 	AuBool done;
     } keytab[] = {
@@ -414,7 +414,7 @@
     AuDeviceAttributes attr;
     AuStatus status;
     static struct {
-	char *name;
+	const char *name;
 	int value;
     } lmtab[] = {
 	{ "none",	AuDeviceLineModeNone },
@@ -481,7 +481,7 @@
 
 static AuInt32 _parse_long (register char *s, register AuBool *ishexp)
 {
-    char *fmt = "%ld";
+    const char *fmt = "%ld";
     AuInt32 val = 0;
 
     if (*s == '0') s++;
Index: clients/audio/audemo/audemo.c
===================================================================
--- clients/audio/audemo/audemo.c	(revision 180)
+++ clients/audio/audemo/audemo.c	(working copy)
@@ -152,9 +152,11 @@
     NULL
 };
 
-static char   **makeFileList();
-static int      getFileNames();
-static void     fatalError(), bucketQueryCB(), bucketRecordDismissCB(),
+static char   **makeFileList(char **fileNames, int nfiles);
+static int      getFileNames(char *dir, char ***fileNames, char *template);
+static void     fatalError(const char *message, const char *arg), 
+                bucketQueryCB(Widget w, XtPointer globalsp, XtPointer call_data),
+                bucketRecordDismissCB(Widget w, XtPointer globalsp, XtPointer call_data),
                 meterCB();
 
 #ifdef XT
@@ -1701,7 +1703,7 @@
 #endif						/* XT */
 
 static void
-fatalError(char *message, char *arg)
+fatalError(const char *message, const char *arg)
 {
     fprintf(stderr, message, arg);
     fprintf(stderr, "\n");
Index: clients/audio/util/playbucket.c
===================================================================
--- clients/audio/util/playbucket.c	(revision 180)
+++ clients/audio/util/playbucket.c	(working copy)
@@ -31,7 +31,7 @@
 #define USAGE "usage: playbucket [-a audioServer] [-v volume] file"
 
 static void
-fatalError(char *message, char *arg)
+fatalError(const char *message, const char *arg)
 {
     fprintf(stderr, message, arg);
     fprintf(stderr, "\n");
Index: clients/audio/util/soundtoh.c
===================================================================
--- clients/audio/util/soundtoh.c	(revision 180)
+++ clients/audio/util/soundtoh.c	(working copy)
@@ -44,7 +44,7 @@
 #include <audio/sound.h>
 
 static void
-fatalError(char *message, char *arg)
+fatalError(const char *message, const char *arg)
 {
     fprintf(stderr, message, arg);
     fprintf(stderr, "\n");
Index: clients/audio/examples/playRaw.c
===================================================================
--- clients/audio/examples/playRaw.c	(revision 180)
+++ clients/audio/examples/playRaw.c	(working copy)
@@ -28,7 +28,7 @@
 }               InfoRec, *InfoPtr;
 
 static void
-fatalError(char *message, char *arg)
+fatalError(const char *message, const char *arg)
 {
     fprintf(stderr, message, arg);
     fprintf(stderr, "\n");
Index: clients/audio/examples/plyBcktAsync.c
===================================================================
--- clients/audio/examples/plyBcktAsync.c	(revision 180)
+++ clients/audio/examples/plyBcktAsync.c	(working copy)
@@ -12,7 +12,7 @@
 #include <audio/soundlib.h>
 
 static void
-fatalError(char *message, char *arg)
+fatalError(const char *message, const char *arg)
 {
     fprintf(stderr, message, arg);
     fprintf(stderr, "\n");
Index: clients/audio/examples/loopBucket.c
===================================================================
--- clients/audio/examples/loopBucket.c	(revision 180)
+++ clients/audio/examples/loopBucket.c	(working copy)
@@ -15,7 +15,7 @@
 #include <audio/soundlib.h>
 
 static void
-fatalError(char *message, char *arg)
+fatalError(const char *message, const char *arg)
 {
     fprintf(stderr, message, arg);
     fprintf(stderr, "\n");
Index: clients/audio/examples/bundle.c
===================================================================
--- clients/audio/examples/bundle.c	(revision 180)
+++ clients/audio/examples/bundle.c	(working copy)
@@ -22,7 +22,7 @@
 #include <audio/soundlib.h>
 
 static void
-fatalError(char *message, char *arg)
+fatalError(const char *message, const char *arg)
 {
     fprintf(stderr, message, arg);
     fprintf(stderr, "\n");
Index: clients/audio/examples/recordBucket.c
===================================================================
--- clients/audio/examples/recordBucket.c	(revision 180)
+++ clients/audio/examples/recordBucket.c	(working copy)
@@ -16,7 +16,7 @@
 #include <audio/soundlib.h>
 
 static void
-fatalError(char *message, char *arg)
+fatalError(const char *message, const char *arg)
 {
     fprintf(stderr, message, arg);
     fprintf(stderr, "\n");
Index: clients/audio/examples/playFromBckt.c
===================================================================
--- clients/audio/examples/playFromBckt.c	(revision 180)
+++ clients/audio/examples/playFromBckt.c	(working copy)
@@ -14,7 +14,7 @@
 #include <audio/soundlib.h>
 
 static void
-fatalError(char *message, char *arg)
+fatalError(const char *message, const char *arg)
 {
     fprintf(stderr, message, arg);
     fprintf(stderr, "\n");

From stefan at huehner.org  Sun Aug 20 04:47:40 2006
From: stefan at huehner.org (Stefan Huehner)
Date: Sun, 20 Aug 2006 12:47:40 +0200
Subject: [nas] [patch] remove some unused variables
Message-ID: <20060820104740.GE28947@pro4u.org>

Hi,

attached patch removes some unused variables.

Please recheck and consider applying.

Regards,
Stefan

-------------- next part --------------
diff -u clients/audio/aupanel/aupanel.c clients/audio/aupanel/aupanel.c
--- clients/audio/aupanel/aupanel.c	(working copy)
+++ clients/audio/aupanel/aupanel.c	(working copy)
@@ -296,7 +296,6 @@
 menuCB(Widget w, XtPointer gp, XtPointer call_data)
 {
     GlobalDataPtr   g = (GlobalDataPtr) gp;
-    int             i;
     String          string;
 
     XtVaGetValues(w, XtNlabel, &string, NULL);
diff -u clients/audio/examples/plyBcktAsync.c clients/audio/examples/plyBcktAsync.c
--- clients/audio/examples/plyBcktAsync.c	(working copy)
+++ clients/audio/examples/plyBcktAsync.c	(working copy)
@@ -39,7 +39,6 @@
 {
     AuServer       *aud;
     AuBucketID      bucket;
-    AuDeviceID      device = AuNone;
     AuBool          done = AuFalse;
     char           *file = argv[1];
 
--- server/os/access.c	(revision 180)
+++ server/os/access.c	(working copy)
@@ -254,7 +254,6 @@
 #if !defined(TCPCONN) && !defined(UNIXCONN)
     return -1;
 #else
-    register int n;
     int len;
     caddr_t addr;
     int family;
@@ -619,8 +618,6 @@
 pointer pAddr;
 {
     int len;
-    register HOST *host;
-    int unixFamily;
 
     if (!AuthorizedClient(client))
         return (AuBadAccess);
--- server/dda/voxware/auvoxware.c	(revision 180)
+++ server/dda/voxware/auvoxware.c	(working copy)
@@ -496,23 +496,14 @@
                        AuUint32 * auServerMinRate,
                        AuUint32 * auServerMaxRate)
 {
-    AuDeviceID stereo, mono;
     ComponentPtr d, *p;
-    int i;
     AuUint8 formatIn, formatOut;
     AuUint32 bytesPerSampleIn, bytesPerSampleOut;
     static AuBool initialized = AuFalse;
     extern RESTYPE auComponentType;
     extern ComponentPtr *auServerDevices,       /* array of devices */
-       *auServerBuckets,        /* array of server owned buckets */
-       *auServerRadios,         /* array of server owned radios */
-        auDevices,              /* list of all devices */
-        auBuckets,              /* list of all buckets */
-        auRadios;               /* list of all radios */
-    extern AuUint32 auNumServerDevices, /* number of devices */
-        auNumActions,           /* number of defined actions */
-        auNumServerBuckets,     /* number of server owned buckets */
-        auNumServerRadios;      /* number of server owned radios */
+        auDevices;              /* list of all devices */
+    extern AuUint32 auNumServerDevices; /* number of devices */
 
 
     if (NasConfig.DoDebug) {
@@ -728,7 +719,6 @@
 static AuUint32
 setSampleRate(AuUint32 rate)
 {
-    int numSamplesIn, numSamplesOut;
     AuBlock l;
 
     setTimer(0);                /* JET - turn off the timer here so the
@@ -1267,7 +1257,6 @@
 static void
 enableProcessFlow(void)
 {
-    AuUint8 *p;
 
     if (NasConfig.DoDebug) {
         osLogMsg("enableProcessFlow();\n");
@@ -1600,7 +1589,6 @@
 static void
 setupSoundcard(SndStat * sndStatPtr)
 {
-    int samplesize;
 
     if (NasConfig.DoDebug) {
         osLogMsg("setupSoundcard(...);\n");
@@ -1701,7 +1689,6 @@
 initMixer(void)
 {
     unsigned int extramode = 0;
-    AuInt32 i;
 
 #if defined(__CYGWIN__)         /* we want the file to be created if necc under
                                    windows */
@@ -1798,12 +1785,10 @@
 {
     static AuBool AL_initialized = AuFalse;
     static AuUint8 *physicalBuffers;
-    int fd;
     AuUint32 physicalBuffersSize;
     extern AuUint8 *auPhysicalOutputBuffers;
     extern AuUint32 auPhysicalOutputBuffersSize;
     extern void AuProcessData();
-    char *nas_device_policy;
     unsigned int extramode = 0; /* for extra open modes (cygwin) */
 #if defined(AUDIO_GETINFO)
     audio_info_t spkrinf;
@@ -1853,7 +1838,6 @@
      */
     if (!AL_initialized) {
         int fd;
-        AuInt32 i;
 
         AL_initialized = AuTrue;
 
--- server/dia/audispatch.c	(revision 180)
+++ server/dia/audispatch.c	(working copy)
@@ -1554,15 +1554,11 @@
 AuSendInitResponse(ClientPtr client)
 {
     extern ComponentPtr *auServerDevices,       /* array of devices */
-       *auServerBuckets,        /* array of server owned
+       *auServerBuckets;        /* array of server owned
                                  * buckets */
-       *auServerRadios;         /* array of server owned
-                                 * radios */
     extern AuUint32 auNumServerDevices, /* number of devices */
-        auNumServerBuckets,     /* number of server owned
+        auNumServerBuckets;     /* number of server owned
                                  * buckets */
-        auNumServerRadios;      /* number of server owned
-                                 * radios */
     extern unsigned char auFormats[],
             auElementTypes[], auWaveForms[], auActions[];
     int i;

From jon at radscan.com  Sun Aug 20 19:44:18 2006
From: jon at radscan.com (Jon Trulson)
Date: Sun, 20 Aug 2006 19:44:18 -0600 (MDT)
Subject: [nas] [patch] clients cleanup
In-Reply-To: <20060820102838.GD28947@pro4u.org>
References: <20060820102838.GD28947@pro4u.org>
Message-ID: <Pine.LNX.4.61.0608201943190.9722@m5.radscan.com>

On Sun, 20 Aug 2006, Stefan Huehner wrote:

> Hi,
>
> attached patch cleans up several of the client programs. Mostly adding
> const to parameter/variable declarations. Additionally an unsused variable was removed and some prototype in audemo.c were fixed.
>

         Applied, thanks!

> While modifying i noticed that at least the fatalError method is
> included in every client program as a copy. What about extracting this
> and perhaps more common code (i.e. argument parsing) in an extra object
> file and linking this into each binary?
>

         So a small 'clinet' library for these clients?  Sure - I'm
         all for removing duplication :)



-- 
Jon Trulson
mailto:jon at radscan.com http://radscan.com/~jon
#include <std/disclaimer.h>
"No Kill I" -Horta



From jon at radscan.com  Sun Aug 20 19:46:19 2006
From: jon at radscan.com (Jon Trulson)
Date: Sun, 20 Aug 2006 19:46:19 -0600 (MDT)
Subject: [nas] [patch] remove some unused variables
In-Reply-To: <20060820104740.GE28947@pro4u.org>
References: <20060820104740.GE28947@pro4u.org>
Message-ID: <Pine.LNX.4.61.0608201946060.9722@m5.radscan.com>

On Sun, 20 Aug 2006, Stefan Huehner wrote:

> Hi,
>
> attached patch removes some unused variables.
>
> Please recheck and consider applying.

   Applied, thanks.

-- 
Jon Trulson
mailto:jon at radscan.com http://radscan.com/~jon
#include <std/disclaimer.h>
"No Kill I" -Horta



From stefan at huehner.org  Mon Aug 21 09:49:37 2006
From: stefan at huehner.org (Stefan Huehner)
Date: Mon, 21 Aug 2006 17:49:37 +0200
Subject: [nas] [patch] remove servermd.h
Message-ID: <20060821154937.GI28947@pro4u.org>

Hi,

i've check the usage of the defines inside servermd.h. None of them
besides one is used in the nas source tree. The potentially used portion
is:

#ifdef stellar

<stuff>
/*
 * Use SysV random number generator.
 */
#define random rand

#endif /* stellar */

But as servermd.h is nevert included in a file which used the random function. This isn't an issue as well.

The attached patch removes the inclusion of servermd.h in 3 files and its reference in 'config/filelist'. Additionally an 'svn remove server/include/servermd.h' should be issued.

Please recheck and consider applying the patch/removing servermd.h

Regards,
Stefan

-------------- next part --------------
 #endif /* SERVERMD_H */
Index: server/dia/dispatch.c
===================================================================
--- server/dia/dispatch.c	(revision 181)
+++ server/dia/dispatch.c	(working copy)
@@ -52,7 +52,6 @@
 #include "dixstruct.h"
 #include "osstruct.h"
 #include "opaque.h"
-#include "servermd.h"
 
 extern void ProcessAudioEvents(), SendAuErrorToClient(),
 SwapConnClientPrefix(), ResetCurrentRequest(), WriteToClient();
Index: server/dia/main.c
===================================================================
--- server/dia/main.c	(revision 181)
+++ server/dia/main.c	(working copy)
@@ -61,7 +61,6 @@
 #include "resource.h"
 #include "dixstruct.h"
 #include "opaque.h"
-#include "servermd.h"
 #include "site.h"
 #include "globals.h"
 #include "nasconf.h"
Index: server/dia/audispatch.c
===================================================================
--- server/dia/audispatch.c	(revision 181)
+++ server/dia/audispatch.c	(working copy)
@@ -26,7 +26,6 @@
 #include        "release.h"
 #include        "misc.h"
 #include        "dixstruct.h"
-#include        "servermd.h"    /* VENDOR release & strings */
 #include        <audio/audio.h>
 #include        <audio/Aproto.h>
 #include        "au.h"
Index: config/filelist
===================================================================
--- config/filelist	(revision 181)
+++ config/filelist	(working copy)
@@ -620,7 +620,6 @@
 ./server/include/os.h
 ./server/include/osstruct.h
 ./server/include/resource.h
-./server/include/servermd.h
 ./server/include
 ./server/os/hpsocket.c
 ./server/os/Imakefile

From jon at radscan.com  Mon Aug 21 19:38:37 2006
From: jon at radscan.com (Jon Trulson)
Date: Mon, 21 Aug 2006 19:38:37 -0600 (MDT)
Subject: [nas] [patch] remove servermd.h
In-Reply-To: <20060821154937.GI28947@pro4u.org>
References: <20060821154937.GI28947@pro4u.org>
Message-ID: <Pine.LNX.4.61.0608211934280.16103@m5.radscan.com>

On Mon, 21 Aug 2006, Stefan Huehner wrote:

> Hi,
>
> i've check the usage of the defines inside servermd.h. None of them
> besides one is used in the nas source tree. The potentially used portion
> is:
>
> #ifdef stellar
>

         Hehe, WTF is "stellar" ?

         Applied :)

-- 
Jon Trulson
mailto:jon at radscan.com http://radscan.com/~jon
#include <std/disclaimer.h>
"No Kill I" -Horta



From stefan at huehner.org  Tue Aug 22 06:02:12 2006
From: stefan at huehner.org (Stefan Huehner)
Date: Tue, 22 Aug 2006 14:02:12 +0200
Subject: [nas] [patch] remove osstruct.h
Message-ID: <20060822120212.GK28947@pro4u.org>

Hi,

the only remaining two lines in osstruct.h are:

#include "os.h"
#include "misc.h"

As "os.h" already includes "misc.h" the only remaining one is the
inclusion of "os.h".

The attached patch therefore modifies the two users ostruct.h to
directly include os.h (which includes misc.h) and removes the osstruct.h
line in config/filelist. Is an additional "svn remove
server/include/osstruct.h" is used we can get rid of osstruct.h
completey.

Please recheck and consider applying.

Regards,
Stefan
-------------- next part --------------
Index: config/filelist
===================================================================
--- config/filelist	(revision 182)
+++ config/filelist	(working copy)
@@ -618,7 +618,6 @@
 ./server/include/misc.h
 ./server/include/opaque.h
 ./server/include/os.h
-./server/include/osstruct.h
 ./server/include/resource.h
 ./server/include
 ./server/os/hpsocket.c
Index: server/os/connection.c
===================================================================
--- server/os/connection.c	(revision 182)
+++ server/os/connection.c	(working copy)
@@ -151,7 +151,7 @@
 #if !defined(AMOEBA) && !defined(_MINIX)
 #include <sys/uio.h>
 #endif
-#include "osstruct.h"
+#include "os.h"
 #include "osdep.h"
 #include "opaque.h"
 #include "dixstruct.h"
Index: server/dia/dispatch.c
===================================================================
--- server/dia/dispatch.c	(revision 182)
+++ server/dia/dispatch.c	(working copy)
@@ -50,7 +50,7 @@
 #include        <audio/audio.h>
 #include        <audio/Aproto.h>
 #include "dixstruct.h"
-#include "osstruct.h"
+#include "os.h"
 #include "opaque.h"
 
 extern void ProcessAudioEvents(), SendAuErrorToClient(),

From jon at radscan.com  Tue Aug 22 18:50:00 2006
From: jon at radscan.com (Jon Trulson)
Date: Tue, 22 Aug 2006 18:50:00 -0600 (MDT)
Subject: [nas] [patch] remove osstruct.h
In-Reply-To: <20060822120212.GK28947@pro4u.org>
References: <20060822120212.GK28947@pro4u.org>
Message-ID: <Pine.LNX.4.61.0608221849480.22730@m5.radscan.com>

On Tue, 22 Aug 2006, Stefan Huehner wrote:

> Hi,
>
> the only remaining two lines in osstruct.h are:
>
> #include "os.h"
> #include "misc.h"
>
> As "os.h" already includes "misc.h" the only remaining one is the
> inclusion of "os.h".
>
> The attached patch therefore modifies the two users ostruct.h to
> directly include os.h (which includes misc.h) and removes the osstruct.h
> line in config/filelist. Is an additional "svn remove
> server/include/osstruct.h" is used we can get rid of osstruct.h
> completey.
>
> Please recheck and consider applying.
>

         Applied, thanks.


-- 
Jon Trulson
mailto:jon at radscan.com http://radscan.com/~jon
#include <std/disclaimer.h>
"No Kill I" -Horta



From stefan at huehner.org  Wed Aug 23 09:04:06 2006
From: stefan at huehner.org (Stefan Huehner)
Date: Wed, 23 Aug 2006 17:04:06 +0200
Subject: [nas] [patch] more server/include cleanup
Message-ID: <20060823150406.GA9679@pro4u.org>

Hi,

attached patches continue to cleanup the server/include directory.

_cleanup8a.diff removed the declaration of FreeResource from the
opaque.h header file. All files which include opaque.h don't use this
function and this declaration is copied from resource.h

_cleanup8b.diff corrects several prototypes in resource.[ch] to match
the actual function definitions inside resource.c

Regards,
Stefan

-------------- next part --------------
Index: server/include/opaque.h
===================================================================
--- server/include/opaque.h	(revision 183)
+++ server/include/opaque.h	(working copy)
@@ -11,7 +11,6 @@
 #define DE_RESET     1
 #define DE_TERMINATE 2
 
-extern void FreeResource();
 extern long TimeOutValue;
 extern int argcGlobal;
 extern char **argvGlobal;
-------------- next part --------------
Index: server/include/resource.h
===================================================================
--- server/include/resource.h	(revision 183)
+++ server/include/resource.h	(working copy)
@@ -62,13 +62,13 @@
 #define BAD_RESOURCE 0xe0000000
 
 RESTYPE CreateNewResourceType();
-RESTYPE CreateNewResourceClass();
-AuID FakeClientID();
+RESTYPE CreateNewResourceClass(void);
+AuID FakeClientID(register int client);
 Bool AddResource();
-void FreeResource();
+void FreeResource(AuID id, RESTYPE skipDeleteFuncType);
 void FreeClientResources();
 Bool LegalNewID();
-pointer LookupIDByType();
-pointer LookupIDByClass();
+pointer LookupIDByType(AuID id, RESTYPE rtype);
+pointer LookupIDByClass(AuID id, RESTYPE classes);
 
 #endif /* RESOURCE_H */
Index: server/dia/resource.c
===================================================================
--- server/dia/resource.c	(revision 183)
+++ server/dia/resource.c	(working copy)
@@ -77,7 +77,7 @@
 #include "dixstruct.h"
 #include "opaque.h"
 
-extern void MarkClientException();
+extern void MarkClientException(ClientPtr client);
 
 #define SERVER_MINID 32
 
@@ -107,7 +107,7 @@
 static RESTYPE lastResourceClass;
 static RESTYPE TypeAuMask;
 
-static void RebuildTable();
+static void RebuildTable(int client);
 
 typedef int (*DeleteType) ();
 
@@ -132,7 +132,7 @@
 }
 
 RESTYPE
-CreateNewResourceClass()
+CreateNewResourceClass(void)
 {
     RESTYPE next = lastResourceClass >> 1;
 
@@ -481,7 +481,7 @@
 }
 
 void
-FreeAllResources()
+FreeAllResources(void)
 {
     int i;
 

From jon at radscan.com  Wed Aug 23 18:00:12 2006
From: jon at radscan.com (Jon Trulson)
Date: Wed, 23 Aug 2006 18:00:12 -0600 (MDT)
Subject: [nas] [patch] more server/include cleanup
In-Reply-To: <20060823150406.GA9679@pro4u.org>
References: <20060823150406.GA9679@pro4u.org>
Message-ID: <Pine.LNX.4.61.0608231759520.29200@m5.radscan.com>

On Wed, 23 Aug 2006, Stefan Huehner wrote:

> Hi,
>
> attached patches continue to cleanup the server/include directory.
>
> _cleanup8a.diff removed the declaration of FreeResource from the
> opaque.h header file. All files which include opaque.h don't use this
> function and this declaration is copied from resource.h
>
> _cleanup8b.diff corrects several prototypes in resource.[ch] to match
> the actual function definitions inside resource.c
>

         Applied, thanks.


-- 
Jon Trulson
mailto:jon at radscan.com http://radscan.com/~jon
#include <std/disclaimer.h>
"No Kill I" -Horta



From stefan at huehner.org  Sat Aug 26 09:10:15 2006
From: stefan at huehner.org (Stefan Huehner)
Date: Sat, 26 Aug 2006 17:10:15 +0200
Subject: [nas] [patch] RFC: broken AIXV3 debug code?
Message-ID: <20060826151015.GA23696@pro4u.org>

Hi,

in server/os/utils.c there is some code to redirect error logging from
stderr to and file in tmp on AIXV3. As OpenDebug isn't called anywhere
this is broken when AIXV3 is defined. Additionally this logfile is fixed
in /tmp which permissions 00777.

Should this special case be kept and fixed?
Or should this be removed completely?

A patch for the latter case whith the code in questio is attached.

Regards,
Stefan

-------------- next part --------------
--- utils_orig.c	2006-08-26 17:06:52.000000000 +0200
+++ utils_work.c	2006-08-26 17:09:22.000000000 +0200
@@ -125,13 +125,6 @@
 #include <unistd.h>
 #endif
 
-#ifdef AIXV3
-#define AIXFILE "/tmp/aixfile"
-FILE *aixfd;
-int SyncOn = 0;
-extern int SelectWaitTime;
-#endif
-
 #ifdef DEBUG
 #ifndef SPECIAL_MALLOC
 /*#define MEMBUG - This breaks things with unknown CheckMemory call */
@@ -612,13 +605,6 @@
 ErrorF(char *f, char *s0, char *s1, char *s2, char *s3, char *s4, char *s5,
        char *s6, char *s7, char *s8, char *s9)
 {                               /* limit of ten args */
-#ifdef AIXV3
-    fprintf(aixfd, f, s0, s1, s2, s3, s4, s5, s6, s7, s8, s9);
-    fflush(aixfd);
-
-    if (SyncOn)
-        sync();
-#else
 #ifdef AMOEBA
     mu_lock(&print_lock);
 #endif
@@ -626,21 +612,7 @@
 #ifdef AMOEBA
     mu_unlock(&print_lock);
 #endif
-#endif
 
     return;
 }
 
-#ifdef AIXV3
-void
-OpenDebug(void)
-{
-    if ((aixfd = fopen(AIXFILE, "w")) == NULL) {
-        fprintf(stderr, "open aixfile failed\n");
-        exit(-1);
-    }
-    chmod(AIXFILE, 00777);
-
-    return;
-}
-#endif

From stefan at huehner.org  Sat Aug 26 10:58:58 2006
From: stefan at huehner.org (Stefan Huehner)
Date: Sat, 26 Aug 2006 18:58:58 +0200
Subject: [nas] [patch] remove unused vars, function
Message-ID: <20060826165858.GB23696@pro4u.org>

Hi,

attached patch removes some unsued variables in lib/audio/nameaddr.c and
and unused function in server/os/utils.c.

Regards,
Stefan

-------------- next part --------------
Index: server/os/utils.c
===================================================================
--- server/os/utils.c	(revision 184)
+++ server/os/utils.c	(working copy)
@@ -238,25 +240,6 @@
 #endif /* AMOEBA */
 #endif
 
-AdjustWaitForDelay(pointer waitTime, unsigned long newdelay)
-{
-    static struct timeval delay_val;
-    struct timeval **wt = (struct timeval **) waitTime;
-    unsigned long olddelay;
-
-    if (*wt == NULL) {
-        delay_val.tv_sec = newdelay / 1000;
-        delay_val.tv_usec = 1000 * (newdelay % 1000);
-        *wt = &delay_val;
-    } else {
-        olddelay = (*wt)->tv_sec * 1000 + (*wt)->tv_usec / 1000;
-        if (newdelay < olddelay) {
-            (*wt)->tv_sec = newdelay / 1000;
-            (*wt)->tv_usec = 1000 * (newdelay % 1000);
-        }
-    }
-}
-
 void
 UseMsg(void)
 {
Index: lib/audio/nameaddr.c
===================================================================
--- lib/audio/nameaddr.c	(revision 184)
+++ lib/audio/nameaddr.c	(working copy)
@@ -240,7 +240,6 @@
                               char **serveraddrp		/* return */
                               )
 {
-	char	netype[128], sysname[128], nodname[128];
 	char	*procname = "Aulib/_AuMakeStreamsConnection";
 	struct	utsname	 machine;
 	int	fd; 

From stefan at huehner.org  Sat Aug 26 11:07:10 2006
From: stefan at huehner.org (Stefan Huehner)
Date: Sat, 26 Aug 2006 19:07:10 +0200
Subject: [nas] [patch] correct function declarations: () -> (void)
Message-ID: <20060826170709.GC23696@pro4u.org>

Hi,

attached patch corrects some function declarations by changing () to
(void).

Regards,
Stefan

-------------- next part --------------
--- server/os/connection.c	(revision 184)
+++ server/os/connection.c	(working copy)
@@ -506,7 +506,7 @@
 static struct sockaddr_un unsock;
 
 static int
-open_unix_socket()
+open_unix_socket(void)
 {
     int oldUmask;
     int request;
@@ -647,7 +647,7 @@
 }
 
 static int
-open_isc_local()
+open_isc_local(void)
 {
     int fd = -1, fds = -1;
     long temp;
@@ -704,7 +704,7 @@
 
 
 static int
-accept_isc_local()
+accept_isc_local(void)
 {
     struct strrecvfd buf;
 
@@ -719,7 +719,7 @@
 }
 
 static int
-open_xsight_local()
+open_xsight_local(void)
 {
     int fds = -1, fdr = -1;
     char pathS[64], pathR[64];
@@ -759,7 +759,7 @@
 
 
 static int
-accept_xsight_local()
+accept_xsight_local(void)
 {
     char c;
     int fd;
@@ -788,7 +788,7 @@
 #endif /* SVR4 */
 
 static int
-open_att_local()
+open_att_local(void)
 {
     char *slave;
     int fd;
@@ -878,7 +878,7 @@
 #endif /* SVR4 */
 
 static int
-accept_att_local()
+accept_att_local(void)
 {
     int newconn;
     int read_in;
@@ -913,7 +913,7 @@
 
 #ifdef SVR4
 static int
-accept_att_svr4_local()
+accept_att_svr4_local(void)
 {
     struct strrecvfd str;
 
@@ -1014,7 +1014,7 @@
 
 #ifdef DNETCONN
 static int
-open_dnet_socket()
+open_dnet_socket(void)
 {
     int request;
     struct sockaddr_dn dnsock;
--- server/dia/dispatch.c	(revision 184)
+++ server/dia/dispatch.c	(working copy)
@@ -74,7 +74,7 @@
 extern void WriteSConnSetupPrefix();
 extern char *ClientAuthorized();
 extern Bool InsertFakeRequest();
-static void KillAllClients();
+static void KillAllClients(void);
 extern void ProcessWorkQueue();
 
 extern int (*AuProcVector[256]) ();
@@ -288,7 +288,7 @@
 }
 
 static void
-KillAllClients()
+KillAllClients(void)
 {
     int i;
     for (i = 1; i < currentMaxClients; i++)

From stefan at huehner.org  Sat Aug 26 13:31:44 2006
From: stefan at huehner.org (Stefan Huehner)
Date: Sat, 26 Aug 2006 21:31:44 +0200
Subject: [nas] [patch] remove unused functions, more () -> (void)
Message-ID: <20060826193144.GD23696@pro4u.org>

Hi,

attached patch removed the 2 unused functions:

- server/dia/dispatch.c: void UpdateCurrentTime()
- server/dia/dixutils.c: TimeStamp ClientTimeToServerTime

and it changes one more occurence of () to (void).

Please check and consider applying.

Regards,
Stefan
-------------- next part --------------
Index: server/include/dixstruct.h
===================================================================
--- server/include/dixstruct.h	(revision 184)
+++ server/include/dixstruct.h	(working copy)
@@ -79,8 +79,6 @@
 extern TimeStamp currentTime;
 extern void CloseDownClient();
 
-extern TimeStamp ClientTimeToServerTime();
-extern void UpdateCurrentTime();
-extern void UpdateCurrentTimeIf();
+extern void UpdateCurrentTimeIf(void);
 
 #endif /* DIXSTRUCT_H */
Index: server/dia/dispatch.c
===================================================================
--- server/dia/dispatch.c	(revision 184)
+++ server/dia/dispatch.c	(working copy)
@@ -96,26 +96,9 @@
  */
 AuID clientErrorValue;          /* XXX this is a kludge */
 
-void
-UpdateCurrentTime()
-{
-    TimeStamp systime;
-
-    /* To avoid time running backwards, we must call GetTimeInMillis before
-     * calling ProcessInputEvents.
-     */
-    systime.months = currentTime.months;
-    systime.milliseconds = GetTimeInMillis();
-    if (systime.milliseconds < currentTime.milliseconds)
-        systime.months++;
-    ProcessAudioEvents();
-    if (CompareTimeStamps(systime, currentTime) == LATER)
-        currentTime = systime;
-}
-
 /* Like UpdateCurrentTime, but can't call ProcessInputEvents */
 void
-UpdateCurrentTimeIf()
+UpdateCurrentTimeIf(void)
 {
     TimeStamp systime;
 
Index: server/dia/dixutils.c
===================================================================
--- server/dia/dixutils.c	(revision 184)
+++ server/dia/dixutils.c	(working copy)
@@ -73,31 +73,6 @@
     return SAMETIME;
 }
 
-#ifdef junk
-/*
- * convert client times to server TimeStamps
- */
-
-#define HALFMONTH ((unsigned long) 1<<31)
-TimeStamp
-ClientTimeToServerTime(CARD32 c)
-{
-    TimeStamp ts;
-    if (c == CurrentTime)
-        return currentTime;
-    ts.months = currentTime.months;
-    ts.milliseconds = c;
-    if (c > currentTime.milliseconds) {
-        if (((unsigned long) c - currentTime.milliseconds) > HALFMONTH)
-            ts.months -= 1;
-    } else if (c < currentTime.milliseconds) {
-        if (((unsigned long) currentTime.milliseconds - c) > HALFMONTH)
-            ts.months += 1;
-    }
-    return ts;
-}
-#endif /* junk */
-
 /* No-op Don't Do Anything : sometimes we need to be able to call a procedure
  * that doesn't do anything.  For example, on screen with only static
  * colormaps, if someone calls install colormap, it's easier to have a dummy

From jon at radscan.com  Sat Aug 26 15:09:55 2006
From: jon at radscan.com (Jon Trulson)
Date: Sat, 26 Aug 2006 15:09:55 -0600 (MDT)
Subject: [nas] [patch] RFC: broken AIXV3 debug code?
In-Reply-To: <20060826151015.GA23696@pro4u.org>
References: <20060826151015.GA23696@pro4u.org>
Message-ID: <Pine.LNX.4.61.0608261508480.14991@m5.radscan.com>

On Sat, 26 Aug 2006, Stefan Huehner wrote:

> Hi,
>
> in server/os/utils.c there is some code to redirect error logging from
> stderr to and file in tmp on AIXV3. As OpenDebug isn't called anywhere
> this is broken when AIXV3 is defined. Additionally this logfile is fixed
> in /tmp which permissions 00777.
>
> Should this special case be kept and fixed?
> Or should this be removed completely?
>
> A patch for the latter case whith the code in questio is attached.
>


         Latter case, absolutely. :) I manually applied this patch.
         Feel free to rip out any similiar stupidity if you should run
         across it :)

-- 
Jon Trulson
mailto:jon at radscan.com http://radscan.com/~jon
#include <std/disclaimer.h>
"No Kill I" -Horta



From jon at radscan.com  Sat Aug 26 15:10:49 2006
From: jon at radscan.com (Jon Trulson)
Date: Sat, 26 Aug 2006 15:10:49 -0600 (MDT)
Subject: [nas] [patch] remove unused vars, function
In-Reply-To: <20060826165858.GB23696@pro4u.org>
References: <20060826165858.GB23696@pro4u.org>
Message-ID: <Pine.LNX.4.61.0608261510400.14991@m5.radscan.com>

On Sat, 26 Aug 2006, Stefan Huehner wrote:

> Hi,
>
> attached patch removes some unsued variables in lib/audio/nameaddr.c and
> and unused function in server/os/utils.c.
>

         Applied.


-- 
Jon Trulson
mailto:jon at radscan.com http://radscan.com/~jon
#include <std/disclaimer.h>
"No Kill I" -Horta



From jon at radscan.com  Sat Aug 26 15:11:00 2006
From: jon at radscan.com (Jon Trulson)
Date: Sat, 26 Aug 2006 15:11:00 -0600 (MDT)
Subject: [nas] [patch] correct function declarations: () -> (void)
In-Reply-To: <20060826170709.GC23696@pro4u.org>
References: <20060826170709.GC23696@pro4u.org>
Message-ID: <Pine.LNX.4.61.0608261510520.14991@m5.radscan.com>

On Sat, 26 Aug 2006, Stefan Huehner wrote:

> Hi,
>
> attached patch corrects some function declarations by changing () to
> (void).
>

         Applied.


-- 
Jon Trulson
mailto:jon at radscan.com http://radscan.com/~jon
#include <std/disclaimer.h>
"No Kill I" -Horta



From jon at radscan.com  Sat Aug 26 15:11:20 2006
From: jon at radscan.com (Jon Trulson)
Date: Sat, 26 Aug 2006 15:11:20 -0600 (MDT)
Subject: [nas] [patch] remove unused functions, more () -> (void)
In-Reply-To: <20060826193144.GD23696@pro4u.org>
References: <20060826193144.GD23696@pro4u.org>
Message-ID: <Pine.LNX.4.61.0608261511060.14991@m5.radscan.com>

On Sat, 26 Aug 2006, Stefan Huehner wrote:

> Hi,
>
> attached patch removed the 2 unused functions:
>
> - server/dia/dispatch.c: void UpdateCurrentTime()
> - server/dia/dixutils.c: TimeStamp ClientTimeToServerTime
>
> and it changes one more occurence of () to (void).
>
> Please check and consider applying.
>

         Applied.

-- 
Jon Trulson
mailto:jon at radscan.com http://radscan.com/~jon
#include <std/disclaimer.h>
"No Kill I" -Horta



From stefan at huehner.org  Mon Aug 28 07:42:34 2006
From: stefan at huehner.org (Stefan Huehner)
Date: Mon, 28 Aug 2006 15:42:34 +0200
Subject: [nas] [patch] more include cleanup
Message-ID: <20060828134233.GE23696@pro4u.org>

Hi,

attached patch removes the defined VENDOR_STRING and VENDOR_RELEASE from
server/include/site.h as they aren't used in the 3 files including site.h.
Additionally the inclusions of site.h was removed from server/dia/main.c
as none of its defines is used in main.c

Regards,
Stefan

-------------- next part --------------
Index: server/include/site.h
===================================================================
--- server/include/site.h	(revision 222)
+++ server/include/site.h	(working copy)
@@ -24,24 +24,8 @@
 
 #ifndef SITE_H
 #define SITE_H
-/*
- * The vendor string identifies the vendor responsible for the
- * server executable.
- */
-#ifndef VENDOR_STRING
-#define VENDOR_STRING "MIT X Consortium"
-#endif
 
 /*
- * The vendor release number identifies, for the purpose of submitting
- * traceable bug reports, the release number of software produced
- * by the vendor.
- */
-#ifndef VENDOR_RELEASE
-#define VENDOR_RELEASE  5000
-#endif
-
-/*
  * The following constants contain default values for all of the variables 
  * that can be initialized on the server command line or in the environment.
  */
Index: server/dia/main.c
===================================================================
--- server/dia/main.c	(revision 222)
+++ server/dia/main.c	(working copy)
@@ -61,7 +61,6 @@
 #include "resource.h"
 #include "dixstruct.h"
 #include "opaque.h"
-#include "site.h"
 #include "globals.h"
 #include "nasconf.h"
 #include "release.h"

From jon at radscan.com  Mon Aug 28 18:12:56 2006
From: jon at radscan.com (Jon Trulson)
Date: Mon, 28 Aug 2006 18:12:56 -0600 (MDT)
Subject: [nas] [patch] more include cleanup
In-Reply-To: <20060828134233.GE23696@pro4u.org>
References: <20060828134233.GE23696@pro4u.org>
Message-ID: <Pine.LNX.4.61.0608281807240.2401@m5.radscan.com>

On Mon, 28 Aug 2006, Stefan Huehner wrote:

> Hi,
>
> attached patch removes the defined VENDOR_STRING and VENDOR_RELEASE from
> server/include/site.h as they aren't used in the 3 files including site.h.
> Additionally the inclusions of site.h was removed from server/dia/main.c
> as none of its defines is used in main.c
>

         Applied.

         Be sure to update server/dia/audispatch.c as well, as I
         fixed a problem there due to the fact that (#) is no longer part
         of the release string.


-- 
Jon Trulson
mailto:jon at radscan.com http://radscan.com/~jon
#include <std/disclaimer.h>
"No Kill I" -Horta



From stefan at huehner.org  Tue Aug 29 07:22:46 2006
From: stefan at huehner.org (Stefan Huehner)
Date: Tue, 29 Aug 2006 15:22:46 +0200
Subject: [nas] [patch] remove more unused content
Message-ID: <20060829132246.GF23696@pro4u.org>

Hi,

attached patch removes more unused defines and functions in server/ .
Additionally a k&r style function was convertd to ansi c in swaprep.c

Please check and consider applying.

Regards,
Stefan

-------------- next part --------------
Index: server/dda/voxware/auvoxware.c
===================================================================
--- server/dda/voxware/auvoxware.c	(revision 224)
+++ server/dda/voxware/auvoxware.c	(working copy)
@@ -206,7 +206,6 @@
 
 #define SERVER_CLIENT           0
 
-#define MIN_MINIBUF_SAMPLES     256
 #define MAX_MINIBUF_SAMPLES     1024    /* Must be a power of 2 */
 
 #define PhysicalOneTrackBufferSize \
@@ -322,18 +321,6 @@
 static void setPhysicalInputGainAndLineMode(AuFixedPoint gain,
                                             AuUint8 lineMode);
 
-void
-setDebugOn(void)
-{
-    NasConfig.DoDebug = 1;
-}
-
-void
-setVerboseOn(void)
-{
-    NasConfig.DoVerbose = 1;
-}
-
 #ifdef sco
 
 AuBlock
Index: server/dia/dispatch.c
===================================================================
--- server/dia/dispatch.c	(revision 224)
+++ server/dia/dispatch.c	(working copy)
@@ -70,12 +70,10 @@
 extern Bool InitClientResources();
 
 extern int (*InitialVector[3]) ();
-extern void Swap32Write(), WriteSConnectionInfo();
 extern void WriteSConnSetupPrefix();
 extern char *ClientAuthorized();
 extern Bool InsertFakeRequest();
 static void KillAllClients(void);
-extern void ProcessWorkQueue();
 
 extern int (*AuProcVector[256]) ();
 extern int (*AuSwappedProcVector[256]) ();
Index: server/dia/events.c
===================================================================
--- server/dia/events.c	(revision 224)
+++ server/dia/events.c	(working copy)
@@ -49,8 +49,6 @@
 
 #include        <audio/audio.h>
 #include        <audio/Aproto.h>
-#include "misc.h"
-#include "resource.h"
 #include "dixstruct.h"
 
 extern void WriteToClient();
Index: server/dia/dixutils.c
===================================================================
--- server/dia/dixutils.c       (revision 224)
+++ server/dia/dixutils.c       (working copy)
@@ -54,25 +54,6 @@

 extern void IgnoreClient(), AttendClient();

-/*
- * CompareTimeStamps returns -1, 0, or +1 depending on if the first
- * argument is less than, equal to or greater than the second argument.
- */
-
-int
-CompareTimeStamps(TimeStamp a, TimeStamp b)
-{
-    if (a.months < b.months)
-        return EARLIER;
-    if (a.months > b.months)
-        return LATER;
-    if (a.milliseconds < b.milliseconds)
-        return EARLIER;
-    if (a.milliseconds > b.milliseconds)
-        return LATER;
-    return SAMETIME;
-}
-
 /* No-op Don't Do Anything : sometimes we need to be able to call a procedure
  * that doesn't do anything.  For example, on screen with only static
  * colormaps, if someone calls install colormap, it's easier to have a dummy
Index: server/dia/swaprep.c
===================================================================
--- server/dia/swaprep.c	(revision 224)
+++ server/dia/swaprep.c	(working copy)
@@ -74,100 +71,8 @@
 }
 
 void
-CopySwap32Write(pClient, size, pbuf)
-ClientPtr pClient;
-int size;                       /* in bytes */
-long *pbuf;
+WriteSConnSetupPrefix(ClientPtr pClient, auConnSetupPrefix *pcsp)
 {
-    int bufsize = size;
-    long *pbufT;
-    register long *from, *to, *fromLast, *toLast;
-    long tmpbuf[1];
-
-    /* Allocate as big a buffer as we can... */
-    while (!(pbufT = (long *) ALLOCATE_LOCAL(bufsize))) {
-        bufsize >>= 1;
-        if (bufsize == 4) {
-            pbufT = tmpbuf;
-            break;
-        }
-    }
-
-    /* convert lengths from # of bytes to # of longs */
-    size >>= 2;
-    bufsize >>= 2;
-
-    from = pbuf;
-    fromLast = from + size;
-    while (from < fromLast) {
-        int nbytes;
-        to = pbufT;
-        toLast = to + min(bufsize, fromLast - from);
-        nbytes = (toLast - to) << 2;
-        while (to < toLast) {
-            /* can't write "cpswapl(*from++, *to++)" because cpswapl is a macro
-               that evaulates its args more than once */
-            cpswapl(*from, *to);
-            from++;
-            to++;
-        }
-        (void) WriteToClient(pClient, nbytes, (char *) pbufT);
-    }
-
-    if (pbufT != tmpbuf)
-        DEALLOCATE_LOCAL((char *) pbufT);
-}
-
-void
-CopySwap16Write(pClient, size, pbuf)
-ClientPtr pClient;
-int size;                       /* in bytes */
-short *pbuf;
-{
-    int bufsize = size;
-    short *pbufT;
-    register short *from, *to, *fromLast, *toLast;
-    short tmpbuf[2];
-
-    /* Allocate as big a buffer as we can... */
-    while (!(pbufT = (short *) ALLOCATE_LOCAL(bufsize))) {
-        bufsize >>= 1;
-        if (bufsize == 4) {
-            pbufT = tmpbuf;
-            break;
-        }
-    }
-
-    /* convert lengths from # of bytes to # of shorts */
-    size >>= 1;
-    bufsize >>= 1;
-
-    from = pbuf;
-    fromLast = from + size;
-    while (from < fromLast) {
-        int nbytes;
-        to = pbufT;
-        toLast = to + min(bufsize, fromLast - from);
-        nbytes = (toLast - to) << 1;
-        while (to < toLast) {
-            /* can't write "cpswaps(*from++, *to++)" because cpswaps is a macro
-               that evaulates its args more than once */
-            cpswaps(*from, *to);
-            from++;
-            to++;
-        }
-        (void) WriteToClient(pClient, nbytes, (char *) pbufT);
-    }
-
-    if (pbufT != tmpbuf)
-        DEALLOCATE_LOCAL((char *) pbufT);
-}
-
-void
-WriteSConnSetupPrefix(pClient, pcsp)
-ClientPtr pClient;
-auConnSetupPrefix *pcsp;
-{
     auConnSetupPrefix cspT;
 
     cspT.success = pcsp->success;
Index: server/dia/swapreq.c
===================================================================
--- server/dia/swapreq.c	(revision 224)
+++ server/dia/swapreq.c	(working copy)
@@ -50,7 +50,6 @@
 #include <audio/audio.h>
 #include <audio/Aproto.h>
 #include "misc.h"
-#include "dixstruct.h"
 
 /* Byte swap a list of longs */
 

From stefan at huehner.org  Tue Aug 29 07:23:47 2006
From: stefan at huehner.org (Stefan Huehner)
Date: Tue, 29 Aug 2006 15:23:47 +0200
Subject: [nas] [patch] more () -> (void) conversion
Message-ID: <20060829132347.GG23696@pro4u.org>

Hi,

attached patch converts more function declarations and their prototypes without parameters from () to the (void) form.

Regards,
Stefan

-------------- next part --------------
diff -u server/dia/dispatch.c server/dia/dispatch.c
--- server/dia/dispatch.c	(working copy)
+++ server/dia/dispatch.c	(working copy)
@@ -197,7 +197,7 @@
 }
 
 void
-AuInitProcVectors()
+AuInitProcVectors(void)
 {
     int i;
 
@@ -284,7 +284,7 @@
  *    and  destroy their resources.
  *********************/
 void
-CloseDownRetainedResources()
+CloseDownRetainedResources(void)
 {
     register int i;
     register ClientPtr client;
diff -u server/dia/dixutils.c       (working copy) server/dia/dixutils.c
--- server/dia/dixutils.c       (working copy)
+++ server/dia/dixutils.c	(working copy)
@@ -75,7 +75,7 @@
 
 /* ARGSUSED */
 void
-ProcessWorkQueue()
+ProcessWorkQueue(void)
 {
     WorkQueuePtr q, n, p;
 
--- server/os/connection.c	(revision 224)
+++ server/os/connection.c	(working copy)
@@ -829,7 +829,7 @@
 
 #ifdef SVR4
 static int
-open_att_svr4_local()
+open_att_svr4_local(void)
 {
     int fd[2], tfd;
     char path[64];
@@ -1051,7 +1051,7 @@
  *****************/
 
 void
-CreateWellKnownSockets()
+CreateWellKnownSockets(void)
 {
     int request, i;
 #ifdef SVR4
@@ -2138,7 +2138,7 @@
 static void AmoebaTCPConnectorThread();
 
 void
-CreateWellKnownSockets()
+CreateWellKnownSockets(void)
 {
     char host[100];
     char *getenv();
--- server/os/access.c	(revision 224)
+++ server/os/access.c	(working copy)
@@ -212,8 +215,8 @@
  * called when authorization is not enabled to add the
  * local host to the access list
  */
-
-EnableLocalHost()
+void
+EnableLocalHost(void)
 {
     if (!UsingXdmcp) {
         LocalHostEnabled = TRUE;
@@ -225,8 +228,8 @@
  * called at init time when XDMCP will be used; xdmcp always
  * adds local hosts manually when needed
  */
-
-AccessUsingXdmcp()
+void
+AccessUsingXdmcp(void)
 {
     UsingXdmcp = FALSE;
     LocalHostEnabled = FALSE;
--- server/os/daemon.c	(revision 224)
+++ server/os/daemon.c	(working copy)
@@ -62,7 +62,7 @@
 #include "os.h"
 
 void
-osBecomeOrphan()
+osBecomeOrphan(void)
 {
     Pid_t child_id;
     int stat;
@@ -111,7 +111,7 @@
 }
 
 void
-osBecomeDaemon()
+osBecomeDaemon(void)
 {
     register int i;
 
@@ -167,7 +167,7 @@
 #endif
 
 int
-osStorePid()
+osStorePid(void)
 {
 #if defined(linux) || defined(CSRG_BASED) || defined(__QNXNTO__)
     int oldpid;
--- server/os/osinit.c	(revision 224)
+++ server/os/osinit.c	(working copy)
@@ -83,7 +83,7 @@
 int limitNoFile = -1;
 #endif
 
-OsInit()
+void OsInit(void)
 {
 #ifndef AMOEBA
     static Bool been_here = FALSE;
--- server/dia/auutil.c	(revision 224)
+++ server/dia/auutil.c	(working copy)
@@ -151,7 +151,7 @@
 }
 
 void
-AuCreateResourceTypes()
+AuCreateResourceTypes(void)
 {
     auComponentType = CreateNewResourceType(AuFreeComponent);
     auFlowType = CreateNewResourceType(freeFlow);
--- server/dia/globals.c	(revision 224)
+++ server/dia/globals.c	(working copy)
@@ -76,7 +76,7 @@
 /* Initialize the globals, called from main */
 
 void
-diaInitGlobals()
+diaInitGlobals(void)
 {
     clients = (ClientPtr *) 0;
     serverClient = (ClientPtr) NULL;
--- server/dia/main.c	(revision 224)
+++ server/dia/main.c	(working copy)
@@ -65,10 +65,10 @@
 #include "nasconf.h"
 #include "release.h"
 
-extern void OsInit(), InitClient(), ResetWellKnownSockets(),
+extern void OsInit(void), InitClient(), ResetWellKnownSockets(),
 Dispatch(), FreeAllResources();
 extern int AuInitSetupReply();
-extern void AuInitProcVectors();
+extern void AuInitProcVectors(void);
 extern Bool InitClientResources();
 
 static char *AuServerName(void);
--- server/dia/audispatch.c	(revision 224)
+++ server/dia/audispatch.c	(working copy)
@@ -41,7 +41,7 @@
 AuProcessStateChanges(), AuProcessUnclockedFlows(),
 AuSetInputGainAndLineMode(), AuSetOutputGainAndMode(),
 AuSetFeedbackGain(),
-CloseDownRetainedResources(), WriteEventsToClient(), WriteToClient();
+CloseDownRetainedResources(void), WriteEventsToClient(), WriteToClient();
 extern AuBool AuChangeElementState(), AuInitDevice(), AuMatchAttributes();
 extern int AuCompileFlow(), AuSetComponentAttributes();
 extern void AuGetOutputGainAndMode(), AuGetFeedbackGain(),
--- server/dia/nasconf.c	(revision 224)
+++ server/dia/nasconf.c	(working copy)
@@ -15,7 +15,7 @@
 /* Initialize the global config items */
 
 void
-diaInitGlobalConfig()
+diaInitGlobalConfig(void)
 {
     /* init all the default values */
     NasConfig.DoDebug = FALSE;
--- server/dia/auevents.c	(revision 224)
+++ server/dia/auevents.c	(working copy)
@@ -120,7 +120,7 @@
 }
 
 void
-ProcessAudioEvents()
+ProcessAudioEvents(void)
 {
     AuBlock l;
     EventQueuePtr p, next;
--- server/dia/auconfig.c	(revision 224)
+++ server/dia/auconfig.c	(working copy)
@@ -28,7 +28,7 @@
 #include        "au.h"
 
 extern AuBool AuInitPhysicalDevices();
-extern void AuCreateResourceTypes();
+extern void AuCreateResourceTypes(void);
 
 ComponentPtr *auServerDevices,  /* array of devices */
    *auServerBuckets,            /* array of server owned

From stefan at huehner.org  Tue Aug 29 08:01:24 2006
From: stefan at huehner.org (Stefan Huehner)
Date: Tue, 29 Aug 2006 16:01:24 +0200
Subject: [nas] [patch] remove/simplify _AuConst 
Message-ID: <20060829140124.GH23696@pro4u.org>

Hi,

attached patch changes all of the conditional i.e. _AuConst definitions
to only list const in the externally visible header files. This is to
preserve compatibility if someone uses these definitions while using the
libaudio library. Imho we should officially deprecate this usaeg
somewhere in the documentation and remove these definitions altogether
after the next release.

Is this procedure ok?

The internal usage of these defines will be removed in an follow up
patch.

Regards,
Stefan
-------------- next part --------------
Index: lib/audio/Afuncproto.h
===================================================================
--- lib/audio/Afuncproto.h	(revision 224)
+++ lib/audio/Afuncproto.h	(working copy)
@@ -45,11 +45,7 @@
 #define _AUFUNCPROTO_H_
 
 #ifndef _AuConst
-#if __STDC__ || defined(__cplusplus) || defined(c_plusplus) || (FUNCPROTO&4)
 #define _AuConst const
-#else
-#define _AuConst /**/
-#endif
 #endif /* _AuConst */
 
 
Index: lib/audio/8svx.h
===================================================================
--- lib/audio/8svx.h	(revision 224)
+++ lib/audio/8svx.h	(working copy)
@@ -27,17 +27,8 @@
 
 #include <audio/audio.h>			/* for AuInt32 and AuUint32 */
 
-/*
- * If we are being used outside the NCD-AUDIO sound library, then we'll need
- * some ANSIfication definitions.
- */
-
 #ifndef _SvxConst
-#if __STDC__ || defined(__cplusplus) || defined(c_plusplus) || (FUNCPROTO&4)
 #define _SvxConst const
-#else
-#define _SvxConst				/**/
-#endif
 #endif						/* _SvxConst */
 
 #ifndef _FUNCPROTOBEGIN
Index: lib/audio/fileutil.h
===================================================================
--- lib/audio/fileutil.h	(revision 224)
+++ lib/audio/fileutil.h	(working copy)
@@ -27,17 +27,8 @@
 
 #include <audio/audio.h>	/* for AuInt32 and AuUint32 */
 
-/*
- * If we are being used outside the NCD-AUDIO sound library, then we'll need
- * some ANSIfication definitions.
- */
-
 #ifndef _FileConst
-#if __STDC__ || defined(__cplusplus) || defined(c_plusplus) || (FUNCPROTO&4)
 #define _FileConst const
-#else
-#define _FileConst		/**/
-#endif
 #endif				/* _FileConst */
 
 #ifndef _FUNCPROTOBEGIN
Index: lib/audio/aiff.h
===================================================================
--- lib/audio/aiff.h	(revision 224)
+++ lib/audio/aiff.h	(working copy)
@@ -27,17 +27,8 @@
 
 #include <audio/audio.h>	/* for AuInt32 and AuUint32 */
 
-/*
- * If we are being used outside the NCD-AUDIO sound library, then we'll need
- * some ANSIfication definitions.
- */
-
 #ifndef _AiffConst
-#if __STDC__ || defined(__cplusplus) || defined(c_plusplus) || (FUNCPROTO&4)
 #define _AiffConst const
-#else
-#define _AiffConst				/**/
-#endif
 #endif						/* _AiffConst */
 
 #ifndef _FUNCPROTOBEGIN

From jon at radscan.com  Tue Aug 29 18:08:32 2006
From: jon at radscan.com (Jon Trulson)
Date: Tue, 29 Aug 2006 18:08:32 -0600 (MDT)
Subject: [nas] [patch] remove more unused content
In-Reply-To: <20060829132246.GF23696@pro4u.org>
References: <20060829132246.GF23696@pro4u.org>
Message-ID: <Pine.LNX.4.61.0608291808240.9374@m5.radscan.com>

On Tue, 29 Aug 2006, Stefan Huehner wrote:

> Hi,
>
> attached patch removes more unused defines and functions in server/ .
> Additionally a k&r style function was convertd to ansi c in swaprep.c
>
> Please check and consider applying.

   Applied, thanks

>
> Regards,
> Stefan
>
>

-- 
Jon Trulson
mailto:jon at radscan.com http://radscan.com/~jon
#include <std/disclaimer.h>
"No Kill I" -Horta



From jon at radscan.com  Tue Aug 29 18:08:45 2006
From: jon at radscan.com (Jon Trulson)
Date: Tue, 29 Aug 2006 18:08:45 -0600 (MDT)
Subject: [nas] [patch] more () -> (void) conversion
In-Reply-To: <20060829132347.GG23696@pro4u.org>
References: <20060829132347.GG23696@pro4u.org>
Message-ID: <Pine.LNX.4.61.0608291808350.9374@m5.radscan.com>

On Tue, 29 Aug 2006, Stefan Huehner wrote:

> Hi, attached patch converts more function declarations and their
>prototypes without parameters from () to the (void) form.


         Applied.
> Regards,
> Stefan
>
>

-- 
Jon Trulson
mailto:jon at radscan.com http://radscan.com/~jon
#include <std/disclaimer.h>
"No Kill I" -Horta



From jon at radscan.com  Tue Aug 29 18:09:44 2006
From: jon at radscan.com (Jon Trulson)
Date: Tue, 29 Aug 2006 18:09:44 -0600 (MDT)
Subject: [nas] [patch] remove/simplify _AuConst 
In-Reply-To: <20060829140124.GH23696@pro4u.org>
References: <20060829140124.GH23696@pro4u.org>
Message-ID: <Pine.LNX.4.61.0608291808520.9374@m5.radscan.com>

On Tue, 29 Aug 2006, Stefan Huehner wrote:

> Hi,
>
> attached patch changes all of the conditional i.e. _AuConst definitions
> to only list const in the externally visible header files. This is to
> preserve compatibility if someone uses these definitions while using the
> libaudio library. Imho we should officially deprecate this usaeg
> somewhere in the documentation and remove these definitions altogether
> after the next release.
>
> Is this procedure ok?

   I think so - I have no objection,anyone else?

   As for internal uses, they should just use 'const' like the rest of
   the planet :)

>
> The internal usage of these defines will be removed in an follow up
> patch.
>
> Regards,
> Stefan
>

-- 
Jon Trulson
mailto:jon at radscan.com http://radscan.com/~jon
#include <std/disclaimer.h>
"No Kill I" -Horta



From jon at radscan.com  Tue Aug 29 18:10:52 2006
From: jon at radscan.com (Jon Trulson)
Date: Tue, 29 Aug 2006 18:10:52 -0600 (MDT)
Subject: [nas] [patch] remove/simplify _AuConst 
In-Reply-To: <20060829140124.GH23696@pro4u.org>
References: <20060829140124.GH23696@pro4u.org>
Message-ID: <Pine.LNX.4.61.0608291809521.9374@m5.radscan.com>

On Tue, 29 Aug 2006, Stefan Huehner wrote:

> Hi,
>
> attached patch changes all of the conditional i.e. _AuConst definitions
> to only list const in the externally visible header files. This is to
> preserve compatibility if someone uses these definitions while using the
> libaudio library. Imho we should officially deprecate this usaeg
> somewhere in the documentation and remove these definitions altogether
> after the next release.
>
> Is this procedure ok?

   Applied.  Sorry I forgot to mention that in my response..
>

-- 
Jon Trulson
mailto:jon at radscan.com http://radscan.com/~jon
#include <std/disclaimer.h>
"No Kill I" -Horta



From stefan at huehner.org  Wed Aug 30 06:17:37 2006
From: stefan at huehner.org (Stefan Huehner)
Date: Wed, 30 Aug 2006 14:17:37 +0200
Subject: [nas] [patch] remove/simplify _AuConst part2
Message-ID: <20060830121737.GB13773@pro4u.org>

Hi,                                                                             
                                                                                
attached is part two of the _.*Const removal patch. Some more defines of        
_.*Const were removed which have been missed by the last patch and the          
interval usage of _.*Const has been simplified to just use const.               
                                                                                
Regards,                                                                        
Stefan                                                                          

-------------- next part --------------
Index: lib/audio/audioutil.h
===================================================================
--- lib/audio/audioutil.h	(revision 225)
+++ lib/audio/audioutil.h	(working copy)
@@ -127,34 +127,34 @@
  *			       STRING UTILITIES				     *
  *****************************************************************************/
 
-_AuConst char  * AUCDECL
+const char  * AUCDECL
 AuFormatToString(
 		 unsigned int			/* format */
 );
 
 int AUCDECL
 AuStringToFormat(
-		 _AuConst char *		/* string */
+		 const char *			/* string */
 );
 
-_AuConst char  * AUCDECL
+const char  * AUCDECL
 AuFormatToDefine(
 		 unsigned int			/* format */
 );
 
 int AUCDECL
 AuDefineToFormat(
-		 _AuConst char *		/* define */
+		 const char *			/* define */
 );
 
-_AuConst char  * AUCDECL
+const char  * AUCDECL
 AuWaveFormToString(
 		 unsigned int			/* waveform */
 );
 
 int AUCDECL
 AuStringToWaveForm(
-		 _AuConst char *		/* string */
+		 const char *			/* string */
 );
 
 /*****************************************************************************
Index: lib/audio/8svx.c
===================================================================
--- lib/audio/8svx.c	(revision 225)
+++ lib/audio/8svx.c	(working copy)
@@ -59,7 +59,7 @@
 }
 
 SvxInfo        *
-SvxOpenFileForReading(_SvxConst char *name)
+SvxOpenFileForReading(const char *name)
 {
     SvxInfo        *si;
     SvxChunk        ck;
@@ -143,7 +143,7 @@
 }
 
 SvxInfo *
-SvxOpenFileForWriting(_SvxConst char *name, SvxInfo *si)
+SvxOpenFileForWriting(const char *name, SvxInfo *si)
 {
     int             n;
 
Index: lib/audio/AuErrDes.c
===================================================================
--- lib/audio/AuErrDes.c	(revision 225)
+++ lib/audio/AuErrDes.c	(working copy)
@@ -44,7 +44,7 @@
 typedef char   *XPointer;
 #endif
 
-static _AuConst char * _AuConst _AuErrorList[] = {
+static const char * const _AuErrorList[] = {
     /* No error	*/		"no error",
     /* AuBadRequest */		"BadRequest",
     /* AuBadValue */		"BadValue",
@@ -252,9 +252,9 @@
 /*ARGSUSED*/
 AuGetErrorDatabaseText(
     AuServer *aud,
-    register _AuConst char *name,
-    register _AuConst char *type,
-    _AuConst char *defaultp,
+    register const char *name,
+    register const char *type,
+    const char *defaultp,
     char *buffer,
     int nbytes)
 {
Index: lib/audio/SvrName.c
===================================================================
--- lib/audio/SvrName.c	(revision 225)
+++ lib/audio/SvrName.c	(working copy)
@@ -28,20 +28,20 @@
 #define DEFAULT_AUSERVER ":0"
 
 #ifdef AU_NOT_STDC_ENV
-extern _AuConst char *getenv();
+extern const char *getenv();
 #endif
 
-_AuConst char *
-AuServerName (_AuConst char *name)
+const char *
+AuServerName (const char *name)
 {
     if (name && name[0])
 	return name;
 
-    name = (_AuConst char *) getenv ("AUDIOSERVER");
+    name = (const char *) getenv ("AUDIOSERVER");
     if (name)
 	return name;
 
-    name = (_AuConst char *) getenv ("DISPLAY");
+    name = (const char *) getenv ("DISPLAY");
     if (name)
 	return name;
 
Index: lib/audio/8svx.h
===================================================================
--- lib/audio/8svx.h	(revision 225)
+++ lib/audio/8svx.h	(working copy)
@@ -82,12 +82,12 @@
 
 extern SvxInfo *
 SvxOpenFileForReading(
-		      _SvxConst char *		/* file name */
+		      const char *		/* file name */
 );
 
 extern SvxInfo *
 SvxOpenFileForWriting(
-		      _SvxConst char *,		/* file name */
+		      const char *,		/* file name */
 		      SvxInfo *			/* info */
 );
 
Index: lib/audio/fileutil.c
===================================================================
--- lib/audio/fileutil.c	(revision 225)
+++ lib/audio/fileutil.c	(working copy)
@@ -103,9 +103,9 @@
 }
 
 char       *
-FileCommentFromFilename(_FileConst char *fname)
+FileCommentFromFilename(const char *fname)
 {
-    _FileConst char *f;
+    const char *f;
     char       *t;
 
     /* ignore piped files */
Index: lib/audio/fileutil.h
===================================================================
--- lib/audio/fileutil.h	(revision 225)
+++ lib/audio/fileutil.h	(working copy)
@@ -103,7 +103,7 @@
 
 extern char	*
 FileCommentFromFilename(
-                        _FileConst char	*		/* file name */
+                        const char	*		/* file name */
 );
 
 _FUNCPROTOEND
Index: lib/audio/ConnSvr.c
===================================================================
--- lib/audio/ConnSvr.c	(revision 225)
+++ lib/audio/ConnSvr.c	(working copy)
@@ -149,7 +149,7 @@
                  int *auth_datalenp			/* RETURN */
                  );
 
-static char *copystring (register _AuConst char *src, int len)
+static char *copystring (register const char *src, int len)
 {
     char *dst = Aumalloc (len + 1);
 
@@ -306,7 +306,7 @@
  *     o  TCP to local host
  */
 int _AuConnectServer (
-    _AuConst char *server_name,
+    const char *server_name,
     char **fullnamep,			/* RETURN */
     int *svrnump,			/* RETURN */
     char **auth_namep,			/* RETURN */
@@ -318,7 +318,7 @@
     int family;
     int saddrlen;
     char *saddr;
-    _AuConst char *lastp, *p;		/* char pointers */
+    const char *lastp, *p;		/* char pointers */
     char *phostname = NULL;		/* start of host of server */
     char *psvrnum = NULL;		/* start of svrnum of server */
     const char *realtrans;		/* real audio transport prefix */
@@ -350,7 +350,7 @@
       if (*p == '/') {
 	    int len = (p - server_name);
 	    char tmptransport[41];
-	    register _AuConst char *src;
+	    register const char *src;
 	    register char *dst;
 
 	    if (len >= sizeof tmptransport)    /* too AuInt32 */
Index: lib/audio/audiolib.h
===================================================================
--- lib/audio/audiolib.h	(revision 225)
+++ lib/audio/audiolib.h	(working copy)
@@ -1013,9 +1013,9 @@
  * AuServerName - this routine returns the that the library will use to
  * locate the audio server.
  */
-extern _AuConst char * AUCDECL
+extern const char * AUCDECL
 AuServerName(
-	     _AuConst char *			/* servername */
+	     const char *			/* servername */
 );
 
 /*
@@ -1024,11 +1024,11 @@
  */
 extern AuServer * AUCDECL
 AuOpenServer(
-	     _AuConst char *,			/* servername */
+	     const char *,			/* servername */
 	     int,				/* num_authproto */
-	     _AuConst char *,			/* authproto */
+	     const char *,			/* authproto */
 	     int,				/* num_authdata */
-	     _AuConst char *,			/* authdata */
+	     const char *,			/* authdata */
 	     char **				/* server_message */
 );
 
@@ -1117,9 +1117,9 @@
 extern void AUCDECL
 AuGetErrorDatabaseText(
 		       AuServer *,		/* server */
-		       _AuConst char *,		/* name */
-		       _AuConst char *,		/* message */
-		       _AuConst char *,		/* default_string */
+		       const char *,		/* name */
+		       const char *,		/* message */
+		       const char *,		/* default_string */
 		       char *,			/* buffer_return */
 		       int			/* length */
 );
Index: lib/audio/aiff.c
===================================================================
--- lib/audio/aiff.c	(revision 225)
+++ lib/audio/aiff.c	(working copy)
@@ -236,7 +236,7 @@
 }
 
 AiffInfo       *
-AiffOpenFileForReading(_AiffConst char *name)
+AiffOpenFileForReading(const char *name)
 {
     AiffInfo       *ai;
     AiffChunk       ck;
@@ -349,7 +349,7 @@
 
 AiffInfo       *
 AiffOpenFileForWriting(
-                       _AiffConst char *name,
+                       const char *name,
                        AiffInfo       *ai
 
                        )
Index: lib/audio/aiff.h
===================================================================
--- lib/audio/aiff.h	(revision 225)
+++ lib/audio/aiff.h	(working copy)
@@ -86,12 +86,12 @@
 
 extern AiffInfo *
 AiffOpenFileForReading(
-		       _AiffConst char *	/* file name */
+		       const char *		/* file name */
 );
 
 extern AiffInfo *
 AiffOpenFileForWriting(
-		       _AiffConst char *,	/* file name */
+		       const char *,		/* file name */
 		       AiffInfo *		/* info */
 );
 
Index: lib/audio/soundlib.c
===================================================================
--- lib/audio/soundlib.c	(revision 225)
+++ lib/audio/soundlib.c	(working copy)
@@ -42,7 +42,7 @@
 AuBucketID
 AuSoundCreateBucketFromFile(
                             AuServer       *aud,
-                            _SoundConst char *filename,
+                            const char *filename,
                             AuUint32   access,
                             AuBucketAttributes **ret_attr,
                             AuStatus       *ret_status
@@ -119,7 +119,7 @@
 AuBool
 AuSoundCreateFileFromBucket(
                             AuServer       *aud,
-                            _AuConst char  *filename,
+                            const char  *filename,
                             int             fileFormat,
                             AuBucketID      bucket,
                             AuStatus       *ret_status
@@ -694,7 +694,7 @@
 AuEventHandlerRec *
 AuSoundPlayFromFile(
                     AuServer       *aud,
-                    _AuConst char  *filename,
+                    const char  *filename,
                     AuDeviceID      device,
                     AuFixedPoint    volume,
                     AuSoundCallback callback,
@@ -751,7 +751,7 @@
 AuEventHandlerRec *
 AuSoundRecordToFile(
                     AuServer       *aud,
-                    _AuConst char  *filename,
+                    const char  *filename,
                     AuDeviceID      device,
                     AuFixedPoint    gain,
                     AuSoundCallback callback,
@@ -778,7 +778,7 @@
 AuEventHandlerRec *
 AuSoundRecordToFileN(
                      AuServer       *aud,
-                     _AuConst char  *filename,
+                     const char  *filename,
                      AuDeviceID      device,
                      AuFixedPoint    gain,
                      AuUint32 numSamples,
@@ -868,7 +868,7 @@
 AuBool
 AuSoundPlaySynchronousFromFile(
                                AuServer       *aud,
-                               _AuConst char  *fname,
+                               const char  *fname,
                                int             volume
                                )
 {
Index: lib/audio/soundlib.h
===================================================================
--- lib/audio/soundlib.h	(revision 225)
+++ lib/audio/soundlib.h	(working copy)
@@ -106,7 +106,7 @@
 extern          AuBucketID
 AuSoundCreateBucketFromFile(
 			    AuServer *,		/* server */
-			    _AuConst char *,	/* filename */
+			    const char *,	/* filename */
 			    AuUint32,	/* access */
 			    AuBucketAttributes **,	/* RETURN_attributes */
 			    AuStatus *		/* RETURN_status */
@@ -115,7 +115,7 @@
 extern          AuBool
 AuSoundCreateFileFromBucket(
 			    AuServer *,		/* server */
-			    _AuConst char *,	/* filename */
+			    const char *,	/* filename */
 			    int,		/* file format */
 			    AuBucketID,		/* bucket */
 			    AuStatus *		/* RETURN_status */
@@ -168,7 +168,7 @@
 extern AuEventHandlerRec *
 AuSoundPlayFromFile(
 		    AuServer *,			/* server */
-		    _AuConst char *,		/* filename */
+		    const char *,		/* filename */
 		    AuDeviceID,			/* destination */
 		    AuFixedPoint,		/* volume */
 		    AuSoundCallback,		/* done_callback */
@@ -212,7 +212,7 @@
 extern AuEventHandlerRec *
 AuSoundRecordToFile(
 		    AuServer *,			/* server */
-		    _AuConst char *,		/* filename */
+		    const char *,		/* filename */
 		    AuDeviceID,			/* source */
 		    AuFixedPoint,		/* gain */
 		    AuSoundCallback,		/* done_callback */
@@ -230,7 +230,7 @@
 extern AuEventHandlerRec *
 AuSoundRecordToFileN(
 		    AuServer *,			/* server */
-		    _AuConst char *,		/* filename */
+		    const char *,		/* filename */
 		    AuDeviceID,			/* source */
 		    AuFixedPoint,		/* gain */
                     AuUint32,		        /* num samples */	
@@ -249,7 +249,7 @@
 extern          AuBool
 AuSoundPlaySynchronousFromFile(
 			       AuServer *,	/* server */
-			       _AuConst char *,	/* filename */
+			       const char *,	/* filename */
 			       int		/* volume */
 );
 
Index: lib/audio/snd.c
===================================================================
--- lib/audio/snd.c	(revision 225)
+++ lib/audio/snd.c	(working copy)
@@ -126,7 +126,7 @@
 }
 
 SndInfo        *
-SndOpenFileForReading(_SndConst char *name)
+SndOpenFileForReading(const char *name)
 {
     SndInfo        *si;
     int             size;
@@ -192,7 +192,7 @@
 
 SndInfo        *
 SndOpenFileForWriting(
-                      _SndConst char *name,
+                      const char *name,
                       SndInfo        *si
                       )
 {
Index: lib/audio/Alibint.h
===================================================================
--- lib/audio/Alibint.h	(revision 225)
+++ lib/audio/Alibint.h	(working copy)
@@ -706,7 +706,7 @@
 
 int
 _AuConnectServer(
-    _AuConst char *, 		/* server_name */
+    const char *, 		/* server_name */
     char **, 			/* fullnamep */
     int *, 			/* svrnump */
     char **, 			/* auth_namep */
Index: lib/audio/sound.c
===================================================================
--- lib/audio/sound.c	(revision 225)
+++ lib/audio/sound.c	(working copy)
@@ -107,7 +107,7 @@
 #undef _oo
 #undef _VOIDP_
 
-_SoundConst int SoundNumFileFormats =
+const int SoundNumFileFormats =
 (sizeof(_SoundFileInfo) / sizeof(_SoundFileInfo[0]));
 
 char *SoundFileFormatString(Sound s)
@@ -375,7 +375,7 @@
 }
 
 Sound
-SoundOpenFileForReading(_SoundConst char *name)
+SoundOpenFileForReading(const char *name)
 {
     Sound           s;
     int             i;
@@ -407,7 +407,7 @@
 
 Sound
 SoundOpenFileForWriting(
-                        _SoundConst char *name,
+                        const char *name,
                         Sound           s
                         )
 {
@@ -501,7 +501,7 @@
             int numTracks,
             int sampleRate,
             int numSamples,
-            _SoundConst char *comment
+            const char *comment
             )
 {
     Sound           s;
@@ -561,7 +561,7 @@
 }
 
 int
-SoundStringToFileFormat(_SoundConst char *s)
+SoundStringToFileFormat(const char *s)
 {
     int             i;
 
@@ -573,7 +573,7 @@
 }
 
 int
-SoundAbbrevToFileFormat(_SoundConst char *s)
+SoundAbbrevToFileFormat(const char *s)
 {
     int             i;
 
Index: lib/audio/snd.h
===================================================================
--- lib/audio/snd.h	(revision 225)
+++ lib/audio/snd.h	(working copy)
@@ -34,11 +34,7 @@
 #include <audio/audio.h>	/* for AuInt32 and AuUint32 */
 
 #ifndef _SndConst
-#if __STDC__ || defined(__cplusplus) || defined(c_plusplus) || (FUNCPROTO&4)
 #define _SndConst const
-#else
-#define _SndConst				/**/
-#endif
 #endif						/* _SndConst */
 
 #ifndef _FUNCPROTOBEGIN
@@ -119,12 +115,12 @@
 
 extern SndInfo *
 SndOpenFileForReading(
-		      _SndConst char *		/* file name */
+		      const char *		/* file name */
 );
 
 extern SndInfo *
 SndOpenFileForWriting(
-		      _SndConst char *,		/* file name */
+		      const char *,		/* file name */
 		      SndInfo *			/* info */
 );
 
Index: lib/audio/OpenSvr.c
===================================================================
--- lib/audio/OpenSvr.c	(revision 225)
+++ lib/audio/OpenSvr.c	(working copy)
@@ -68,16 +69,16 @@
  * the newly created AuServer back to the caller.
  */
 AuServer *AuOpenServer (
-	register _AuConst char *server,
+	register const char *server,
 	int num_authproto,
-	_AuConst char *authproto,
+	const char *authproto,
 	int num_authdata,
-	_AuConst char *authdata,
+	const char *authdata,
 	char **ret_svrmsg)
 {
 	register AuServer *aud;		/* New AuServer object being created */
 	register int i;
-	_AuConst char *server_name;	/* pointer to server name */
+	const char *server_name;	/* pointer to server name */
 	int endian;			/* to determine which endian. */
 	auConnClientPrefix client;	/* client information */
 	auConnSetupPrefix prefix;	/* prefix information */
Index: lib/audio/sound.h
===================================================================
--- lib/audio/sound.h	(revision 225)
+++ lib/audio/sound.h	(working copy)
@@ -37,11 +37,7 @@
 #include	<audio/audio.h>
 
 #ifndef _SoundConst
-#if __STDC__ || defined(__cplusplus) || defined(c_plusplus) || (FUNCPROTO&4)
 #define _SoundConst const
-#else
-#define _SoundConst				/**/
-#endif
 #endif						/* _SoundConst */
 
 #ifndef _FUNCPROTOBEGIN
@@ -95,12 +91,12 @@
 
 extern          Sound
 SoundOpenFileForReading(
-			_SoundConst char *	/* file name */
+			const char *		/* file name */
 );
 
 extern          Sound
 SoundOpenFileForWriting(
-			_SoundConst char *,	/* file name */
+			const char *,		/* file name */
 			Sound			/* sound */
 );
 
@@ -132,17 +128,17 @@
 	    int,				/* num tracks */
 	    int,				/* sample rate */
 	    int,				/* num samples */
-	    _SoundConst char *			/* comment */
+	    const char *			/* comment */
 );
 
 extern int
 SoundStringToFileFormat(
-			_SoundConst char *	/* string */
+			const char *		/* string */
 );
 
 extern int
 SoundAbbrevToFileFormat(
-			_SoundConst char *	/* string */
+			const char *		/* string */
 );
 
 extern int
@@ -220,6 +216,6 @@
 
 extern SoundFileInfoProc SoundFileGetProc(int format, int proc);
 
-extern _SoundConst int SoundNumFileFormats;
+extern const int SoundNumFileFormats;
 
 #endif						/* _SOUND_H_ */
Index: lib/audio/wave.c
===================================================================
--- lib/audio/wave.c	(revision 225)
+++ lib/audio/wave.c	(working copy)
@@ -66,7 +66,7 @@
 }
 
 WaveInfo       *
-WaveOpenFileForReading(_WaveConst char *name)
+WaveOpenFileForReading(const char *name)
 {
     RiffChunk       ck;
     RIFF_FOURCC     fourcc;
@@ -197,7 +197,7 @@
 
 WaveInfo       *
 WaveOpenFileForWriting(
-                       _WaveConst char *name,
+                       const char *name,
                        WaveInfo       *wi
                        )
 {
Index: lib/audio/wave.h
===================================================================
--- lib/audio/wave.h	(revision 225)
+++ lib/audio/wave.h	(working copy)
@@ -31,17 +31,8 @@
 
 #include <audio/audio.h>	/* for AuInt32 and AuUint32 */
 
-/*
- * If we are being used outside the NCD-AUDIO sound library, then we'll need
- * some ANSIfication definitions.
- */
-
 #ifndef _WaveConst
-#if __STDC__ || defined(__cplusplus) || defined(c_plusplus) || (FUNCPROTO&4)
 #define _WaveConst const
-#else
-#define _WaveConst				/**/
-#endif
 #endif						/* _WaveConst */
 
 #ifndef _FUNCPROTOBEGIN
@@ -103,12 +94,12 @@
 
 extern WaveInfo *
 WaveOpenFileForReading(
-		       _WaveConst char *	/* file name */
+		       const char *		/* file name */
 );
 
 extern WaveInfo *
 WaveOpenFileForWriting(
-		       _WaveConst char *,	/* file name */
+		       const char *,		/* file name */
 		       WaveInfo *		/* info */
 );
 
Index: lib/audio/Util.c
===================================================================
--- lib/audio/Util.c	(revision 225)
+++ lib/audio/Util.c	(working copy)
@@ -207,7 +207,7 @@
     "AuFormatLinearUnsigned16LSB",
   };
 
-_AuConst char  *
+const char  *
 AuFormatToString(unsigned int format)
 {
     int             i;
@@ -220,7 +220,7 @@
 }
 
 int
-AuStringToFormat(_AuConst char *s)
+AuStringToFormat(const char *s)
 {
     int             i;
 
@@ -231,7 +231,7 @@
     return -1;
 }
 
-_AuConst char  *
+const char  *
 AuFormatToDefine(unsigned int format)
 {
     int             i;
@@ -244,7 +244,7 @@
 }
 
 int
-AuDefineToFormat(_AuConst char *s)
+AuDefineToFormat(const char *s)
 {
     int             i;
 
@@ -267,7 +267,7 @@
     AuWaveFormConstant, "Constant",
   };
 
-_AuConst char  *
+const char  *
 AuWaveFormToString(unsigned int waveform)
 {
     int             i;
@@ -280,7 +280,7 @@
 }
 
 int
-AuStringToWaveForm(_AuConst char *s)
+AuStringToWaveForm(const char *s)
 {
     int             i;
 
Index: lib/audio/voc.c
===================================================================
--- lib/audio/voc.c	(revision 225)
+++ lib/audio/voc.c	(working copy)
@@ -56,7 +56,7 @@
 }
 
 VocInfo        *
-VocOpenFileForReading(_VocConst char *name)
+VocOpenFileForReading(const char *name)
 {
     VocInfo        *vi;
     int             c,
@@ -154,7 +154,7 @@
 
 VocInfo        *
 VocOpenFileForWriting(
-                      _VocConst char *name,
+                      const char *name,
                       VocInfo        *vi
                       )
 {
Index: lib/audio/voc.h
===================================================================
--- lib/audio/voc.h	(revision 225)
+++ lib/audio/voc.h	(working copy)
@@ -27,17 +27,8 @@
 
 #include <audio/audio.h>			/* for AuInt32 and AuUint32 */
 
-/*
- * If we are being used outside the NCD-AUDIO sound library, then we'll need
- * some ANSIfication definitions.
- */
-
 #ifndef _VocConst
-#if __STDC__ || defined(__cplusplus) || defined(c_plusplus) || (FUNCPROTO&4)
 #define _VocConst const
-#else
-#define _VocConst				/**/
-#endif
 #endif						/* _VocConst */
 
 #ifndef _FUNCPROTOBEGIN
@@ -88,12 +79,12 @@
 
 extern VocInfo *
 VocOpenFileForReading(
-		      _VocConst char *		/* file name */
+		      const char *		/* file name */
 );
 
 extern VocInfo *
 VocOpenFileForWriting(
-		      _VocConst char *,		/* file name */
+		      const char *,		/* file name */
 		      VocInfo *			/* info */
 );
 

From stefan at huehner.org  Wed Aug 30 06:23:23 2006
From: stefan at huehner.org (Stefan Huehner)
Date: Wed, 30 Aug 2006 14:23:23 +0200
Subject: [nas] [patch] remove exported NoopDDA function
Message-ID: <20060830122323.GC13773@pro4u.org>

Hi,

there is a empty NoopDDA function in dixutils.c which is exported and
listed in dix.h but only used in one place: resource.c . This patch
moves this functions to resource.c and modifies the parameters/return
value to match the expected values there.

Please check and consider applying.

Regards,
Stefan

-------------- next part --------------
Index: server/include/dix.h
===================================================================
--- server/include/dix.h	(revision 225)
+++ server/include/dix.h	(working copy)
@@ -84,6 +84,4 @@
 extern int currentMaxClients;
 extern long *checkForInput[2];
 
-extern void NoopDDA();
-
 #endif /* DIX_H */
Index: server/dia/dixutils.c
===================================================================
--- server/dia/dixutils.c	(revision 225)
+++ server/dia/dixutils.c	(working copy)
@@ -54,16 +54,6 @@
 
 extern void IgnoreClient(), AttendClient();
 
-/* No-op Don't Do Anything : sometimes we need to be able to call a procedure
- * that doesn't do anything.  For example, on screen with only static
- * colormaps, if someone calls install colormap, it's easier to have a dummy
- * procedure to call than to check if there's a procedure 
- */
-void
-NoopDDA()
-{
-}
-
 /*
  * A general work queue.  Perform some task before the server
  * sleeps for input.
Index: server/dia/resource.c
===================================================================
--- server/dia/resource.c	(revision 225)
+++ server/dia/resource.c	(working copy)
@@ -110,6 +110,7 @@
 static void RebuildTable(int client);
 
 typedef int (*DeleteType) ();
+static int DeleteFuncNoop(void) { return 0; }; /* do nothing delete function */
 
 static DeleteType *DeleteFuncs = (DeleteType *) NULL;
 
@@ -166,7 +167,7 @@
                                             sizeof(DeleteType));
         if (!DeleteFuncs)
             return FALSE;
-        DeleteFuncs[RT_NONE & TypeAuMask] = (int (*)()) NoopDDA;
+        DeleteFuncs[RT_NONE & TypeAuMask] = DeleteFuncNoop;
     }
     clientTable[i = client->index].resources =
             (ResourcePtr *) xalloc(INITBUCKETS * sizeof(ResourcePtr));

From auerswal at unix-ag.uni-kl.de  Wed Aug 30 15:36:53 2006
From: auerswal at unix-ag.uni-kl.de (Erik Auerswald)
Date: Wed, 30 Aug 2006 23:36:53 +0200
Subject: [nas] [patch] remove exported NoopDDA function
In-Reply-To: <20060830122323.GC13773@pro4u.org>
References: <20060830122323.GC13773@pro4u.org>
Message-ID: <20060830213653.GA31510@sushi.unix-ag.uni-kl.de>

Hi,

On Wed, Aug 30, 2006 at 02:23:23PM +0200, Stefan Huehner wrote:
> there is a empty NoopDDA function in dixutils.c which is exported and
> listed in dix.h but only used in one place: resource.c . This patch
> moves this functions to resource.c and modifies the parameters/return
> value to match the expected values there.

The DeleteFuncs seem to be of type (int *) (pointer, AuID), not
(int *) (void).

Erik


From jon at radscan.com  Wed Aug 30 18:48:25 2006
From: jon at radscan.com (Jon Trulson)
Date: Wed, 30 Aug 2006 18:48:25 -0600 (MDT)
Subject: [nas] [patch] remove/simplify _AuConst part2
In-Reply-To: <20060830121737.GB13773@pro4u.org>
References: <20060830121737.GB13773@pro4u.org>
Message-ID: <Pine.LNX.4.61.0608301848160.15908@m5.radscan.com>

On Wed, 30 Aug 2006, Stefan Huehner wrote:

> Hi,
>
> attached is part two of the _.*Const removal patch. Some more defines of
> _.*Const were removed which have been missed by the last patch and the
> interval usage of _.*Const has been simplified to just use const.
>

         Applied.


-- 
Jon Trulson
mailto:jon at radscan.com http://radscan.com/~jon
#include <std/disclaimer.h>
"No Kill I" -Horta



From jon at radscan.com  Wed Aug 30 18:48:05 2006
From: jon at radscan.com (Jon Trulson)
Date: Wed, 30 Aug 2006 18:48:05 -0600 (MDT)
Subject: [nas] [patch] remove exported NoopDDA function
In-Reply-To: <20060830213653.GA31510@sushi.unix-ag.uni-kl.de>
References: <20060830122323.GC13773@pro4u.org> <20060830213653.GA31510@sushi.unix-ag.uni-kl.de>
Message-ID: <Pine.LNX.4.61.0608301817250.15908@m5.radscan.com>

On Wed, 30 Aug 2006, Erik Auerswald wrote:

> Hi,
>
> On Wed, Aug 30, 2006 at 02:23:23PM +0200, Stefan Huehner wrote:
>> there is a empty NoopDDA function in dixutils.c which is exported and
>> listed in dix.h but only used in one place: resource.c . This patch
>> moves this functions to resource.c and modifies the parameters/return
>> value to match the expected values there.
>
> The DeleteFuncs seem to be of type (int *) (pointer, AuID), not
> (int *) (void).
>

         Erik is correct...

         I did not apply this patch anyways, as it really *is* useful
         to have a no-op callback in dix (ahem, sorry: dia :).  Athough
         it is only being used internally in one place at the moment,
         it will be useful to have if extensions or other server
         modifications are ever made that create and manipulate new
         server resources - so I think we should leave it alone...

         I did, however, go though and fix the appropriate typedef, and
         correct the various build issues that entailed :)

-- 
Jon Trulson
mailto:jon at radscan.com http://radscan.com/~jon
#include <std/disclaimer.h>
"No Kill I" -Horta



From stefan at huehner.org  Thu Aug 31 05:34:05 2006
From: stefan at huehner.org (Stefan Huehner)
Date: Thu, 31 Aug 2006 13:34:05 +0200
Subject: [nas] [patch] remove exported NoopDDA function
In-Reply-To: <20060830213653.GA31510@sushi.unix-ag.uni-kl.de>
References: <20060830122323.GC13773@pro4u.org> <20060830213653.GA31510@sushi.unix-ag.uni-kl.de>
Message-ID: <20060831113405.GE13773@pro4u.org>

On Wed, Aug 30, 2006 at 11:36:53PM +0200, Erik Auerswald wrote:
> Hi,
> 
> The DeleteFuncs seem to be of type (int *) (pointer, AuID), not
> (int *) (void).

Thanks for catching this.



From stefan at huehner.org  Thu Aug 31 05:37:26 2006
From: stefan at huehner.org (Stefan Huehner)
Date: Thu, 31 Aug 2006 13:37:26 +0200
Subject: [nas] [patch] remove exported NoopDDA function
In-Reply-To: <Pine.LNX.4.61.0608301817250.15908@m5.radscan.com>
References: <20060830122323.GC13773@pro4u.org> <20060830213653.GA31510@sushi.unix-ag.uni-kl.de> <Pine.LNX.4.61.0608301817250.15908@m5.radscan.com>
Message-ID: <20060831113726.GF13773@pro4u.org>

On Wed, Aug 30, 2006 at 06:48:05PM -0600, Jon Trulson wrote:
> On Wed, 30 Aug 2006, Erik Auerswald wrote:
> 
>         I did, however, go though and fix the appropriate typedef, and
>         correct the various build issues that entailed :)

Ack,
but can you please do seperate commit for different topics, aka patches.
Would it make mor easier to track whats changed between someone
submitting a patch and the committed version.

Regards,
Stefan



From stefan at huehner.org  Thu Aug 31 05:57:16 2006
From: stefan at huehner.org (Stefan Huehner)
Date: Thu, 31 Aug 2006 13:57:16 +0200
Subject: [nas] [patch] mark some readonly string/params as const
Message-ID: <20060831115716.GG13773@pro4u.org>

Hi,

attached patch marks some read-only string and function parameters as
'const char*' instead of 'char *'. In Addition an unsued buffer
'errfile' from aulog.c was removed.
As the two release.h files are generated the NetAudio.tmpl was modified
to emit the 'const char *' declaration.

Regards,
Stefan
-------------- next part --------------
Index: config/NetAudio.tmpl
===================================================================
--- config/NetAudio.tmpl	(revision 226)
+++ config/NetAudio.tmpl	(working copy)
@@ -285,7 +285,7 @@
 #ifndef WIN32
 #define BuildReleaseHeader()						    @@\
 release.h: $(TOP)/RELEASE				    		    @@\
-	@echo "static char *release = \"`cat $(TOP)/RELEASE`\";" > $@   @@\
+	@echo "static const char *release = \"`cat $(TOP)/RELEASE`\";" > $@   @@\
 						    			    @@\
 depend:: release.h				    			    @@\
 						    			    @@\
@@ -294,7 +294,7 @@
 #else /* WIN32 */
 #define BuildReleaseHeader()						    @@\
 release.h: $(TOP)/RELEASE				    		    @@\
-	@echo static char *release = "Windows NT"; > $@   		    @@\
+	@echo static const char *release = "Windows NT"; > $@   		    @@\
 						    			    @@\
 depend:: release.h				    			    @@\
 						    			    @@\
Index: server/os/aulog.c
===================================================================
--- server/os/aulog.c	(revision 226)
+++ server/os/aulog.c	(working copy)
@@ -21,11 +21,10 @@
 #endif
 
 void
-osLogMsg(char *fmt, ...)
+osLogMsg(const char *fmt, ...)
 {
     va_list ap;
     static char buf[LOG_BUFSIZE];
-    static char errfile[LOG_FILENMSZ];
     static FILE *errfd = NULL;
 
     va_start(ap, fmt);
Index: server/os/aulog.h
===================================================================
--- server/os/aulog.h	(revision 226)
+++ server/os/aulog.h	(working copy)
@@ -12,6 +12,6 @@
 #define LOG_BUFSIZE 4096
 #define LOG_FILENMSZ 1024
 
-void osLogMsg(char *fmt, ...);
+void osLogMsg(const char *fmt, ...);
 
 #endif /* AULOG_H_INCLUDED */
Index: server/dia/main.c
===================================================================
--- server/dia/main.c	(revision 226)
+++ server/dia/main.c	(working copy)
@@ -89,7 +89,7 @@
  */
 
 static FILE *
-openConfigFile(char *path)
+openConfigFile(const char *path)
 {
     FILE *config;
 
@@ -104,7 +104,7 @@
 main(int argc, char *argv[])
 {
     int i;
-    char *config_file;
+    const char *config_file;
 
     /* Notice if we're restart.  Probably this is because we jumped through
      * uninitialized pointer */
Index: server/dia/audispatch.c
===================================================================
--- server/dia/audispatch.c	(revision 226)
+++ server/dia/audispatch.c	(working copy)
@@ -1514,7 +1514,7 @@
 AuInitSetupReply()
 {
     int len;
-    char *rel = release;
+    const char *rel = release;
     static char *string;
 
     if (!AuInitDevice(&auSetup, &len))

From jon at radscan.com  Thu Aug 31 23:52:08 2006
From: jon at radscan.com (Jon Trulson)
Date: Thu, 31 Aug 2006 23:52:08 -0600 (MDT)
Subject: [nas] [patch] remove exported NoopDDA function
In-Reply-To: <20060831113726.GF13773@pro4u.org>
References: <20060830122323.GC13773@pro4u.org> <20060830213653.GA31510@sushi.unix-ag.uni-kl.de>
 <Pine.LNX.4.61.0608301817250.15908@m5.radscan.com> <20060831113726.GF13773@pro4u.org>
Message-ID: <Pine.LNX.4.61.0608312351450.23652@m5.radscan.com>

On Thu, 31 Aug 2006, Stefan Huehner wrote:

> On Wed, Aug 30, 2006 at 06:48:05PM -0600, Jon Trulson wrote:
>> On Wed, 30 Aug 2006, Erik Auerswald wrote:
>>
>>         I did, however, go though and fix the appropriate typedef, and
>>         correct the various build issues that entailed :)
>
> Ack,
> but can you please do seperate commit for different topics, aka patches.
> Would it make mor easier to track whats changed between someone
> submitting a patch and the committed version.


   Sure.

-- 
Jon Trulson
mailto:jon at radscan.com http://radscan.com/~jon
#include <std/disclaimer.h>
"No Kill I" -Horta



From jon at radscan.com  Thu Aug 31 23:57:42 2006
From: jon at radscan.com (Jon Trulson)
Date: Thu, 31 Aug 2006 23:57:42 -0600 (MDT)
Subject: [nas] [patch] mark some readonly string/params as const
In-Reply-To: <20060831115716.GG13773@pro4u.org>
References: <20060831115716.GG13773@pro4u.org>
Message-ID: <Pine.LNX.4.61.0608312357230.23652@m5.radscan.com>

On Thu, 31 Aug 2006, Stefan Huehner wrote:

> Hi,
>
> attached patch marks some read-only string and function parameters as
> 'const char*' instead of 'char *'. In Addition an unsued buffer
> 'errfile' from aulog.c was removed.
> As the two release.h files are generated the NetAudio.tmpl was modified
> to emit the 'const char *' declaration.

   Applied, thanks.

-- 
Jon Trulson
mailto:jon at radscan.com http://radscan.com/~jon
#include <std/disclaimer.h>
"No Kill I" -Horta



