diff options
author | Chris Robinson <[email protected]> | 2014-03-05 06:13:00 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-03-05 06:13:00 -0800 |
commit | a4126b66d4c44d60c8f10c4b8949de1c7b247994 (patch) | |
tree | aa61a14832cf2468f7158b9179027b5bb3cf820f /OpenAL32/alBuffer.c | |
parent | f82f3f10ab55fe43178b88c9b8e0fb6a0b839242 (diff) |
Use specialized methods for converting ALshort to IMA4 and MSADPCM
As before, to avoid unnecessary direct copies
Diffstat (limited to 'OpenAL32/alBuffer.c')
-rw-r--r-- | OpenAL32/alBuffer.c | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c index ddd9e59f..3c547f7f 100644 --- a/OpenAL32/alBuffer.c +++ b/OpenAL32/alBuffer.c @@ -1896,7 +1896,21 @@ static void Convert_ALima4_##T(ALima4 *dst, const T *src, ALuint numchans, \ DECL_TEMPLATE(ALbyte) DECL_TEMPLATE(ALubyte) -DECL_TEMPLATE(ALshort) +static void Convert_ALima4_ALshort(ALima4 *dst, const ALshort *src, + ALuint numchans, ALuint len, ALuint align) +{ + ALint sample[MaxChannels] = {0,0,0,0,0,0,0,0}; + ALint index[MaxChannels] = {0,0,0,0,0,0,0,0}; + ALsizei byte_align = ((align-1)/2 + 4) * numchans; + ALuint i; + + for(i = 0;i < len;i += align) + { + EncodeIMA4Block(dst, src, sample, index, numchans, align); + src += align*numchans; + dst += byte_align; + } +} DECL_TEMPLATE(ALushort) DECL_TEMPLATE(ALint) DECL_TEMPLATE(ALuint) @@ -1988,7 +2002,23 @@ static void Convert_ALmsadpcm_##T(ALmsadpcm *dst, const T *src, \ DECL_TEMPLATE(ALbyte) DECL_TEMPLATE(ALubyte) -DECL_TEMPLATE(ALshort) +static void Convert_ALmsadpcm_ALshort(ALmsadpcm *dst, const ALshort *src, + ALuint numchans, ALuint len, ALuint align) +{ + ALint sample[MaxChannels] = {0,0,0,0,0,0,0,0}; + ALint index[MaxChannels] = {0,0,0,0,0,0,0,0}; + ALsizei byte_align = ((align-2)/2 + 7) * numchans; + ALuint i; + + ERR("MSADPCM encoding not currently supported!\n"); + + for(i = 0;i < len;i += align) + { + EncodeMSADPCMBlock(dst, src, sample, index, numchans, align); + src += align*numchans; + dst += byte_align; + } +} DECL_TEMPLATE(ALushort) DECL_TEMPLATE(ALint) DECL_TEMPLATE(ALuint) |