LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: Ciardhubh on May 14, 2010, 18:29:44

Title: OpenAL Effects Extension (ALC_EXT_EFX) support for LWJGL
Post by: Ciardhubh on May 14, 2010, 18:29:44
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 ;)
Title: Re: OpenAL Effects Extension (AL_EXT_EFX) support for LWJGL
Post by: Matzon on May 14, 2010, 20:43:43
looks great!
I am looking into the "diff" right now ... what are the issues you mentioned?
Title: Re: OpenAL Effects Extension (AL_EXT_EFX) support for LWJGL
Post by: Matzon on May 14, 2010, 20:56:36
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..
Title: Re: OpenAL Effects Extension (AL_EXT_EFX) support for LWJGL
Post by: Matzon on May 14, 2010, 21:04:53
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.
Title: Re: OpenAL Effects Extension (ALC_EXT_EFX) support for LWJGL
Post by: Ciardhubh on May 14, 2010, 21:18:53
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).

Title: Re: OpenAL Effects Extension (ALC_EXT_EFX) support for LWJGL
Post by: Matzon on May 14, 2010, 21:28:55
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?)
Title: Re: OpenAL Effects Extension (ALC_EXT_EFX) support for LWJGL
Post by: Ciardhubh on May 14, 2010, 21:38:02
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.
Title: Re: OpenAL Effects Extension (ALC_EXT_EFX) support for LWJGL
Post by: Matzon on May 15, 2010, 07:45:25
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.
Title: Re: OpenAL Effects Extension (ALC_EXT_EFX) support for LWJGL
Post by: Ciardhubh on May 15, 2010, 11:22:37
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.
Title: Re: OpenAL Effects Extension (ALC_EXT_EFX) support for LWJGL
Post by: Matzon on May 16, 2010, 13:41:47
we're working behind the scenes to update to a newer version of oal-soft, at which point I'll integrate this into trunk
Title: Re: OpenAL Effects Extension (ALC_EXT_EFX) support for LWJGL
Post by: princec on May 17, 2010, 09:06:36
Hm, is there ever going to be an OpenAL-soft port to Mac? I see this as being a potential stability issue...

Cas :)
Title: Re: OpenAL Effects Extension (ALC_EXT_EFX) support for LWJGL
Post by: Matzon on May 17, 2010, 09:25:10
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 ...
Title: Re: OpenAL Effects Extension (ALC_EXT_EFX) support for LWJGL
Post by: Matzon on May 24, 2010, 22:41:47
patch added, openal-soft 1.12+ added too
thanks for your work.
Title: Re: OpenAL Effects Extension (ALC_EXT_EFX) support for LWJGL
Post by: Ciardhubh on May 27, 2010, 10:50:15
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.