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

Paul Fox pgf at foxharp.boston.ma.us
Thu Jul 27 07:01:28 MDT 2006


another couple of thoughts:

erik wrote:
 > On Wed, Jul 26, 2006 at 04:10:54AM +0200, Erik Auerswald wrote:
 > > > On Tue, 25 Jul 2006, Paul Fox wrote:
 > > > >erik wrote:
 > > > >> Several programs can use the mixer device at the same time so this
 > > > >> should not be problematic.
 ...
 > > > >do you think it even needs to be configurable?  any reason not to
 ...
 > > I'd say it does not need to be configurable. I've just checked the OSS
 > > programming manual and it's official that several programms can open the
 > > mixer device at the same time. And I agree that a seperate boolean
 > > should be used if it should be configurable nevertheless.
 > 
 > There was already a variable to control this (but no code did use it).
 > The attached patch implements this config variable for the voxware
 > server.

if neither of us thinks this needs to be configurable, so we
really need the new configuration variable?  ;-)  it's fine if 
you've decided its needed, but i'd rather not add knobs if we
don't need them.



i notice that when writing, we do this:
    gusvolume = g | (g << 8);
    if (mixerfd != -1)
        if (ioctl(mixerfd, MIXER_WRITE(SOUND_MIXER_PCM), &gusvolume) == -1)
            osLogMsg("setPhysicalOutputGain: "
                     "%s: ioctl(MIXER_WRITE(SOUND_MIXER_PCM)) failed: %s\n",
                     sndStatOut.mixer, strerror(errno));

but when reading, you do this:
 > +        if (ioctl(mixerfd, 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));
 > +        }
 > +        pcm_level = pcm_level >> 8;

is this tossing out one channel of level?  (i need to find a
voxware manual.) if so, i think that instead we should average
the two channels, in case someone set them very differently:
         gain = ((pcm_level & 0xff) + ((pcm_level >> 8 ) & 0xff)) / 2 ;
or something like that.

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



More information about the Nas mailing list