Me and U(buntu)

My Ubuntu Experience!

Sharing ALSA audio from Wine

Posted by ushimitsudoki on February 19, 2008

This was a toughie!

I needed to get Ventrilo up and running. This is a voice chat program that is very popular among online gamers. Sadly, there is no Linux client available, so I hoped to get it running in Wine.

The main problem here is that you need to have 2 applications sharing the audio card – the game audio, and the chat program. Here’s how I got it working

Software mixing

As mentioned multiple times, I am using the Edirol UA-25, an external USB sound card. To get more than one application playing audio at the same time, I needed to enable software mixing (commonly called DMIX).

For me, this is the ~/.asoundrc that ended up working:

# This configuration works for sharing sound in Ventrillo (Wine) and normal apps
pcm.my_card {
    type hw
    card 0
    device 0
}

pcm.dmixed {
    type dmix
    ipc_key 1024
    slave {
        pcm "my_card"
    }
}

pcm.dsnooped {
    type dsnoop
    ipc_key 2048
    slave {
        pcm "my_card"
    }
}

pcm.asymed {
    type asym
    playback.pcm "dmixed"
    capture.pcm "dsnooped"
}

pcm.pasymed {
    type plug
    slave.pcm "asymed"
}

pcm.dsp0 {
    type plug
    slave.pcm "asymed"
}

pcm.!default {
    type plug
    slave.pcm "asymed"
}
</code>

You can test this by using aplay in multiple terminals and seeing if you get multiple audio outputs. This was pretty easy.

Wine

This was the tricky part, because it seems that Wine doesn't respect the .asoundrc file. So, even though apps could share audio normally, it didn't work when Wine was involved.

Finally, I found this page, which had the following information. Even though it says to add it directly to ~/.wine/user.reg, I used "wine regedit" to add the appropriate keys (all string values):
[HKEY_CURRENT_USER\\Software\\Wine\\Alsa Driver]
"AutoScanCards"="N"
"DeviceCount"="1"
"DeviceCTL1"="default"
"DevicePCM1"="default"
"UseDirectHW"="N"

That did the trick!

Ventrilo

This long thread on the Ubuntu Forums pretty much covers the Ventrilo configuration. I could not get it working right using "aoss" to launch - it would only play one sound and then nothing after that. OSS Drivers in Wine seem not to work to well for me in any case. This was another reason I wanted to stick to ALSA.

3 Responses to “Sharing ALSA audio from Wine”

  1. [...] and U(buntu) Moving On! « Sharing ALSA audio from Wine USB Keyboard, Be Still! February 28, 2008 Stand still, why don’t [...]

  2. [...] Me and U(buntu) blog had a pretty good/quick howto to reslove the situation. I simply copy & pasted the the following config [...]

  3. [...] [...]

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>