[Openal] ALubyte* -> ALchar*

Sven Panne Sven.Panne at aedion.de
Fri Dec 2 10:51:20 PST 2005


Am Freitag, 2. Dezember 2005 18:05 schrieb Benjamin Grauer:
> [...]
> ALubyte deviceName[] = 
> #ifdef __WIN32__
>       "native";
> #else
>       "'( ( devices '( native arts null ) ) )";
> #endif
> [...]

Well, strictly speaking you should use ALCchar here for 1.1, not ALchar, but 
that's more an aesthetical issue... To check against which header version you 
are compiling, you can use the preprocessor token AL_VERSION_1_1, which is 
#defined in <AL/al.h> for OpenAL 1.1 only. Using this, you can make a typedef 
like this and use myALCchar  instead:

#ifndef AL_VERSION_1_1
typedef ALCubyte myALCchar;
#else
typedef ALCchar myALCchar;
#endif

Unless you have an extremly arcane platform, the runtime representation of 
both variants should be identical. The only thing to watch out for is 
arithmetic with myALCchar, which will differ.

Cheers,
   S.

P.S.: I don't think that trying to open a device called "native" will work for 
Win32, "Generic Software" or "Generic Hardware" looks more promising. Or even 
better: You can use device enumeration if that extension is available.



More information about the Openal mailing list