aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--OpenAL32/alBuffer.c45
1 files changed, 18 insertions, 27 deletions
diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c
index b6ded027..f60bd399 100644
--- a/OpenAL32/alBuffer.c
+++ b/OpenAL32/alBuffer.c
@@ -415,6 +415,8 @@ AL_API ALvoid AL_APIENTRY alBufferData(ALuint buffer,ALenum format,const ALvoid
*/
AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer,ALenum format,const ALvoid *data,ALsizei offset,ALsizei length)
{
+ enum SrcFmtChannels SrcChannels;
+ enum SrcFmtType SrcType;
ALCcontext *Context;
ALCdevice *device;
ALbuffer *ALBuf;
@@ -454,11 +456,13 @@ AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer,ALenum format,const
case AL_FORMAT_MONO_FLOAT32:
case AL_FORMAT_MONO_DOUBLE_EXT:
case AL_FORMAT_MONO_MULAW:
+ case AL_FORMAT_MONO_IMA4:
case AL_FORMAT_STEREO8:
case AL_FORMAT_STEREO16:
case AL_FORMAT_STEREO_FLOAT32:
case AL_FORMAT_STEREO_DOUBLE_EXT:
case AL_FORMAT_STEREO_MULAW:
+ case AL_FORMAT_STEREO_IMA4:
case AL_FORMAT_QUAD8_LOKI:
case AL_FORMAT_QUAD16_LOKI:
case AL_FORMAT_QUAD8:
@@ -480,49 +484,36 @@ AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer,ALenum format,const
case AL_FORMAT_71CHN8:
case AL_FORMAT_71CHN16:
case AL_FORMAT_71CHN32:
- case AL_FORMAT_71CHN_MULAW: {
- enum SrcFmtChannels SrcChannels;
- enum SrcFmtType SrcType;
-
+ case AL_FORMAT_71CHN_MULAW:
DecomposeInputFormat(format, &SrcChannels, &SrcType);
if(SrcChannels != ALBuf->OriginalChannels || SrcType != ALBuf->OriginalType)
alSetError(Context, AL_INVALID_ENUM);
- else
+ else if(SrcType == SrcFmtIMA4)
{
- ALuint OldBytes = BytesFromFmt(SrcType);
+ ALuint Channels = ChannelsFromFmt(ALBuf->FmtChannels);
ALuint Bytes = BytesFromFmt(ALBuf->FmtType);
- offset /= OldBytes;
+ /* offset -> byte offset, length -> block count */
+ offset /= 36;
+ offset *= 65;
offset *= Bytes;
- length /= OldBytes;
+ length /= ALBuf->OriginalAlign;
- ConvertData(&((ALubyte*)ALBuf->data)[offset], ALBuf->FmtType,
- data, SrcType, length);
+ ConvertDataIMA4(&((ALubyte*)ALBuf->data)[offset], data, Channels, length);
}
- } break;
-
- case AL_FORMAT_MONO_IMA4:
- case AL_FORMAT_STEREO_IMA4: {
- enum SrcFmtChannels SrcChannels;
- enum SrcFmtType SrcType;
-
- DecomposeInputFormat(format, &SrcChannels, &SrcType);
- if(SrcChannels != ALBuf->OriginalChannels || SrcType != SrcFmtIMA4)
- alSetError(Context, AL_INVALID_ENUM);
else
{
- ALuint Channels = ChannelsFromFmt(ALBuf->FmtChannels);
+ ALuint OldBytes = BytesFromFmt(SrcType);
ALuint Bytes = BytesFromFmt(ALBuf->FmtType);
- /* offset -> byte offset, length -> block count */
- offset /= 36;
- offset *= 65;
+ offset /= OldBytes;
offset *= Bytes;
- length /= ALBuf->OriginalAlign;
+ length /= OldBytes;
- ConvertDataIMA4(&((ALubyte*)ALBuf->data)[offset], data, Channels, length);
+ ConvertData(&((ALubyte*)ALBuf->data)[offset], ALBuf->FmtType,
+ data, SrcType, length);
}
- } break;
+ break;
default:
alSetError(Context, AL_INVALID_ENUM);