Alc_ext_efx

This is a crosspost from the LWJGL forums but then I thought… maybe it belongs here too.

Is there any documentation anywhere for the ALC_EXT_EFX extension? I’m about to implement sound effects in my new 3D game and I was rather hoping AL would be able to do all of the hard work for me like muffling distant sounds (not just attenuating but actually applying a low-pass filter and stuff like that).

Cas :slight_smile:

See “Effects Extension Guide.pdf” in the OpenAL SDK. Found a random copy here.

1 Like

That would be the easiest, if the code has already been written. If there are hitches and you decide to use SourceDataLine (or AudioCue), I might have sufficient code to help out. I have dynamic volume, panning and pitch working, but haven’t done the specifics for coding doppler using the pitch. I have coded a filter or two now. I was just working on simple delay-based panner today, as well (sound hits one ear before the other, but works best with headphones). Haven’t mapped values to locations and angles yet, though.

Thanks ever so much! Seems there’s a lot to read in that pdf.

@philfrei I’ve not actually written any code yet to do anything fancy, what I currently have is just what I’ve been using for the last 20 years - basic buffers, sources, and a listener. I’ll have an experiment or two with the basics first to see if it sort of works and then maybe play with some effects. I will probably have questions :stuck_out_tongue:

In other words, same as you were doing with “Revenge of the Titans”?

Well… sort of. In RotT I did everything manually, the hard way: I used mono sound only, and panned sounds according to their X coordinate on the screen. I mixed a muffled version of samples with a crisp version (simply played both together) according to distance from the centre of the screen. It was all a bit daft.

Now I’ve just literally done

alSourcei(source, AL10.AL_DISTANCE_MODEL, AL11.AL_EXPONENT_DISTANCE);
alSourcef(source, AL10.AL_REFERENCE_DISTANCE, loudness);
alSourcef(source, EXTEfx.AL_AIR_ABSORPTION_FACTOR, absorption);
alSource3f(source, AL_POSITION, x, y, z);

… and it all just … worked (when I set the listener position to the camera location). I was amazed. Haven’t started on reverb and echo stuff yet though.

Cas :slight_smile:

2 Likes