[linux-audio-dev] Idea: fake OSS passback driver

Florian Schmidt mista.tapas at gmx.net
Sun Feb 1 12:01:56 UTC 2004


On Sun, 01 Feb 2004 12:05:19 +0100
Jan Weil <Jan.Weil at web.de> wrote:

> > Suppose one were to write a kernel module that implemented the OSS
> > API, but had non-blocking semantics, and instead of driving a sound
> > card, the module encapsulated the OSS API calls somehow and passed
> > them back to a user-space audio server.
> 
> I might be wrong, but I think this is already possible using the dmix
> plugin from alsa-lib.
> 
> You'll have to setup a dmix slave and make your OSS emulation use it.
> 
> Never tried it myself, though.
> So take this with the usual grain of salt.
> 

Yes, it is possible using the aoss script. But i have the feeling that
this still has problems with mmapped mode.

Well, here you go:

-----.asoundrc
#asym fun start here. we define one pcm device called "dmixed"
pcm.dmixed {
        ipc_key 1025
        type dmix
        slave.pcm "hw:0,0"
}

#one called "dsnooped" for capturing 
pcm.dsnooped {
        ipc_key 1026
        type dsnoop
        slave.pcm "hw:0,0"
}

#asymed to combine the two
pcm.asymed {
        type asym
        playback.pcm "dmixed"
        capture.pcm "dsnooped"
}

#a quick plug plugin for above device to do the converting magic for
#alsa apps [saves typing the "plug:" prefix in config dialogs and when
#testing with aplay]
pcm.pasymed {
        type plug
        slave.pcm "asymed"
}

#a ctl device to keep xmms happy
ctl.pasymed {
        type hw
        card 0
}


#ok and these are the two definitions used by aoss:
pcm.dsp0 {
        type plug
	#i could have used "pasymed" here, but then we would have the plug
thingie twice in the path
        slave.pcm "asymed"
}

ctl.mixer0 {
        type hw
        card 0
}
-----.asoundrc

Well, anyways, with above definitions in your .asoundrc it should be
possible to use 

aoss your_oss_app

and it should automatically use the "asymed" device. Now point your alsa
apps to "pasymed" and you should be ready to go. On my machine though,
sending to asymed or pasymed results in no error messages, but also in
no sound. So, to test an mmapped game i change the above definition of
pcm.dsp0 to

pcm.dsp0 {
        type plug
        slave.pcm "hw:0,0"
}

This disables the mixing, but at least i hear something. So when
starting enemy territory with

aoss et

i do get sound, but it crackles and the sound seems to get stuck
sometimes [buffers repeating, etc..], sometimes it also off for a minute
or so and then returns..

I also don't know if the ctl.mixer0 is honoured. i read that somewhere.
The aoss manpage only talks about pcm.dsp0.

Flo

-- 
signature :)




More information about the Linux-audio-dev mailing list