SDL 1.2 ALSA multichannel (crackles)

Hi,

I am developing an application that requires at least 4 channels. To my surprise, SDL already has the support (docs still mention only 1 or 2 channels, although it is 6 on the wiki!).
The application works fine in Windows, but I’m having problems with Linux. The default SDL in Ubuntu 9.04 uses ALSA sound backed.
The sound is played, but only the first 2 channels work fine, the rear channels are crackling and it seems like sound is also spilling from rear to center channel. I wonder if anyone has tested ALSA with more then 2 channels recently (it seemed to me ALSA was the first backend to support more then 2 channels)?
Since I see 1.2.14 is nearing release, I downloaded and compiled latest svn revision (5132) and it still behaves the same. Pulseaudio backend however works fine (with both Ubuntu SDL and svn compile)!

DSP backend seems to set channels to some arbitrary number, as long as it is power of 2 (this would be better if it was at least limited to 2). ESD is has one of those if(channels == 1) … else … this should also be limited to max. 2 channels.

I would suggest posting on the ALSA mailing list and submitting a bug
report in Bugzilla:
http://bugzilla.libsdl.org

I don’t have a surround sound setup and I don’t know anything about
ALSA’s multichannel support.

A couple thoughts…
What is the output if you set the environment variable
SDL_AUDIO_ALSA_DEBUG_PERIOD_SIZE?
Does the output change if you set the environment variable
SDL_AUDIO_ALSA_SET_PERIOD_SIZE?
What happens if you set the AUDIODEV environment variable to “surround40”?

Oh, looking at the code, I see the 4 channel case is missing for
swizzle_alsa_channels()
That just might be the problem. :)On Sun, Oct 18, 2009 at 6:40 AM, gulikoza wrote:

Hi,

I am developing an application that requires at least 4 channels. To my
surprise, SDL already has the support (docs still mention only 1 or 2
channels, although it is 6 on the wiki!).
The application works fine in Windows, but I’m having problems with Linux.
The default SDL in Ubuntu 9.04 uses ALSA sound backed.
The sound is played, but only the first 2 channels work fine, the rear
channels are crackling and it seems like sound is also spilling from rear to
center channel. I wonder if anyone has tested ALSA with more then 2 channels
recently (it seemed to me ALSA was the first backend to support more then 2
channels)?
Since I see 1.2.14 is nearing release, I downloaded and compiled latest svn
revision (5132) and it still behaves the same. Pulseaudio backend however
works fine (with both Ubuntu SDL and svn compile)!

DSP backend seems to set channels to some arbitrary number, as long as it is
power of 2 (this would be better if it was at least limited to 2). ESD is
has one of those if(channels == 1) … else … this should also be limited
to max. 2 channels.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC