[openal] Can I use effect functions without using macros?

Chris Robinson chris.kcat at gmail.com
Wed Jan 27 08:58:14 EST 2021


On Wed, 27 Jan 2021 08:43:50 +0300
Sean <s.tolstoyevski at gmail.com> wrote:

> No, no. :) .
> 
> This is not what I want to tell you.
> 
> For example I want to be able to use alGenFilters without LOAD_PROC.
> Can I use these effect functions without writing the code between 
> #define and #undef?

Oh, sorry I misunderstood.

Yes it is possible, but you still need to load the function pointers.
The macros are just there to avoid repetition and prevent errors.
You'll need to do

static LPALGENFILTERS alGenFilters;
...
alGenFilters = (LPALGENFILTERS)alGetProcAddress("alGenFilters");

for each EFX function (the cast may or may not be necessary).

But be aware, for a general wrapper, an issue you may run into is that
the function pointers are context-, device-, or driver-specific. This
is really only a concern on Windows with the router DLL, but the pointer
you get from a Generic Software device may be different from the
pointer you get from an OpenAL Soft device, and you can't use one for
the other.

The alternative is to only link with OpenAL versions that export the
functions directly, and I'm not sure which implementations do that
aside from OpenAL Soft. At least until I add support for them in OpenAL
Soft's router replacement/implementation.


More information about the openal mailing list