aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-03-21 09:42:03 -0700
committerChris Robinson <[email protected]>2011-03-21 09:42:03 -0700
commit358d402cd088889fc4690ed440123e687d89866e (patch)
treebcb16d9f44c5ccb2fa570f302e68d5fdcf28de38
parentd11593eb5c2bbf338b9f17acd40c2ab6390e737e (diff)
Move Convert_IMA4 into the template declarations
-rw-r--r--OpenAL32/alBuffer.c65
1 files changed, 13 insertions, 52 deletions
diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c
index 32b620b1..09516077 100644
--- a/OpenAL32/alBuffer.c
+++ b/OpenAL32/alBuffer.c
@@ -1030,6 +1030,7 @@ AL_API void AL_APIENTRY alGetBufferiv(ALuint buffer, ALenum eParam, ALint* plVal
typedef ALubyte ALmulaw;
+typedef ALubyte ALima4;
static __inline ALshort DecodeMuLaw(ALmulaw val)
{ return muLawDecompressionTable[val]; }
@@ -1056,7 +1057,7 @@ static ALmulaw EncodeMuLaw(ALshort val)
return ~(sign | (exp<<4) | mant);
}
-static void DecodeIMA4Block(ALshort *dst, const ALubyte *src, ALint numchans)
+static void DecodeIMA4Block(ALshort *dst, const ALima4 *src, ALint numchans)
{
ALint sample[MAXCHANNELS], index[MAXCHANNELS];
ALuint code[MAXCHANNELS];
@@ -1109,7 +1110,7 @@ static void DecodeIMA4Block(ALshort *dst, const ALubyte *src, ALint numchans)
}
}
-static void EncodeIMA4Block(ALubyte *dst, const ALshort *src, ALint *sample, ALint *index, ALint numchans)
+static void EncodeIMA4Block(ALima4 *dst, const ALshort *src, ALint *sample, ALint *index, ALint numchans)
{
ALsizei j,k,c;
@@ -1503,8 +1504,8 @@ DECL_TEMPLATE(ALmulaw, ALmulaw)
#undef DECL_TEMPLATE
#define DECL_TEMPLATE(T) \
-static void Convert_##T##_IMA4(T *dst, const ALubyte *src, ALuint numchans, \
- ALuint numblocks) \
+static void Convert_##T##_ALima4(T *dst, const ALima4 *src, ALuint numchans, \
+ ALuint numblocks) \
{ \
ALuint i, j; \
ALshort tmp[65*MAXCHANNELS]; /* Max samples an IMA4 frame can be */ \
@@ -1530,8 +1531,8 @@ DECL_TEMPLATE(ALmulaw)
#undef DECL_TEMPLATE
#define DECL_TEMPLATE(T) \
-static void Convert_IMA4_##T(ALubyte *dst, const T *src, ALuint numchans, \
- ALuint numblocks) \
+static void Convert_ALima4_##T(ALima4 *dst, const T *src, ALuint numchans, \
+ ALuint numblocks) \
{ \
ALuint i, j; \
ALshort tmp[65*MAXCHANNELS]; /* Max samples an IMA4 frame can be */ \
@@ -1555,15 +1556,12 @@ DECL_TEMPLATE(ALuint)
DECL_TEMPLATE(ALfloat)
DECL_TEMPLATE(ALdouble)
DECL_TEMPLATE(ALmulaw)
+static void Convert_ALima4_ALima4(ALima4 *dst, const ALima4 *src,
+ ALuint numchans, ALuint numblocks)
+{ memcpy(dst, src, numblocks*36*numchans); }
#undef DECL_TEMPLATE
-static void Convert_IMA4_IMA4(ALubyte *dst, const ALubyte *src, ALuint numchans,
- ALuint numblocks)
-{
- memcpy(dst, src, numblocks*36*numchans);
-}
-
#define DECL_TEMPLATE(T) \
static void Convert_##T(T *dst, const ALvoid *src, enum UserFmtType srcType, \
ALsizei numchans, ALsizei len) \
@@ -1598,7 +1596,7 @@ static void Convert_##T(T *dst, const ALvoid *src, enum UserFmtType srcType, \
Convert_##T##_ALmulaw(dst, src, numchans, len); \
break; \
case UserFmtIMA4: \
- Convert_##T##_IMA4(dst, src, numchans, len); \
+ Convert_##T##_ALima4(dst, src, numchans, len); \
break; \
} \
}
@@ -1612,47 +1610,10 @@ DECL_TEMPLATE(ALuint)
DECL_TEMPLATE(ALfloat)
DECL_TEMPLATE(ALdouble)
DECL_TEMPLATE(ALmulaw)
+DECL_TEMPLATE(ALima4)
#undef DECL_TEMPLATE
-static void Convert_IMA4(ALubyte *dst, const ALvoid *src, enum UserFmtType srcType,
- ALint chans, ALsizei len)
-{
- switch(srcType)
- {
- case UserFmtByte:
- Convert_IMA4_ALbyte(dst, src, chans, len);
- break;
- case UserFmtUByte:
- Convert_IMA4_ALubyte(dst, src, chans, len);
- break;
- case UserFmtShort:
- Convert_IMA4_ALshort(dst, src, chans, len);
- break;
- case UserFmtUShort:
- Convert_IMA4_ALushort(dst, src, chans, len);
- break;
- case UserFmtInt:
- Convert_IMA4_ALint(dst, src, chans, len);
- break;
- case UserFmtUInt:
- Convert_IMA4_ALuint(dst, src, chans, len);
- break;
- case UserFmtFloat:
- Convert_IMA4_ALfloat(dst, src, chans, len);
- break;
- case UserFmtDouble:
- Convert_IMA4_ALdouble(dst, src, chans, len);
- break;
- case UserFmtMulaw:
- Convert_IMA4_ALmulaw(dst, src, chans, len);
- break;
- case UserFmtIMA4:
- Convert_IMA4_IMA4(dst, src, chans, len);
- break;
- }
-}
-
static void ConvertData(ALvoid *dst, enum UserFmtType dstType, const ALvoid *src, enum UserFmtType srcType, ALsizei numchans, ALsizei len)
{
@@ -1686,7 +1647,7 @@ static void ConvertData(ALvoid *dst, enum UserFmtType dstType, const ALvoid *src
Convert_ALmulaw(dst, src, srcType, numchans, len);
break;
case UserFmtIMA4:
- Convert_IMA4(dst, src, srcType, numchans, len);
+ Convert_ALima4(dst, src, srcType, numchans, len);
break;
}
}