[Openal] Initializing effects extension

Chris Robinson chris.kcat at gmail.com
Sat Apr 4 23:50:47 PDT 2009


On Saturday 04 April 2009 12:41:33 pm Margin Marh wrote:
> After experimenting with OpenAL static sound i wanted to move further to 3d
> sound, effects.
> So i opened the Effect extension.pdf that comes with Openal and started
> reading but i got stuck on tutorial 1(Initializing the effect extension).
> I did not understand most of the parts(the red words in the code are the
> ones i don't understand)...
> Trying my hard to understand i was able to put this code together :
>
...
>
> But the problem is that when i build it i get allot of "undeclared
> identifier" errors...
>
> The full list of errors is here :
> > 'ALC_MAX_AUXILIARY_SENDS' : undeclared identifier
> > 'ALC_MAX_AUXILIARY_SENDS' : undeclared identifier
> > 'alGenEffects' : undeclared identifier
> > 'LPALGENEFFECTS' : undeclared identifier
> > 'alDeleteEffects' : undeclared identifier
> > 'LPALDELETEEFFECTS' : undeclared identifier
> > 'alIsEffect' : undeclared identifier
> > 'LPALISEFFECT' : undeclared identifier
> > 'alGenEffects' : undeclared identifier
> > 'alDeleteEffects' : undeclared identifier
> > 'alIsEffect' : undeclared identifier
>
> If i am not mistaking its cause i did not declare them i got this error but
> i don't know what type of Openal type i have to declare them as...
> Also the red parts of the code is the parts i did not understand, so if its
> possible can i get some explanation ?
> Thanks in advance.

You need to include the efx.h header provided with the SDK, too. Note that the 
header as-is will only work on Windows, but you can fix that by doing a search 
and replace (change all occurrences of __cdecl to AL_APIENTRY).

You also need to declare the function you want to use. For example:
LPALGENEFFECTS alGenEffects;
LPALDELETEEFFECTS alDeleteEffects;
LPALISEFFECT alIsEffect;
etc. (Note that it may be a good idea to use different names prefixes, or put 
them into a struct/namespace; there's nothing really stopping an 
implementation from exporting the functions in the future, which would cause 
symbol clashes and result in odd bugs and crashes).

Also one comment about the code:
>         alGenEffects=(LPALGENEFFECTS);
>         alGetProcAddress("alGenEffects");
>         alDeleteEffects=(LPALDELETEEFFECTS);
>         alGetProcAddress("alDeleteEffects");
>         alIsEffect=(LPALISEFFECT);
>         alGetProcAddress("alIsEffect");
..there are too many semicolons there. It should be:
alGenEffects    = (LPALGENEFFECTS)alGetProcAddress("alGenEffects");
alDeleteEffects = (LPALDELETEEFFECTS)alGetProcAddress("alDeleteEffects");
alIsEffect      = (LPALISEFFECT)alGetProcAddress("alIsEffect");


More information about the Openal mailing list