Audio loopback in linux kernel?

Stuart Levy slevy at ncsa.uiuc.edu
Mon Apr 3 11:19:30 CDT 2000


> >When line is non-zero, I can still hear myself, but when I set it
> >to zero, there's no evidence that I'm transmitting anything. Does that
> >make sense?
> 
> It does. The Crystal audio gear you've got may be AC97 compliant. AC97 
> specifies among other things the on-board mixer configuration. (see 
> http://www.ece.utexas.edu/~kettler/lecture2/sld040.htm for a block 
> diagram). In this mixer, the line level adjustment only changes the level 
> of the path from line in to line out.

Yeow!  That's interesting.  I think I've run into this before too -- there
seemed to be audio loopback active and I couldn't figure out where it was
coming from, or why adjusting the rat audio (line) level only made it worse.

> Capture gain is adjusted with the 
> Input Gain adjustment on the mixer. This shows up as the igain control on 
> the OSS mixer.
> 
> Unfortunately, I don't think that rat is using that as the line in gain 
> selector in the app. The workaround would be to run a separate mixer app 
> and use that to control gains. This is something that the ALSA rat knows 
> about and compensates for ...

Or... use the source!  If you can compile rat from sources, it's easy to
change what it does, using the info you've just given us.
[One would have to take care not to let the standard AG rat binary
overwrite the modified version of course.]  I had to do this to get an
SBLive! card to allow its audio levels to be controlled by rat, since
rat's auddev_oss.c mistreats it too (relative to what the Creative Labs
driver expects).

Maybe to deal with the problem Bob points out, its oss_audio_set_igain()
function could change
    case AUDIO_LINE_IN :
	if (ioctl(mixer_fd[ad], MIXER_WRITE(SOUND_MIXER_LINE), &volume) == -1) {
		perror("Setting gain");
	}
	return;

to, maybe,
    case AUDIO_LINE_IN :
	if (ioctl(audio_fd[ad], MIXER_WRITE(SOUND_MIXER_IGAIN), &volume) == -1 &&
	    ioctl(audio_fd[ad], MIXER_WRITE(SOUND_MIXER_LINE), &volume) == -1) {
		perror("Setting gain");
	}
	return;

and likewise in oss_audio_get_igain()
    case AUDIO_LINE_IN :
	if (ioctl(audio_fd[ad], MIXER_READ(SOUND_MIXER_IGAIN), &volume) == -1
	   && ioctl(audio_fd[ad], MIXER_READ(SOUND_MIXER_LINE), &volume) == -1) {
		perror("Getting gain");
	}
	break;

If this is becoming a widely-used standard, presumably UCL would want to
incorporate source-code changes to accommodate it...

 [...]
> Yup. An alternative is the Creative Ensoniq AudioPCI. However, I think this 
> is also an AC97 card, so it may have the same problems the crystal card.

How stable is the manufacture of this card?  I'd heard that cards coming
from boxes labeled "Ensoniq AudioPCI" might or might not work with the
same Linux drivers, as though the hardware were being changed without
renaming the card.



More information about the ag-tech mailing list