LWJGL3 - OpenAL

Started by abcdef, November 27, 2014, 09:42:49

Previous topic - Next topic

abcdef

Hi

Does anyone have an example bit of code for initialising/destroying OpenAL in LWJGL3?

I used to do the following to create a context

AL.create();


And to destroy a context I used to do

AL.destroy();


I believe there are more things to be done in LWJGL3, AL no longer contains these methods.

Would I be correct in saying the default initialisation would be one of the below 2 ways now? Is the first a quick way of doing the second?

ALC.create();
ALC.destroy();


long device = ALC10.alcOpenDevice(NULL);
long context = ALC10.alcCreateContext(device, null);
boolean success = ALC10.alcMakeContextCurrent(context);
alcDestroyContext(context);


(btw all the return type documentation is missing from the ALC10 javadoc)

Thanks

spasi

When in doubt, please see the LWJGL 3 tests module. You will find many samples there for all APIs.

For OpenAL specifically, I can only say that it's a work in progress. It works, but most of it was contributed by Matzon in the early days of LWJGL 3 and hasn't received much attention since. More effort is required to simplify the context lifecycle and improve the documentation. Contributions will be appreciated!

Another thing that's certain is that OpenAL context management will not be compatible with LWJGL 2. We now have full support for extensions and two capabilities classes (one for ALC/devices and one for AL/contexts). There is also support for EXT_thread_local_context, which changes OpenAL from basically a global/static API to something more similar to OpenGL.

abcdef

Those test modules are really useful! Thanks :)

I appreciate its still alpha, the work done so far is excellent and I like the new direction (It will take a bit to get used to). I don't have a huge amount of free time but I wouldn't mind helping out where possible. Is there any documentation on developing LWJGL3?

Can I ask what you see as the reason for having 2 capability classes (ALC/devices and AL/contexts)? Which would be the use cases for using one over the other

Lastly I couldn't see the code

ALC10.alcMakeContextCurrent


being used in any of the examples, is this because when you create a context it automatically becomes the current context?


spasi

Quote from: abcdef on November 27, 2014, 11:53:44Is there any documentation on developing LWJGL3?

See the Contribute section in the wiki. The TODO list is somewhat outdated. The task I need most help with is adding support for EXT and vendor-specific extensions in OpenGL. It's a lot of work, yet it's something that someone without much understanding of the codebase can easily do. There are tons of templates they can use for reference.

Contributions could also easily be made with OpenAL, OpenCL and OpenGL ES extensions and documentation work in general. For example, I have fully documented the core OpenGL and ARB/KHR extensions, but I've stopped documenting EXT extensions to save time. That documentation could be added over time by the LWJGL community.

Quote from: abcdef on November 27, 2014, 11:53:44Can I ask what you see as the reason for having 2 capability classes (ALC/devices and AL/contexts)? Which would be the use cases for using one over the other

Because ALC and AL extensions are logically separate. You use both in your OpenAL code.

Quote from: abcdef on November 27, 2014, 11:53:44Lastly I couldn't see the code

ALC10.alcMakeContextCurrent


being used in any of the examples, is this because when you create a context it automatically becomes the current context?

It is currently called in the ALContext constructor.