wrong soundcard

For discussion of ports to POSIX based systems, especially using GNUStep.

Moderators: winston, another_commander, Getafix

Post Reply
Ganelon
---- E L I T E ----
---- E L I T E ----
Posts: 534
Joined: Fri Jul 02, 2010 11:45 am
Location: Around Rabiarce or Lasoce

wrong soundcard

Post by Ganelon » Tue Apr 26, 2011 5:13 pm

It's really a minor issue, but for some reason Oolite likes to insist on using my second soundcard rather than the on-the-motherboard card that is set as system default. I'm currently running Ubuntu Karmic Koala.

I usually just physically change the plug when I go to play Oolite, but if anybody happens to know some command line option or config setting or whatever to direct Oolite to a specific soundcard, it would be nice.
Sleep? Who needs sleep? Got game. No need sleep.

User avatar
Getafix
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 960
Joined: Tue Apr 01, 2008 12:55 pm
Location: A small ice asteroid, orbiting Oresrati in Galaxy 8 (a.k.a. northwest Armorica).
Contact:

Re: wrong soundcard

Post by Getafix » Fri Apr 29, 2011 7:13 pm

Hi Ganelon,

it seems there is an SDL environment variable that can be used on that matter. I quote from libsdl.org.

Code: Select all

AUDIODEV

    The audio device to use, if SDL_PATH_DSP isn't set.

...

SDL_PATH_DSP

    The audio device to use. If not set, SDL tries AUDIODEV and then a platform-dependent default value (/dev/audio on Solaris, /dev/dsp on Linux etc).
I suspect that you could force the use of a device by setting the SDL_PATH_DSP variable.


Make sure the speakers are connected to the preferred sound-card and the linux audio is functional.

For starters get all the available dsp devices:
Example:

Code: Select all

$ ls /dev/dsp*
/dev/dsp
/dev/dsp1
$ 
Then locate the oolite executable script:
Example

Code: Select all

$ which oolite
/usr/bin/oolite
$ 
Then backup this script:
Example:

Code: Select all

$ sudo cp -p /usr/bin/oolite /usr/bin/oolite.original
$ 
Now recreate the oolite script by adding the SDL environment variable definition:
Example:

Code: Select all

$ sudo bash
# echo "export SDL_PATH_DSP=/dev/dsp" > /usr/bin/oolite
# cat /usr/bin/oolite.original >> /usr/bin/oolite
# exit
$ 
Execute oolite. If you don't get audio, then execute this last chunk of code again
by altering /dev/dsp to the second device /dev/dsp1.

If this approach did not work, then rollback to your original oolite script.
Example:

Code: Select all

$ sudo mv /usr/bin/oolite.original /usr/bin/oolite
$ 
"Any sufficiently advanced information is indistinguishable from noise." [Newman, Lachmann, Moore]

User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: wrong soundcard

Post by JensAyton » Sat Apr 30, 2011 4:41 am

As a side note, if SDL is not defaulting to the system default, that would appear to be an SDL bug and should be reported to them.

Post Reply