javax.sound.sampled and ALSA

Does anyone know how to set-up Sun reference implementation for Linux to find non-hardware mixer devices? That’s because I am using the nvidia soundstorm alsa driver which is missing support for hardware mixing. I have configured alsa’s ‘default’ device to use the dmix plugin which allows multiple applications to use the same mixer simultanously if they request the default device instead of a hardware device (aka plughw or hw).

For ESoundD, XMMS etc. this works really nice but now Java does the showstopper: If Java acquires the hw device all other applications block :frowning:

Does anyone know a solution or workaround for this?

I’ve got a similar problem. I’m running ALSA drivers, and I think I’ve got the dmix plugin enabled. Now,from what I read, this allows Linux to use the famed DirectAudioDevices (i.e.: non-sucky JavaSound) as well as mixing multiple lines/channels together.

My game already sounds like a charm under Windows with DirectSound-implemented JS, using both Clips (in menus) and SourceDataLines (in game) playing multiple concurrent sounds, so it’s not like I’m a total JavaSound noob.

I’ve got the following problems:

A - The same code that detects multiple/infinite channels for my sound card (mobo-nforce2) under WinXP detects only ONE such line under Linux. Using Mixer.getMaxLines(DataLine.Info). Assuming problem B doesnt exist (see below), this would theoretically allows me to only play one sound at a time. That ain’t enough.

B - When my game does its first Clip.open(AudioInputStream ais), it throws a “javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED, 22050.0 Hz, 16 bit, stereo, little-endian, audio data not supported.” Funny thing is I check the availability of my line and the mixer tells me I’ve got (only) one (see A), in the same format as my Clip object.

So my guess is dmix is not enabled correctly, which prevents my game from doing soft-level mixing and returning multiple/infinite channels to my code. Another process/app is somehow hijacking my only line, causing both problems to be sound showstoppers (I wish that was a pun).

Can somebody tell me if my above assumptions are correct ?? Are there people who have played multiple, concurrent sounds under Linux, on 1.4.2 or Tiger, using DirectAudioDevices (NOT the high-latency Java Sound soft mixer engine ! ) and lived to tell? If so, PLEASE reply to this thread, you’ve just become my new friend ! :wink:

thanks
BK