diff options
Diffstat (limited to 'OpenAL32/alBuffer.c')
-rw-r--r-- | OpenAL32/alBuffer.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c index 604a3f5e..306d240d 100644 --- a/OpenAL32/alBuffer.c +++ b/OpenAL32/alBuffer.c @@ -35,6 +35,8 @@ static ALenum LoadData(ALbuffer *ALBuf, ALuint freq, ALenum NewFormat, ALsizei frames, enum UserFmtChannels chans, enum UserFmtType type, const ALvoid *data, ALboolean storesrc); static void ConvertData(ALvoid *dst, enum UserFmtType dstType, const ALvoid *src, enum UserFmtType srcType, ALsizei numchans, ALsizei len); +static ALboolean IsValidType(ALenum type); +static ALboolean IsValidChannels(ALenum channels); #define LookupBuffer(m, k) ((ALbuffer*)LookupUIntMapKey(&(m), (k))) @@ -2156,6 +2158,44 @@ ALboolean DecomposeFormat(ALenum format, enum FmtChannels *chans, enum FmtType * } +static ALboolean IsValidType(ALenum type) +{ + switch(type) + { + case AL_BYTE: + case AL_UNSIGNED_BYTE: + case AL_SHORT: + case AL_UNSIGNED_SHORT: + case AL_INT: + case AL_UNSIGNED_INT: + case AL_FLOAT: + case AL_DOUBLE: + case AL_MULAW: + case AL_IMA4: + case AL_BYTE3: + case AL_UNSIGNED_BYTE3: + return AL_TRUE; + } + return AL_FALSE; +} + +static ALboolean IsValidChannels(ALenum channels) +{ + switch(channels) + { + case AL_MONO: + case AL_STEREO: + case AL_REAR: + case AL_QUAD: + case AL_5POINT1: + case AL_6POINT1: + case AL_7POINT1: + return AL_TRUE; + } + return AL_FALSE; +} + + /* * ReleaseALBuffers() * |