Wednesday, February 13, 2008

How to shut wine audio output

As I've mentioned before, I play to Morrowind (III) using Wine. Fine. Thanks to a nice guy on the AppDB Forum, I found out that what was causing Morrowind to segfault was simply that I had not set any audio device in my configuration... So I did with winecfg, and it worked, and I was quite delighted.

So far, nothing fantastic. It so happens that I hate to play any game with the game's music/sounds/voices, as I prefer to be quietly listening to music of my taste (I have delicate ears). As in any other game, you can switch them off in Morrowind, which is what I immediately did. However, it happens that some sounds - so far, only the sound corresponding to a shield blocking an attack (a graceful and delicate sound as you imagine) - go through even with all sound volumes are turned down to 0. It is annoying to the point I had to stop using the computer for listening music and falling back to my old CD player. Painful ! Or at least so it was until today, when I finally took my courage and found out how to fool wine into believing it is playing sounds when in fact it is not. First step, create a null ALSA output device, by adding the following to your .asoundrc:

# Null audio output
pcm.null {
  type null               # Null PCM
}

Then, you need to have wine use it (and only this one). For this, a quick look at the Useful Registry Keys showed that I had to add the following to my .wine/user.ref configuration file:

[Software\\Wine\\Alsa Driver] 1202930020
"DevicePCM1"="null"
"AutoScanCards"="N"
"DeviceCount"="1"

Just make sure wine is using ALSA output, and that's all ! Morrowind plays, without sound and does not segfault ! I'll be able to listen to my music again...

Note I'm unsure about the value 1202930020. The best is to add the key Software\Wine\Alsa Driver using regedit and then edit the configuration file -- or even do everything with regedit.

2 comments:

Ted said...

I think that number is a Unix timestamp for when the key was last modified. You might be better off editing it with Wine's regedit.

Anonymous said...

Cheers, was very helpful, needed to get wine to use a virtual alsa device i had for 5.1 upmix :)