diff options
author | Chris Robinson <[email protected]> | 2009-06-07 20:16:41 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2009-06-07 20:16:41 -0700 |
commit | c6f3a4e0622c93ef832d6fa0ade3baff0b417fc9 (patch) | |
tree | 13aa600e85f91c6498e7b7e35b31add95bfadbf3 /OpenAL32/Include | |
parent | 87ed53c7f6211830e9d336cf94a7516771022692 (diff) |
Move a couple inline functions into the header
Diffstat (limited to 'OpenAL32/Include')
-rw-r--r-- | OpenAL32/Include/alu.h | 80 |
1 files changed, 78 insertions, 2 deletions
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 9bbcc464..f2a7b023 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -3,6 +3,7 @@ #include "AL/al.h" #include "AL/alc.h" +#include "AL/alext.h" #ifdef HAVE_FLOAT_H #include <float.h> @@ -67,8 +68,83 @@ enum { extern ALboolean DuplicateStereo; -__inline ALuint aluBytesFromFormat(ALenum format); -__inline ALuint aluChannelsFromFormat(ALenum format); +/* NOTE: The AL_FORMAT_REAR* enums aren't handled here be cause they're + * converted to AL_FORMAT_QUAD* when loaded */ +static __inline ALuint aluBytesFromFormat(ALenum format) +{ + switch(format) + { + case AL_FORMAT_MONO8: + case AL_FORMAT_STEREO8: + case AL_FORMAT_QUAD8_LOKI: + case AL_FORMAT_QUAD8: + case AL_FORMAT_51CHN8: + case AL_FORMAT_61CHN8: + case AL_FORMAT_71CHN8: + return 1; + + case AL_FORMAT_MONO16: + case AL_FORMAT_STEREO16: + case AL_FORMAT_QUAD16_LOKI: + case AL_FORMAT_QUAD16: + case AL_FORMAT_51CHN16: + case AL_FORMAT_61CHN16: + case AL_FORMAT_71CHN16: + return 2; + + case AL_FORMAT_MONO_FLOAT32: + case AL_FORMAT_STEREO_FLOAT32: + case AL_FORMAT_QUAD32: + case AL_FORMAT_51CHN32: + case AL_FORMAT_61CHN32: + case AL_FORMAT_71CHN32: + return 4; + + default: + return 0; + } +} +static __inline ALuint aluChannelsFromFormat(ALenum format) +{ + switch(format) + { + case AL_FORMAT_MONO8: + case AL_FORMAT_MONO16: + case AL_FORMAT_MONO_FLOAT32: + return 1; + + case AL_FORMAT_STEREO8: + case AL_FORMAT_STEREO16: + case AL_FORMAT_STEREO_FLOAT32: + return 2; + + case AL_FORMAT_QUAD8_LOKI: + case AL_FORMAT_QUAD16_LOKI: + case AL_FORMAT_QUAD8: + case AL_FORMAT_QUAD16: + case AL_FORMAT_QUAD32: + return 4; + + case AL_FORMAT_51CHN8: + case AL_FORMAT_51CHN16: + case AL_FORMAT_51CHN32: + return 6; + + case AL_FORMAT_61CHN8: + case AL_FORMAT_61CHN16: + case AL_FORMAT_61CHN32: + return 7; + + case AL_FORMAT_71CHN8: + case AL_FORMAT_71CHN16: + case AL_FORMAT_71CHN32: + return 8; + + default: + return 0; + } +} + ALvoid aluInitPanning(ALCcontext *Context); ALvoid aluMixData(ALCcontext *context,ALvoid *buffer,ALsizei size,ALenum format); |