[nas] [PATCH] changed method of setting the input gain
Paul Fox
pgf at foxharp.boston.ma.us
Thu Jul 27 06:46:53 MDT 2006
erik wrote:
> > 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.
documentation thought: i think we need to start stating, in both
the man page and in the config file comments, what the default
behavior is for each of our booleans. there's a tendency to edit
the originally-installed file to make changes, and then any
indication of the server default is lost.
>
> > > If this can be done (track mixer changes), and mixer usage is
> > > configured to be allowed, then it should 'just work', no
> > > option neccessary. IMO of course.
> >
> > That can be done. In the getPhysical* functions the mixer can be
> > queried. We would not need the last* variables any more (I think). I've
> > already tested this for the output gain and can come up with a patch.
> > I'll wait for the re-indentation patch first. ;-)
>
> The patch is attached to this mail. It is not without issues, though:
one change: when reading the gain, you have to do inverse gain scaling:
--- server/dda/voxware/auvoxware.c.erik Thu Jul 27 08:18:38 2006
+++ server/dda/voxware/auvoxware.c Thu Jul 27 08:21:29 2006
@@ -361,6 +361,11 @@
sndStatOut.mixer, mixerfd, strerror(errno));
}
pcm_level = pcm_level >> 8;
+ if (sndStatOut.gainScale ) {
+ pcm_level *= 100;
+ pcm_level /= sndStatOut.gainScale;
+ if (pcm_level > 100) pcm_level = 100;
+ }
} else {
pcm_level = sndStatOut.gain;
}
the tracking seems to work for me, after applying this. thanks!
another question though: i haven't tried it, but since you've
eliminated the last* variables, if the mixer is closed, you
always report the default sndStatOut.mixer. but if the user sets
keepmixer to false, doesn't this mean that no nas-based mixer can
report a true value? i'm confused. (in fact, i did just try
setting keepmixer to "no", and sure enough, my "audiooss aumix"
is now locked at 50%. oh. wait. i didn't have a stream
playing. if i play a stream, then the nas mixer works correctly.
is the total lockout when the pcm device isn't open the expected
behavior? i thought it would work like it did before.
> When reading the IGain value from the mixer the ioctl returns -1 with
> errno == 0 (success) most of the time. The value was read correctly
> every time I tested this regardless of error reported. I have no idea
> why this happens. The patch works for me, it justs spams the logfiles
> with lots of error: success messages. I was using aupanel to control the
> NAS mixer, I did not check if auctl behaves the same (it should).
my logs look like this. i got one "success" message, but a bunch of
EINTR. calls. not sure what those are from.
Jul 27 08:22:53 localhost nas[22959]: Network Audio System Release 1.8
Jul 27 08:22:53 localhost nas[22960]: Init: Input open(/dev/dsp1) failed: No such device, using output device
Jul 27 08:23:05 localhost nas[22960]: readMixerInputGain: /dev/mixer: ioctl(MIXER_READ(SOUND_MIXER_IGAIN)) failed: No such device
Jul 27 08:23:05 localhost nas[22960]: readMixerInputGain: /dev/mixer: ioctl(MIXER_READ(SOUND_MIXER_IGAIN)) failed: No such file or directory
Jul 27 08:23:05 localhost nas[22960]: readMixerInputGain: /dev/mixer: ioctl(MIXER_READ(SOUND_MIXER_IGAIN)) failed: No such file or directory
Jul 27 08:23:13 localhost nas[22960]: readMixerInputGain: /dev/mixer: ioctl(MIXER_READ(SOUND_MIXER_IGAIN)) failed: Interrupted system call
Jul 27 08:23:15 localhost last message repeated 4 times
Jul 27 08:23:16 localhost nas[22960]: readMixerInputGain: /dev/mixer: ioctl(MIXER_READ(SOUND_MIXER_IGAIN)) failed: Success
Jul 27 08:23:16 localhost nas[22960]: readMixerInputGain: /dev/mixer: ioctl(MIXER_READ(SOUND_MIXER_IGAIN)) failed: Interrupted system call
Jul 27 08:23:43 localhost last message repeated 16 times
Jul 27 08:24:38 localhost last message repeated 9 times
Jul 27 08:26:18 localhost nas[22960]: readMixerInputGain: /dev/mixer: ioctl(MIXER_READ(SOUND_MIXER_IGAIN)) failed: No such file or directory
paul
=---------------------
paul fox, pgf at foxharp.boston.ma.us (arlington, ma, where it's 70.3 degrees)
More information about the Nas
mailing list