OpenAL Effects Extension (ALC_EXT_EFX) support for LWJGL

Started by Ciardhubh, May 14, 2010, 18:29:44

Previous topic - Next topic

Ciardhubh

LWJGL doesn't have support for ALC_EXT_EFX. I need it for a project, OpenAL Soft supports it and there was no mention anybody is working on it. So I wrote a patch ;D

Here are the changed (based on today's Subversion repository) and new files:
http://www.ciardhubh.de/download/forum/EFXPatch.zip
Drop these into the LWJGL directory tree and run ant to build as usual.

I also packaged a small test app (Linux 32 bit and Win 32 bit only for now):
http://www.ciardhubh.de/download/forum/EFXTest.zip
Run the .sh or .bat, depending on your system.

In case you want to integrate these changes into the LWJGL, there are still a few minor issues. Also, compiling LWJGL on Windows is a pain ... other than that ... echoing footsteps, what's not to like ;)

Matzon

looks great!
I am looking into the "diff" right now ... what are the issues you mentioned?

Matzon

hmm, keep getting
ALC_EXT_EFX found.
Exception in thread "main" org.lwjgl.openal.OpenALException: Invalid Value
        at org.lwjgl.openal.Util.checkALCError(Util.java:55)
        at org.lwjgl.openal.ALC10.alcCreateContext(ALC10.java:250)
        at org.lwjgl.test.openal.EFX10Test.silentTests(EFX10Test.java:69)
        at org.lwjgl.test.openal.EFX10Test.main(EFX10Test.java:27)

for my own build ...

your zip file test works ... investigating..

Matzon

right, seems to be the older oal-soft we supply. It does export ALC_EXT_EFX though - go figure.
Using your dll seems to work fine.

We're working on getting new version of oal-soft into our dist - but we need it for all platforms.

Ciardhubh

Yea the OpenAL libraries in the current release don't work for some reason. They report the extension and nm on Linux shows the correct symbols but they don't work at runtime.

I used a self-compiled OpenAL Soft .so on Linux and the official bin release on win (forgot to mention that).


  • That's one of the issues (that the current llibs aren't adequate).
  • Does the classname EFX10 fit the LWJGL naming scheme?
  • Then there's the EFXUtil class. It's not required and only contains a few convenience functions to check which effects/filters are supported. Does it fit into the scope of LWJGL?
  • Since the template for EFX10 uses String and float fields, I had to adjust one class of the generator to handle these (was only int and long). No idea if there are any malicious side-effects.
  • Loading and unloading of native stubs: I added this at the end of the init of AL for now. Where to put the initNativeStubs call? Can be in AL or ALC11 along with AL11 inits, since ALC_EXT_EFX indirectly requires AL 1.1 for functions like alSource3i.
  • Do you have to call resetNativeStubs(EFX10.class); somewhere? If so, it's not done for AL11 either IIRC; only for ACL10/11 and AL10.
  • Debug build ... well ... mess ... in my opinion the normal and debug build have become incompatible. Either you check AL errors yourself, you check for debug OpenALExceptions or your have to write redundant code for both. This applies to the handling in EFXUtil.
  • Upon AL.destroy() on Linux the error message "Inconsistency detected by ld.so: dl-close.c: 731: _dl_close: Assertion `map->l_init_called' failed!" is printed in the console. Allegedly this comes from some bug or issue in Pulseaudio. Only happens on exit and doesn't appear to have any obvious bad effects.

Matzon

Well, stuff looks good to me ...

We'll need a newer oal-soft, since the old one doesn't "fit".
EFX10 is fine, and AL creating it is fine too.
EFXUtil is fine as is
FieldGenerator had the biggest changes - but thats because you changed the formatting too - but since it was messy thats ok. I cannot see any problems with your changes.
I updated destroy of AL to add resetNativeStubs for AL11 and EFX10.

Not sure about the debug stuff - and as for linux , meh :p

all in all it looks solid. I'll dwell on it till tomorrow and commit it then - unless I get any objections.

Anyone with a mac to test this? - would be nice to check how this fails or works (does the oal-framework on osx support efx?)

Ciardhubh

Quote from: Matzon on May 14, 2010, 21:28:55
Anyone with a mac to test this? - would be nice to check how this fails or works (does the oal-framework on osx support efx?)

By the way, which OpenAL libraries are used on various systems? Do they all use OpenAL Soft or does LWJGL try to use other libraries on Win and Mac? If they all use OpenAL Soft, shouldn't it be relatively easy to just compile the latest version for each?

If you commit before appropriate native libs are in place, there might be problems. Again, IIRC when I used the current Linux .so, it caused an error when loading OpenAL even if I didn't use anything from the EFX extension. LWJGL library loading debug output complained that alGenAuxiliarySlots wasn't found even though nm reported it to be there. Might break OpenAL.

Matzon

all platforms use oal-soft, except for mac - since there is no osx-backend in openal-soft.
I might just merge this into a branch so we have it in there - until we have the newer openal-soft builds. I'll know more tonight.

Ciardhubh

I made some changes to class EFXUtil to make it compatible with both the regular LWJGL lwjgl.jar and the debug build lwjgl-debug.jar. If it will become part of LWJGL it should work with the debug build.
http://www.ciardhubh.de/download/forum/EFXUtil.java

Also a minor change to the test class EFX10Test.java comment to clarify it won't work with the debug build.
http://www.ciardhubh.de/download/forum/EFX10Test.java

Also updated in the zip.

Matzon

we're working behind the scenes to update to a newer version of oal-soft, at which point I'll integrate this into trunk

princec

Hm, is there ever going to be an OpenAL-soft port to Mac? I see this as being a potential stability issue...

Cas :)

Matzon

someone just needs to write a backend ... there are several backends - but none for mac, due to the maintainer being a linux user. The solaris and windows backends where basically part of the existing SI, so no work to do.

http://repo.or.cz/w/openal-soft.git/tree/master:/Alc
Quote-rw-r--r--    32931    alsa.c    blob | blame | history | raw
-rw-r--r--    17388    dsound.c    blob | blame | history | raw
-rw-r--r--    14212    oss.c    blob | blame | history | raw
-rw-r--r--    11616    portaudio.c    blob | blame | history | raw
-rw-r--r--    30040    pulseaudio.c    blob | blame | history | raw
-rw-r--r--    7907    solaris.c    blob | blame | history | raw
-rw-r--r--    9698    wave.c    blob | blame | history | raw
-rw-r--r--    15252    winmm.c    blob | blame | history | raw

only 8k code for solaris ...

Matzon

patch added, openal-soft 1.12+ added too
thanks for your work.

Ciardhubh

Quote from: Matzon on May 24, 2010, 22:41:47
patch added, openal-soft 1.12+ added too

Thanks.

After using EFX a bit I added another function to EFXUtil; one to check the max number of auxiliary effect slots, since this usually is a fairly low number that depends on the implementation and checking it is not trivial (e.g. like checking max number of sources). Added a call to that function to the test class too.

Updated files:
http://www.ciardhubh.de/download/forum/EFXUtil.java
http://www.ciardhubh.de/download/forum/EFX10Test.java

Patches based on today's SVN source:
http://www.ciardhubh.de/download/forum/EFXUtil.patch (diff didn't handle these changes very well, probably due to Win vs. Unix linebreaks, works in Netbeans, wouldn't work via command line)
http://www.ciardhubh.de/download/forum/EFX10Test.patch

By the way, the wiki page to build LWJGL on Windows (http://lwjgl.org/wiki/doku.php/lwjgl/tutorials/compilewin32) should IMHO mention you have to put LWJGL in a short path, e.g. c:\lwjgl, NOT c:\documents and settings\username\Desktop\lwjglbuild\lwjgl. Long paths generate rather cryptic errors, e.g. "Cannot run program "apt": CreateProcess error=87, The parameter is incorrect" which can be quite hard to troubleshoot; took me longer to figure out than I'm comfortable admitting  ::)

In a related matter, is it intentional that some ANT build targets use a minus "-" (generate-all) to concatenate words, while others use an underscore "_" (compile_native)? Mistyped that last one a lot.