[nas] isolate input/output?

Erik Auerswald auerswal at unix-ag.uni-kl.de
Sun Mar 11 06:09:06 MDT 2007


Hi,

On Sat, Mar 10, 2007 at 11:51:05PM -0500, Paul Fox wrote:
> as a reminder, i'm trying to configure an output-only nasd.  a
> different application will be opening the input side of the device.
> 
> erik wrote:
>  > Since version 1.8a the input- and output-devices can be totally
>  > independant, including the mixer (for the OSS NAS server).
>  > 
>  > You can set the mixer in the inputsection of the config file to the
>  > empty string ("") to disable any input gain control for NAS. The mixer
>  > settings will not be changed by nasd in this case.
>  > 
>  > If you set autoOpen to "no" in the input section, nasd will not even try
>  > to open an input device, unless some NAS client tries to read from the
>  > input device.
> 
> first, a typo bug in openDevice(), in auvoxware.c.

I think you're right, this is a typo.

> however, in practice,
> i don't think we ever execute this code.  (i found this by inspection --
> i can't make it fail.)

I'll take a look at it.

> but to get things to work, in addition to the things you said
> above, i also have to set the input device to /dev/null, and it's
> kind of complicate as to why.

This is kind of strange. While nasd always tries to open the input
device when a client connects to it, the device should be usable by
other applications whenever nasd has released it.

> setting it to either a nonexistent
> device (/dev/dsp1) or to the same device as output (/dev/dsp)
> causes nasd to loop 5 times, with timeout, when trying to open
> the input device.
>
> in the former case it's because the device
> doesn't exist, and in the latter, i think it's because the device
> is already open (for output).  

Setting a non-existant (as in test -e) input device results in a fallback
to the output device for input as well. Since your soundcard/driver
combination seems to be half duplex you see this looping behaviour when
trying to use it for in- and output simultaniously.

On my system this looks like this:

Init: openDevice OUT /dev/dsp mode 2
Init: openDevice(1) IN /dev/dsp2 mode 0
Init: Input open(/dev/dsp2) failed: No such file or directory, using
output device

(This works since the soundcard/driver combination supports full
duplex.)

Not even trying to use an input device is not supported by nasd (at
least in the voxware server).

> note that this looping i'm referring to all happens at client
> connection time, since i have autoOpen disabled.  things work
> better with autoOpen enabled, since in that case, failure to open
> the input device initially causes the "share_in_out" flag to be
> set, which suppresses later opens of the input device.

This should happen when connecting with an input client only, I'd assume
that a usable workaround is to never do so. As long as the device is
not kept open it should be usable by other apps (I did just test this by
starting nasd with /dev/dsp as in- and output device and then (without
NAS clients) doing a "cat /dev/dsp > recording" which worked).

If this should not work for you someone would need to write a patch
to implement disabling of th input (or rather one of output and input)
device...

Erik
-- 
Reality is that which, when you stop believing in it, doesn't go away.
                        -- Philip K. Dick



More information about the Nas mailing list