OpenAL Sources on Windows and Linux

Somehow it seems that a fair amount of my development entries start with something like “I’ve been playing around with…”. So let’s celebrate this tradition.

I’ve been playing around a lot with OpenAL on both Linux and Windows machines in the past few weeks. Sometimes, I wanted to smash my head against a wall, over and over again. Especially when a feature worked perfectly on Linux, but not on Windows. Here is a funny example:

[code] AL10.alSourcef(sourceId, AL10.AL_BUFFER, bufferId);
[/code]
Note that I was using LWJGL with OpenAL 1.0 here. The code above basically associates a buffer with a source, so that it can be played. This line works without any problems on Linux, but would result in a fatal crash on Windows, where you get an invalid enum error.

After bugging around with the code and wondering, I tried this line here:
[code]
AL10.alSourcei(sourceId, AL10.AL_BUFFER, bufferId);
[/code]
And hey, that line works on both platforms. Comments highly appreciated.

Leave a Reply

Your email address will not be published. Required fields are marked *