Choose audio device from list

How can I programatically get a list of available audio devices with JOAL?

I looked at the demos and even the Jake2 source and they are all doing it the same way:

    String deviceName = "DirectSound3D";
    device = alc.alcOpenDevice(deviceName);
    deviceSpecifier = alc.alcGetString(device, ALC.ALC_DEVICE_SPECIFIER);

the problem is that (at least for my system) the deviceSpecifier always returns “Generic Hardware”. Meanwhile, I have a great sound card that i’d like to use, but I have no idea if JOAL is using it or not. Additionally, I’d like to choose which audio device to use if there are more than one. Please advise.

Good question. If you do a Google search for “openal enumerating audio devices” you’ll find that the mechanism for doing this is basically a hack (returning a list of C strings as one string). JOAL doesn’t currently support this. Please feel free to file an RFE using the JOAL Issue Tracker about this and we can provide another (handwritten) entry point to expose it.

Note that if you look in the OpenAL source code the only devices it knows about by default are “Generic Hardware” and “Generic Software”. I think you’ll have to contact your sound card manufacturer to find out whether they ship a more specialized OpenAL implementation for your card. When I run with JOAL it picks up the Generic Software device so you’re probably already doing better than on some other machines.

yeah, i read that thread and responded about that on my earlier thread
i get a nullpointer when I try to do “the hack”
i think that bug has been fixed in JOAL, but i’m still using the old joal build so i guess i must upgrade at this point :-\

i had the feeling that my hardware may not have been used correctly (since i have a good soundcard, or so i thougt) as 30 sources are the max for my system, and i read about one guy who was getting 256 on his laptop…

at any rate, i have my system working bug-free
but if there are more than 30 sounds playing at once, i have to steal a source that’s playing and stop it and recycle it for the latest request

i’m sticking with that and looking into other issues at this point, but please let me know if you think i’m confused about what i’m doing

and thanks for you help this week, it’s been invaluable! :smiley:

Please do upgrade. We won’t be able to support the old JOAL once we switch over to the new GlueGen-based version. Note that while the NullPointerException has been fixed, you will still only get the first device back from that call. We need to add another entry point to make the query you want.

Depending on how OpenAL maps to your hardware you may be running into an OpenAL, DirectSound, or hardware limitation. Given that the software device supports many more than 30 sources I am guessing something is wrong at a lower level than JOAL.

You’re welcome.