New EAX Model comitted

Started by Matzon, January 07, 2004, 08:03:20

Previous topic - Next topic

Matzon

Last night I comitted a new model for using EAX. Those who build their own LWJGL, could you please take a copy of the latest in CVS and try it out?
I expanded EAXTest (org.lwjgl.test.openal.EAXTest) to actually use EAX instead of only testing for it.

I will build a temporary dll tonight, for all those that can't or don't build the dll.

Unfortunately, due to Creatives lack of creativity, EAX is only available on Windows.

I will elaborate on the new model tonight, when I have more time (currently posting this from work :twisted:)

Matzon

As promised, here is the a dll and class files (along with some basic resources, needed by the tests):
www.matzon.dk/brian/Random%20Junk/lwjgl-win32-cvs.zip

extract, add the openal dll (lwjglaudio.dll) from existing installation and run the eax test like this:
java -cp res.zip;lwjgl.jar;lwjgl_test.jar; org.lwjgl.test.openal.EAXTest

and for the new PositionTest, substitute EAXTest with PositionTest

Matzon

So, what changed?

Well in the good old days of yore, there were two methods:
public static int eaxGet(int propertySetID, int property, int source, Buffer data, int size);
public static int eaxSet(int propertySetID, int property, int source, Buffer data, int size);

And then you would just set the values managing your own buffer - sounds simple?, it's not! :)
To get or set values, you would need to emulate the EAXBUFFERPROPERTIES and EAXLISTENERPROPERTIES structs by yourself. This means that getting and setting values would mean you would need to hack and slash that buffer into umpteen pieces to get the right index into the struct. If you want control, those methods are still available.

However two classes have been updated to allow easier operation with EAX:
EAXBufferProperties - sets properties on buffers attached to a source
EAXListenerProperties - sets properties on the listener.

Each of the classes contain getters and setters for each of the properties to be set. Additionally there are methods for determening if a set method applies the effect immediately (setAutoCommit) or waits til you call commit(). Lastly there are a loadEAXValues(), which loads the currently set values and a reset() which resets the properties object to default values.

So, to make it sound like you're in a hangar you would simply do this:
EAXListenerProperties listenerProperties = new EAXListenerProperties();
listenerProperties.setEnvironment(EAX.EAX_ENVIRONMENT_HANGAR);

and thats it!!

Using the EAXBufferProperties is just as simple, though you have to keep in mind that it needs to know which source it's attached to, so you need to call
bufferProperties.setCurrentSource(soundSources.get(0));

to set which source you're operating on. Once done, you could add some occlusion by doing
bufferProperties.setOcclusion(bufferProperties.getOcclusion()-5000);


There, it's that simple!

Oh, and before fiddling with the properties it would be a good idea to load them from native side (loadEAXValues), instead of just constructing and setting values immediately.

princec

Would it perhaps not be better then that the constructor for the properties objects automatically did a load of the current values? Or not? I'm not quite sure why you advise loading them before fiddling otherwise. (I know nothing about EAX yet)

Cas :)