[nas] [PATCH] changed method of setting the input gain

Erik Auerswald auerswal at unix-ag.uni-kl.de
Mon Jul 24 20:07:08 MDT 2006


Hi,

On Mon, Jul 24, 2006 at 06:53:44PM -0600, Jon Trulson wrote:
> On Mon, 24 Jul 2006, Paul Fox wrote:
> >i wrote:
> >> erik wrote:
> >>  > On Sun, Jul 23, 2006 at 10:29:07PM -0600, Jon Trulson wrote:
> >>  > >         Hmm... It should setup default gains and recsrc if mixerinit
> >>  > >         is true.
> >>  >
> >>  > That's my opinion as well.
> >>  >
> >>  > >         It should probaby setup these defaults every time it
> >>  > >         opens the device, shouldn't it?
> >>  >
> >>  > I don't think so. The defaults should be applied the first time the
> >>  > device is opened. After that the last set values should be activated
> >>  > (what is done now to keep the changes made while the device was
> >>  > released).
> >>
> >> but isn't the point of releasing the device that you want to play
> >> well with other users of the device?  in that case, shouldn't you
> >> touch nothing at all on a re-acquire of the device?  seems to me
> >> the server should query the device for current settings when it
> >> re-opens, and start from there.
> >
> >looking at the code (for other reasons) i see that this is
> >complicated by the fact that auvoxware.c goes out of its way to
> >never ever read the current mixer settings.  it only writes to
> >them.  seems to me that if the device is being shared with other
> >applications, that nas should be sharing the levels as well.
> >
> 
>         But, aside from RECSRC and devmask, nas doesn't have to 'read'
>         the mixer (for example, the output gain).  Why would it?

Well, it _does_ already read them (and ignores them later on...). It
would want to to read them to use these values on startup instead of
it's own default values.

>         If some external app has set output gain to '50' and a nas app
>         sends data, it will use whatever the mixer is already setup at
>         (well it will :).  Right now it will simply write the
>         'default' gains in nasd.conf.

This is kind of a complicated matter... The NAS server will write it's
own gains (default or previously set) whenever opening a device or when
there is an open device and some app changes the settings. An external
app can alter the gain settings while NAS is playing without the NAS
server even noticing this.

>         Don't do that.  Again, your problem is not that NAS isn't
>         'reading' the mixer gains, it's that NAS is writing the
>         default gains to the device, without your express written
>         approval.

IMHO the NAS server should have some internal settings that are used
whenever playing a sound. To achieve this these settings have to be
written to the mixer whenever opening the device, because some other app
using it might have changed the settings. Then it is possible to control
NAS playback even with a released device and other (local) apps using
the same audio device when NAS is not playing/recording.

The MixerInit option should define whether or not the NAS default values
are used on NAS server startup.

A RestoreMixer option could be used to restore the previous values of
the audio device whenever it is closed by NAS. I don't think this is
needed, because the current mixer settings should be viewed as
"undefined" by every sound app and therefore set if some specific values
are needed (hence the default behaviour of NAS to set the default
gains).

A NoMixer option could be used to not change the mixer settings at all.
This could be useful when an external amplifier should be used to
control the volume. The internal amplifiers of most sound hardware are
of low quality, the Gravis Ultrasound even had a special output port
with fixed amplification because of this. I prefer to set my sound
hardware to some working values (without distorted sound) and use
external amplifiers to control the volume.

The effect of this option can be had with setting the mixer device to
something not a mixer (or not existing), but the NAS server still thinks
it can change the settings, NAS mixer applications will report changed
values but the mixer will not change.

If I understand Paul correctly he wants to be able to control the NAS
sound via NAS mixer applications but the NAS server to use the current
mixer settings whenever opening the device (losing the changes made by
NAS applications before). IMHO this should be a seperate Option (or a
seperate value for MixerInit ("startup", "reopen", "never" instead of
"yes", "no"). With these values "startup" is the same as "yes" and
"reopen" the same as "no".

Erik



More information about the Nas mailing list