Puzzle Pirates and NWN sound

Oh yeah…

Puzzle pirates commonly has sound problems in linux because it uses the java sound library which isn’t very smart with ALSA. It tries to use the sound card directly, which in my setup (usb sound card) it seems to do nothing at all. I wouldn’t be surprised if it was spitting sound at the onboard card though. This is fixed by wrapping the application in the aoss command, which tricks it into thinking it’s using the old OSS sound library, but really ALSA is handling it. Of course this assumes that ALSA knows what it’s doing, but I fixed that in my previous post. To use aoss simply append it to the start of the launch command in a desktop launcher, or run it from a terminal like so: aoss /path/yohoho

In Neverwinter Nights I had slightly different problem, it uses the SDL library, which also doesn’t seem to choose the card properly. Again I needed to force it with aoss. But I also had to add a weird environment variable to the launch script, which I somehow found by searching through nwn forums. The nwn script usually looks like this:
#!/bin/sh

# This script runs Neverwinter Nights from the current directory

export SDL_MOUSE_RELATIVE=0
export SDL_VIDEO_X11_DGAMOUSE=0

# If you do not wish to use the SDL library included in the package, remove
# ./lib from LD_LIBRARY_PATH
export LD_LIBRARY_PATH=./lib:./miles:$LD_LIBRARY_PATH

./nwmain $@

I changed it to this:
#!/bin/sh

cd /GAMEINSTALLPATH/

# This adds a variable to make sound work properly. NWN doesn't work with
# select() function in the SDL sound library properly.
# I think this means it doesn't know how to choose which sound card to use in
# some setups.
export SDL_DSP_NOSELECT=1

# This script runs Neverwinter Nights from the current directory

export SDL_MOUSE_RELATIVE=0
export SDL_VIDEO_X11_DGAMOUSE=0

# If you do not wish to use the SDL library included in the package, remove
# ./lib from LD_LIBRARY_PATH
export LD_LIBRARY_PATH=./lib:./miles:$LD_LIBRARY_PATH

./nwmain $@

The added path change allows you to run the script from a desktop or panel launcher in gnome, otherwise nwn thinks the current directory is the desktop. Obviously /GAMEINSTALLPATH/ should be the path you installed nwn at.

Tags: , , , ,