diff options
author | Chris Robinson <[email protected]> | 2010-12-03 22:33:41 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2010-12-03 22:33:41 -0800 |
commit | 9581325b9c573941bbac4b27824045a3274f383e (patch) | |
tree | 1617adb31b0c95613120ce52c4b5bb42bc237428 | |
parent | 59990acc2a380987886e6fa26a8a644d6016b4a9 (diff) |
Rename SrcFmt -> UserFmt
-rw-r--r-- | OpenAL32/Include/alBuffer.h | 76 | ||||
-rw-r--r-- | OpenAL32/alBuffer.c | 272 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 12 |
3 files changed, 180 insertions, 180 deletions
diff --git a/OpenAL32/Include/alBuffer.h b/OpenAL32/Include/alBuffer.h index 2a9bd3e1..e22d839d 100644 --- a/OpenAL32/Include/alBuffer.h +++ b/OpenAL32/Include/alBuffer.h @@ -8,53 +8,53 @@ extern "C" { #endif /* Input formats (some are currently theoretical) */ -enum SrcFmtType { - SrcFmtByte, /* AL_BYTE */ - SrcFmtUByte, /* AL_UNSIGNED_BYTE */ - SrcFmtShort, /* AL_SHORT */ - SrcFmtUShort, /* AL_UNSIGNED_SHORT */ - SrcFmtInt, /* AL_INT */ - SrcFmtUInt, /* AL_UNSIGNED_INT */ - SrcFmtFloat, /* AL_FLOAT */ - SrcFmtDouble, /* AL_DOUBLE */ - SrcFmtMulaw, /* AL_MULAW */ - SrcFmtIMA4, /* AL_IMA4 */ +enum UserFmtType { + UserFmtByte, /* AL_BYTE */ + UserFmtUByte, /* AL_UNSIGNED_BYTE */ + UserFmtShort, /* AL_SHORT */ + UserFmtUShort, /* AL_UNSIGNED_SHORT */ + UserFmtInt, /* AL_INT */ + UserFmtUInt, /* AL_UNSIGNED_INT */ + UserFmtFloat, /* AL_FLOAT */ + UserFmtDouble, /* AL_DOUBLE */ + UserFmtMulaw, /* AL_MULAW */ + UserFmtIMA4, /* AL_IMA4 */ }; -enum SrcFmtChannels { - SrcFmtMono, /* AL_MONO */ - SrcFmtStereo, /* AL_STEREO */ - SrcFmtRear, /* AL_REAR */ - SrcFmtQuad, /* AL_QUAD */ - SrcFmtX51, /* AL_5POINT1 (WFX order) */ - SrcFmtX61, /* AL_6POINT1 (WFX order) */ - SrcFmtX71, /* AL_7POINT1 (WFX order) */ +enum UserFmtChannels { + UserFmtMono, /* AL_MONO */ + UserFmtStereo, /* AL_STEREO */ + UserFmtRear, /* AL_REAR */ + UserFmtQuad, /* AL_QUAD */ + UserFmtX51, /* AL_5POINT1 (WFX order) */ + UserFmtX61, /* AL_6POINT1 (WFX order) */ + UserFmtX71, /* AL_7POINT1 (WFX order) */ }; -ALboolean DecomposeInputFormat(ALenum format, enum SrcFmtChannels *chans, - enum SrcFmtType *type); -ALuint BytesFromSrcFmt(enum SrcFmtType type); -ALuint ChannelsFromSrcFmt(enum SrcFmtChannels chans); -static __inline ALuint FrameSizeFromSrcFmt(enum SrcFmtChannels chans, - enum SrcFmtType type) +ALboolean DecomposeUserFormat(ALenum format, enum UserFmtChannels *chans, + enum UserFmtType *type); +ALuint BytesFromUserFmt(enum UserFmtType type); +ALuint ChannelsFromUserFmt(enum UserFmtChannels chans); +static __inline ALuint FrameSizeFromUserFmt(enum UserFmtChannels chans, + enum UserFmtType type) { - return ChannelsFromSrcFmt(chans) * BytesFromSrcFmt(type); + return ChannelsFromUserFmt(chans) * BytesFromUserFmt(type); } /* Storable formats */ enum FmtType { - FmtUByte = SrcFmtUByte, - FmtShort = SrcFmtShort, - FmtFloat = SrcFmtFloat, + FmtUByte = UserFmtUByte, + FmtShort = UserFmtShort, + FmtFloat = UserFmtFloat, }; enum FmtChannels { - FmtMono = SrcFmtMono, - FmtStereo = SrcFmtStereo, - FmtRear = SrcFmtRear, - FmtQuad = SrcFmtQuad, - FmtX51 = SrcFmtX51, - FmtX61 = SrcFmtX61, - FmtX71 = SrcFmtX71, + FmtMono = UserFmtMono, + FmtStereo = UserFmtStereo, + FmtRear = UserFmtRear, + FmtQuad = UserFmtQuad, + FmtX51 = UserFmtX51, + FmtX61 = UserFmtX61, + FmtX71 = UserFmtX71, }; ALboolean DecomposeFormat(ALenum format, enum FmtChannels *chans, enum FmtType *type); @@ -75,8 +75,8 @@ typedef struct ALbuffer enum FmtChannels FmtChannels; enum FmtType FmtType; - enum SrcFmtChannels OriginalChannels; - enum SrcFmtType OriginalType; + enum UserFmtChannels OriginalChannels; + enum UserFmtType OriginalType; ALsizei OriginalSize; ALsizei OriginalAlign; diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c index 111c4cb2..8c9edde9 100644 --- a/OpenAL32/alBuffer.c +++ b/OpenAL32/alBuffer.c @@ -34,8 +34,8 @@ #include "alThunk.h" -static ALenum LoadData(ALbuffer *ALBuf, ALuint freq, ALenum NewFormat, ALsizei size, enum SrcFmtChannels chans, enum SrcFmtType type, const ALvoid *data); -static void ConvertData(ALvoid *dst, enum FmtType dstType, const ALvoid *src, enum SrcFmtType srcType, ALsizei len); +static ALenum LoadData(ALbuffer *ALBuf, ALuint freq, ALenum NewFormat, ALsizei size, enum UserFmtChannels chans, enum UserFmtType type, const ALvoid *data); +static void ConvertData(ALvoid *dst, enum FmtType dstType, const ALvoid *src, enum UserFmtType srcType, ALsizei len); static void ConvertDataIMA4(ALvoid *dst, enum FmtType dstType, const ALvoid *src, ALint chans, ALsizei len); #define LookupBuffer(m, k) ((ALbuffer*)LookupUIntMapKey(&(m), (k))) @@ -283,8 +283,8 @@ AL_API ALboolean AL_APIENTRY alIsBuffer(ALuint buffer) */ AL_API ALvoid AL_APIENTRY alBufferData(ALuint buffer,ALenum format,const ALvoid *data,ALsizei size,ALsizei freq) { - enum SrcFmtChannels SrcChannels; - enum SrcFmtType SrcType; + enum UserFmtChannels SrcChannels; + enum UserFmtType SrcType; ALCcontext *Context; ALCdevice *device; ALbuffer *ALBuf; @@ -315,51 +315,51 @@ AL_API ALvoid AL_APIENTRY alBufferData(ALuint buffer,ALenum format,const ALvoid alSetError(Context, AL_INVALID_VALUE); else if(size < 0 || freq < 0) alSetError(Context, AL_INVALID_VALUE); - else if(DecomposeInputFormat(format, &SrcChannels, &SrcType) == AL_FALSE) + else if(DecomposeUserFormat(format, &SrcChannels, &SrcType) == AL_FALSE) alSetError(Context, AL_INVALID_ENUM); else switch(SrcType) { - case SrcFmtByte: - case SrcFmtUByte: - case SrcFmtShort: - case SrcFmtUShort: - case SrcFmtInt: - case SrcFmtUInt: - case SrcFmtFloat: + case UserFmtByte: + case UserFmtUByte: + case UserFmtShort: + case UserFmtUShort: + case UserFmtInt: + case UserFmtUInt: + case UserFmtFloat: err = LoadData(ALBuf, freq, format, size, SrcChannels, SrcType, data); if(err != AL_NO_ERROR) alSetError(Context, err); break; - case SrcFmtDouble: { + case UserFmtDouble: { ALenum NewFormat = AL_FORMAT_MONO_FLOAT32; switch(SrcChannels) { - case SrcFmtMono: NewFormat = AL_FORMAT_MONO_FLOAT32; break; - case SrcFmtStereo: NewFormat = AL_FORMAT_STEREO_FLOAT32; break; - case SrcFmtRear: NewFormat = AL_FORMAT_REAR32; break; - case SrcFmtQuad: NewFormat = AL_FORMAT_QUAD32; break; - case SrcFmtX51: NewFormat = AL_FORMAT_51CHN32; break; - case SrcFmtX61: NewFormat = AL_FORMAT_61CHN32; break; - case SrcFmtX71: NewFormat = AL_FORMAT_71CHN32; break; + case UserFmtMono: NewFormat = AL_FORMAT_MONO_FLOAT32; break; + case UserFmtStereo: NewFormat = AL_FORMAT_STEREO_FLOAT32; break; + case UserFmtRear: NewFormat = AL_FORMAT_REAR32; break; + case UserFmtQuad: NewFormat = AL_FORMAT_QUAD32; break; + case UserFmtX51: NewFormat = AL_FORMAT_51CHN32; break; + case UserFmtX61: NewFormat = AL_FORMAT_61CHN32; break; + case UserFmtX71: NewFormat = AL_FORMAT_71CHN32; break; } err = LoadData(ALBuf, freq, NewFormat, size, SrcChannels, SrcType, data); if(err != AL_NO_ERROR) alSetError(Context, err); } break; - case SrcFmtMulaw: - case SrcFmtIMA4: { + case UserFmtMulaw: + case UserFmtIMA4: { ALenum NewFormat = AL_FORMAT_MONO16; switch(SrcChannels) { - case SrcFmtMono: NewFormat = AL_FORMAT_MONO16; break; - case SrcFmtStereo: NewFormat = AL_FORMAT_STEREO16; break; - case SrcFmtRear: NewFormat = AL_FORMAT_REAR16; break; - case SrcFmtQuad: NewFormat = AL_FORMAT_QUAD16; break; - case SrcFmtX51: NewFormat = AL_FORMAT_51CHN16; break; - case SrcFmtX61: NewFormat = AL_FORMAT_61CHN16; break; - case SrcFmtX71: NewFormat = AL_FORMAT_71CHN16; break; + case UserFmtMono: NewFormat = AL_FORMAT_MONO16; break; + case UserFmtStereo: NewFormat = AL_FORMAT_STEREO16; break; + case UserFmtRear: NewFormat = AL_FORMAT_REAR16; break; + case UserFmtQuad: NewFormat = AL_FORMAT_QUAD16; break; + case UserFmtX51: NewFormat = AL_FORMAT_51CHN16; break; + case UserFmtX61: NewFormat = AL_FORMAT_61CHN16; break; + case UserFmtX71: NewFormat = AL_FORMAT_71CHN16; break; } err = LoadData(ALBuf, freq, NewFormat, size, SrcChannels, SrcType, data); if(err != AL_NO_ERROR) @@ -378,8 +378,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; + enum UserFmtChannels SrcChannels; + enum UserFmtType SrcType; ALCcontext *Context; ALCdevice *device; ALbuffer *ALBuf; @@ -407,7 +407,7 @@ AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer,ALenum format,const alSetError(Context, AL_INVALID_NAME); else if(length < 0 || offset < 0 || (length > 0 && data == NULL)) alSetError(Context, AL_INVALID_VALUE); - else if(DecomposeInputFormat(format, &SrcChannels, &SrcType) == AL_FALSE || + else if(DecomposeUserFormat(format, &SrcChannels, &SrcType) == AL_FALSE || SrcChannels != ALBuf->OriginalChannels || SrcType != ALBuf->OriginalType) alSetError(Context, AL_INVALID_ENUM); @@ -418,7 +418,7 @@ AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer,ALenum format,const alSetError(Context, AL_INVALID_VALUE); else { - if(SrcType == SrcFmtIMA4) + if(SrcType == UserFmtIMA4) { ALuint Channels = ChannelsFromFmt(ALBuf->FmtChannels); ALuint Bytes = BytesFromFmt(ALBuf->FmtType); @@ -434,7 +434,7 @@ AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer,ALenum format,const } else { - ALuint OldBytes = BytesFromFmt(SrcType); + ALuint OldBytes = BytesFromUserFmt(SrcType); ALuint Bytes = BytesFromFmt(ALBuf->FmtType); offset /= OldBytes; @@ -1254,39 +1254,39 @@ DECL_TEMPLATE(ALmulaw) #undef DECL_TEMPLATE #define DECL_TEMPLATE(T) \ -static void Convert_##T(T *dst, const ALvoid *src, enum SrcFmtType srcType, \ +static void Convert_##T(T *dst, const ALvoid *src, enum UserFmtType srcType, \ ALsizei len) \ { \ switch(srcType) \ { \ - case SrcFmtByte: \ + case UserFmtByte: \ Convert_##T##_ALbyte(dst, src, len); \ break; \ - case SrcFmtUByte: \ + case UserFmtUByte: \ Convert_##T##_ALubyte(dst, src, len); \ break; \ - case SrcFmtShort: \ + case UserFmtShort: \ Convert_##T##_ALshort(dst, src, len); \ break; \ - case SrcFmtUShort: \ + case UserFmtUShort: \ Convert_##T##_ALushort(dst, src, len); \ break; \ - case SrcFmtInt: \ + case UserFmtInt: \ Convert_##T##_ALint(dst, src, len); \ break; \ - case SrcFmtUInt: \ + case UserFmtUInt: \ Convert_##T##_ALuint(dst, src, len); \ break; \ - case SrcFmtFloat: \ + case UserFmtFloat: \ Convert_##T##_ALfloat(dst, src, len); \ break; \ - case SrcFmtDouble: \ + case UserFmtDouble: \ Convert_##T##_ALdouble(dst, src, len); \ break; \ - case SrcFmtMulaw: \ + case UserFmtMulaw: \ Convert_##T##_ALmulaw(dst, src, len); \ break; \ - case SrcFmtIMA4: \ + case UserFmtIMA4: \ break; /* not handled here */ \ } \ } @@ -1304,7 +1304,7 @@ DECL_TEMPLATE(ALmulaw) #undef DECL_TEMPLATE -static void ConvertData(ALvoid *dst, enum FmtType dstType, const ALvoid *src, enum SrcFmtType srcType, ALsizei len) +static void ConvertData(ALvoid *dst, enum FmtType dstType, const ALvoid *src, enum UserFmtType srcType, ALsizei len) { switch(dstType) { @@ -1356,7 +1356,7 @@ static void ConvertDataIMA4(ALvoid *dst, enum FmtType dstType, const ALvoid *src * Currently, the new format must have the same channel configuration as the * original format. */ -static ALenum LoadData(ALbuffer *ALBuf, ALuint freq, ALenum NewFormat, ALsizei size, enum SrcFmtChannels SrcChannels, enum SrcFmtType SrcType, const ALvoid *data) +static ALenum LoadData(ALbuffer *ALBuf, ALuint freq, ALenum NewFormat, ALsizei size, enum UserFmtChannels SrcChannels, enum UserFmtType SrcType, const ALvoid *data) { ALuint NewChannels, NewBytes; enum FmtChannels DstChannels; @@ -1370,9 +1370,9 @@ static ALenum LoadData(ALbuffer *ALBuf, ALuint freq, ALenum NewFormat, ALsizei s assert(SrcChannels == DstChannels); - if(SrcType == SrcFmtIMA4) + if(SrcType == UserFmtIMA4) { - ALuint OrigChannels = ChannelsFromSrcFmt(SrcChannels); + ALuint OrigChannels = ChannelsFromUserFmt(SrcChannels); /* Here is where things vary: * nVidia and Apple use 64+1 sample frames per block -> block_size=36 bytes per channel @@ -1403,8 +1403,8 @@ static ALenum LoadData(ALbuffer *ALBuf, ALuint freq, ALenum NewFormat, ALsizei s } else { - ALuint OrigBytes = BytesFromSrcFmt(SrcType); - ALuint OrigChannels = ChannelsFromSrcFmt(SrcChannels); + ALuint OrigBytes = BytesFromUserFmt(SrcType); + ALuint OrigChannels = ChannelsFromUserFmt(SrcChannels); if((size%(OrigBytes*OrigChannels)) != 0) return AL_INVALID_VALUE; @@ -1439,171 +1439,171 @@ static ALenum LoadData(ALbuffer *ALBuf, ALuint freq, ALenum NewFormat, ALsizei s } -ALuint BytesFromSrcFmt(enum SrcFmtType type) +ALuint BytesFromUserFmt(enum UserFmtType type) { switch(type) { - case SrcFmtByte: return sizeof(ALbyte); - case SrcFmtUByte: return sizeof(ALubyte); - case SrcFmtShort: return sizeof(ALshort); - case SrcFmtUShort: return sizeof(ALushort); - case SrcFmtInt: return sizeof(ALint); - case SrcFmtUInt: return sizeof(ALuint); - case SrcFmtFloat: return sizeof(ALfloat); - case SrcFmtDouble: return sizeof(ALdouble); - case SrcFmtMulaw: return sizeof(ALubyte); - case SrcFmtIMA4: break; /* not handled here */ + case UserFmtByte: return sizeof(ALbyte); + case UserFmtUByte: return sizeof(ALubyte); + case UserFmtShort: return sizeof(ALshort); + case UserFmtUShort: return sizeof(ALushort); + case UserFmtInt: return sizeof(ALint); + case UserFmtUInt: return sizeof(ALuint); + case UserFmtFloat: return sizeof(ALfloat); + case UserFmtDouble: return sizeof(ALdouble); + case UserFmtMulaw: return sizeof(ALubyte); + case UserFmtIMA4: break; /* not handled here */ } return 0; } -ALuint ChannelsFromSrcFmt(enum SrcFmtChannels chans) +ALuint ChannelsFromUserFmt(enum UserFmtChannels chans) { switch(chans) { - case SrcFmtMono: return 1; - case SrcFmtStereo: return 2; - case SrcFmtRear: return 2; - case SrcFmtQuad: return 4; - case SrcFmtX51: return 6; - case SrcFmtX61: return 7; - case SrcFmtX71: return 8; + case UserFmtMono: return 1; + case UserFmtStereo: return 2; + case UserFmtRear: return 2; + case UserFmtQuad: return 4; + case UserFmtX51: return 6; + case UserFmtX61: return 7; + case UserFmtX71: return 8; } return 0; } -ALboolean DecomposeInputFormat(ALenum format, enum SrcFmtChannels *chans, - enum SrcFmtType *type) +ALboolean DecomposeUserFormat(ALenum format, enum UserFmtChannels *chans, + enum UserFmtType *type) { switch(format) { case AL_FORMAT_MONO8: - *chans = SrcFmtMono; - *type = SrcFmtUByte; + *chans = UserFmtMono; + *type = UserFmtUByte; return AL_TRUE; case AL_FORMAT_MONO16: - *chans = SrcFmtMono; - *type = SrcFmtShort; + *chans = UserFmtMono; + *type = UserFmtShort; return AL_TRUE; case AL_FORMAT_MONO_FLOAT32: - *chans = SrcFmtMono; - *type = SrcFmtFloat; + *chans = UserFmtMono; + *type = UserFmtFloat; return AL_TRUE; case AL_FORMAT_MONO_DOUBLE_EXT: - *chans = SrcFmtMono; - *type = SrcFmtDouble; + *chans = UserFmtMono; + *type = UserFmtDouble; return AL_TRUE; case AL_FORMAT_MONO_IMA4: - *chans = SrcFmtMono; - *type = SrcFmtIMA4; + *chans = UserFmtMono; + *type = UserFmtIMA4; return AL_TRUE; case AL_FORMAT_STEREO8: - *chans = SrcFmtStereo; - *type = SrcFmtUByte; + *chans = UserFmtStereo; + *type = UserFmtUByte; return AL_TRUE; case AL_FORMAT_STEREO16: - *chans = SrcFmtStereo; - *type = SrcFmtShort; + *chans = UserFmtStereo; + *type = UserFmtShort; return AL_TRUE; case AL_FORMAT_STEREO_FLOAT32: - *chans = SrcFmtStereo; - *type = SrcFmtFloat; + *chans = UserFmtStereo; + *type = UserFmtFloat; return AL_TRUE; case AL_FORMAT_STEREO_DOUBLE_EXT: - *chans = SrcFmtStereo; - *type = SrcFmtDouble; + *chans = UserFmtStereo; + *type = UserFmtDouble; return AL_TRUE; case AL_FORMAT_STEREO_IMA4: - *chans = SrcFmtStereo; - *type = SrcFmtIMA4; + *chans = UserFmtStereo; + *type = UserFmtIMA4; return AL_TRUE; case AL_FORMAT_QUAD8_LOKI: case AL_FORMAT_QUAD8: - *chans = SrcFmtQuad; - *type = SrcFmtUByte; + *chans = UserFmtQuad; + *type = UserFmtUByte; return AL_TRUE; case AL_FORMAT_QUAD16_LOKI: case AL_FORMAT_QUAD16: - *chans = SrcFmtQuad; - *type = SrcFmtShort; + *chans = UserFmtQuad; + *type = UserFmtShort; return AL_TRUE; case AL_FORMAT_QUAD32: - *chans = SrcFmtQuad; - *type = SrcFmtFloat; + *chans = UserFmtQuad; + *type = UserFmtFloat; return AL_TRUE; case AL_FORMAT_REAR8: - *chans = SrcFmtRear; - *type = SrcFmtUByte; + *chans = UserFmtRear; + *type = UserFmtUByte; return AL_TRUE; case AL_FORMAT_REAR16: - *chans = SrcFmtRear; - *type = SrcFmtShort; + *chans = UserFmtRear; + *type = UserFmtShort; return AL_TRUE; case AL_FORMAT_REAR32: - *chans = SrcFmtRear; - *type = SrcFmtFloat; + *chans = UserFmtRear; + *type = UserFmtFloat; return AL_TRUE; case AL_FORMAT_51CHN8: - *chans = SrcFmtX51; - *type = SrcFmtUByte; + *chans = UserFmtX51; + *type = UserFmtUByte; return AL_TRUE; case AL_FORMAT_51CHN16: - *chans = SrcFmtX51; - *type = SrcFmtShort; + *chans = UserFmtX51; + *type = UserFmtShort; return AL_TRUE; case AL_FORMAT_51CHN32: - *chans = SrcFmtX51; - *type = SrcFmtFloat; + *chans = UserFmtX51; + *type = UserFmtFloat; return AL_TRUE; case AL_FORMAT_61CHN8: - *chans = SrcFmtX61; - *type = SrcFmtUByte; + *chans = UserFmtX61; + *type = UserFmtUByte; return AL_TRUE; case AL_FORMAT_61CHN16: - *chans = SrcFmtX61; - *type = SrcFmtShort; + *chans = UserFmtX61; + *type = UserFmtShort; return AL_TRUE; case AL_FORMAT_61CHN32: - *chans = SrcFmtX61; - *type = SrcFmtFloat; + *chans = UserFmtX61; + *type = UserFmtFloat; return AL_TRUE; case AL_FORMAT_71CHN8: - *chans = SrcFmtX71; - *type = SrcFmtUByte; + *chans = UserFmtX71; + *type = UserFmtUByte; return AL_TRUE; case AL_FORMAT_71CHN16: - *chans = SrcFmtX71; - *type = SrcFmtShort; + *chans = UserFmtX71; + *type = UserFmtShort; return AL_TRUE; case AL_FORMAT_71CHN32: - *chans = SrcFmtX71; - *type = SrcFmtFloat; + *chans = UserFmtX71; + *type = UserFmtFloat; return AL_TRUE; case AL_FORMAT_MONO_MULAW: - *chans = SrcFmtMono; - *type = SrcFmtMulaw; + *chans = UserFmtMono; + *type = UserFmtMulaw; return AL_TRUE; case AL_FORMAT_STEREO_MULAW: - *chans = SrcFmtStereo; - *type = SrcFmtMulaw; + *chans = UserFmtStereo; + *type = UserFmtMulaw; return AL_TRUE; case AL_FORMAT_QUAD_MULAW: - *chans = SrcFmtQuad; - *type = SrcFmtMulaw; + *chans = UserFmtQuad; + *type = UserFmtMulaw; return AL_TRUE; case AL_FORMAT_REAR_MULAW: - *chans = SrcFmtRear; - *type = SrcFmtMulaw; + *chans = UserFmtRear; + *type = UserFmtMulaw; return AL_TRUE; case AL_FORMAT_51CHN_MULAW: - *chans = SrcFmtX51; - *type = SrcFmtMulaw; + *chans = UserFmtX51; + *type = UserFmtMulaw; return AL_TRUE; case AL_FORMAT_61CHN_MULAW: - *chans = SrcFmtX61; - *type = SrcFmtMulaw; + *chans = UserFmtX61; + *type = UserFmtMulaw; return AL_TRUE; case AL_FORMAT_71CHN_MULAW: - *chans = SrcFmtX71; - *type = SrcFmtMulaw; + *chans = UserFmtX71; + *type = UserFmtMulaw; return AL_TRUE; } return AL_FALSE; diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 837d6b95..1541bd89 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -1804,7 +1804,7 @@ static ALvoid GetSourceOffset(ALsource *Source, ALenum name, ALdouble *offset, A ALfloat BufferFreq; ALint Channels, Bytes; ALuint readPos, writePos; - enum SrcFmtType OriginalType; + enum UserFmtType OriginalType; ALuint TotalBufferDataSize; ALuint i; @@ -1881,7 +1881,7 @@ static ALvoid GetSourceOffset(ALsource *Source, ALenum name, ALdouble *offset, A case AL_BYTE_OFFSET: case AL_BYTE_RW_OFFSETS_SOFT: // Take into account the original format of the Buffer - if(OriginalType == SrcFmtIMA4) + if(OriginalType == UserFmtIMA4) { ALuint FrameBlockSize = 65 * Bytes * Channels; ALuint BlockSize = 36 * Channels; @@ -1899,7 +1899,7 @@ static ALvoid GetSourceOffset(ALsource *Source, ALenum name, ALdouble *offset, A } else { - ALuint OrigBytes = BytesFromSrcFmt(OriginalType); + ALuint OrigBytes = BytesFromUserFmt(OriginalType); offset[0] = (ALdouble)(readPos / Bytes * OrigBytes); offset[1] = (ALdouble)(writePos / Bytes * OrigBytes); } @@ -2005,15 +2005,15 @@ static ALint GetByteOffset(ALsource *Source) case AL_BYTE_OFFSET: // Take into consideration the original format ByteOffset = Source->lOffset; - if(Buffer->OriginalType == SrcFmtIMA4) + if(Buffer->OriginalType == UserFmtIMA4) { // Round down to nearest ADPCM block - ByteOffset /= 36 * ChannelsFromSrcFmt(Buffer->OriginalChannels); + ByteOffset /= 36 * ChannelsFromUserFmt(Buffer->OriginalChannels); // Multiply by compression rate (65 sample frames per block) ByteOffset *= 65; } else - ByteOffset /= FrameSizeFromSrcFmt(Buffer->OriginalChannels, Buffer->OriginalType); + ByteOffset /= FrameSizeFromUserFmt(Buffer->OriginalChannels, Buffer->OriginalType); ByteOffset *= FrameSizeFromFmt(Buffer->FmtChannels, Buffer->FmtType); break; |