diff options
author | Chris Robinson <[email protected]> | 2018-01-21 17:19:57 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-01-21 17:19:57 -0800 |
commit | 427212705f90feecb03ce224168a91c72d6290ee (patch) | |
tree | 2cf314e0c7882b147a8a379420cc605f24ca2923 /OpenAL32 | |
parent | f6276164f3fc6f8ee06dfd65bf3676b0b0bbb8b0 (diff) |
Remove the old buffer_samples functions
The symbols are still there and exported to retain ABI compatibility, but they
no longer do anything except set an AL_INVALID_OPERATION error. They're also
removed from the function and enum tables, since they're not part of any
supported extension.
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alBuffer.h | 34 | ||||
-rw-r--r-- | OpenAL32/alBuffer.c | 176 |
2 files changed, 32 insertions, 178 deletions
diff --git a/OpenAL32/Include/alBuffer.h b/OpenAL32/Include/alBuffer.h index 60a047c9..7f206ed8 100644 --- a/OpenAL32/Include/alBuffer.h +++ b/OpenAL32/Include/alBuffer.h @@ -9,28 +9,28 @@ extern "C" { /* User formats */ enum UserFmtType { - UserFmtByte = AL_BYTE_SOFT, - UserFmtUByte = AL_UNSIGNED_BYTE_SOFT, - UserFmtShort = AL_SHORT_SOFT, - UserFmtUShort = AL_UNSIGNED_SHORT_SOFT, - UserFmtInt = AL_INT_SOFT, - UserFmtUInt = AL_UNSIGNED_INT_SOFT, - UserFmtFloat = AL_FLOAT_SOFT, - UserFmtDouble = AL_DOUBLE_SOFT, - UserFmtMulaw = 0x10000000, + UserFmtByte, + UserFmtUByte, + UserFmtShort, + UserFmtUShort, + UserFmtInt, + UserFmtUInt, + UserFmtFloat, + UserFmtDouble, + UserFmtMulaw, UserFmtAlaw, UserFmtIMA4, UserFmtMSADPCM, }; enum UserFmtChannels { - UserFmtMono = AL_MONO_SOFT, - UserFmtStereo = AL_STEREO_SOFT, - UserFmtRear = AL_REAR_SOFT, - UserFmtQuad = AL_QUAD_SOFT, - UserFmtX51 = AL_5POINT1_SOFT, /* (WFX order) */ - UserFmtX61 = AL_6POINT1_SOFT, /* (WFX order) */ - UserFmtX71 = AL_7POINT1_SOFT, /* (WFX order) */ - UserFmtBFormat2D = 0x20000000, /* WXY */ + UserFmtMono, + UserFmtStereo, + UserFmtRear, + UserFmtQuad, + UserFmtX51, /* (WFX order) */ + UserFmtX61, /* (WFX order) */ + UserFmtX71, /* (WFX order) */ + UserFmtBFormat2D, /* WXY */ UserFmtBFormat3D, /* WXYZ */ }; diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c index 72750360..186097cc 100644 --- a/OpenAL32/alBuffer.c +++ b/OpenAL32/alBuffer.c @@ -46,8 +46,6 @@ extern inline ALsizei FrameSizeFromUserFmt(enum UserFmtChannels chans, enum User extern inline ALsizei FrameSizeFromFmt(enum FmtChannels chans, enum FmtType type); static ALenum LoadData(ALbuffer *buffer, ALuint freq, ALenum NewFormat, ALsizei frames, enum UserFmtChannels SrcChannels, enum UserFmtType SrcType, const ALvoid *data, ALsizei align, ALbitfieldSOFT access, ALboolean storesrc); -static ALboolean IsValidType(ALenum type); -static ALboolean IsValidChannels(ALenum channels); static ALboolean DecomposeUserFormat(ALenum format, enum UserFmtChannels *chans, enum UserFmtType *type); static ALboolean DecomposeFormat(ALenum format, enum FmtChannels *chans, enum FmtType *type); static ALsizei SanitizeAlignment(enum UserFmtType type, ALsizei align); @@ -427,169 +425,59 @@ done: } -AL_API void AL_APIENTRY alBufferSamplesSOFT(ALuint buffer, - ALuint samplerate, ALenum internalformat, ALsizei samples, - ALenum channels, ALenum type, const ALvoid *data) +AL_API void AL_APIENTRY alBufferSamplesSOFT(ALuint UNUSED(buffer), + ALuint UNUSED(samplerate), ALenum UNUSED(internalformat), ALsizei UNUSED(samples), + ALenum UNUSED(channels), ALenum UNUSED(type), const ALvoid *UNUSED(data)) { - ALCdevice *device; ALCcontext *context; - ALbuffer *albuf; - ALsizei align; - ALenum err; context = GetContextRef(); if(!context) return; - device = context->Device; - LockBuffersRead(device); - if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - if(!(samples >= 0 && samplerate != 0) || (internalformat&~FORMAT_MASK) != 0) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - if(IsValidType(type) == AL_FALSE || IsValidChannels(channels) == AL_FALSE) - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); - - align = SanitizeAlignment(type, ATOMIC_LOAD_SEQ(&albuf->UnpackAlign)); - if(align < 1) SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - - if((samples%align) != 0) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - - err = LoadData(albuf, samplerate, internalformat, samples, - channels, type, data, align, 0, AL_FALSE); - if(err != AL_NO_ERROR) - SET_ERROR_AND_GOTO(context, err, done); + alSetError(context, AL_INVALID_OPERATION); -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } -AL_API void AL_APIENTRY alBufferSubSamplesSOFT(ALuint buffer, - ALsizei offset, ALsizei samples, - ALenum channels, ALenum type, const ALvoid *data) +AL_API void AL_APIENTRY alBufferSubSamplesSOFT(ALuint UNUSED(buffer), + ALsizei UNUSED(offset), ALsizei UNUSED(samples), + ALenum UNUSED(channels), ALenum UNUSED(type), const ALvoid *UNUSED(data)) { - ALCdevice *device; ALCcontext *context; - ALbuffer *albuf; - ALsizei align; context = GetContextRef(); if(!context) return; - device = context->Device; - LockBuffersRead(device); - if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - if(!(samples >= 0 && offset >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - if(IsValidType(type) == AL_FALSE) - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_OPERATION); - WriteLock(&albuf->lock); - align = SanitizeAlignment(type, ATOMIC_LOAD_SEQ(&albuf->UnpackAlign)); - if(align < 1) - { - WriteUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } - if(channels != (ALenum)albuf->FmtChannels) - { - WriteUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); - } - if(offset > albuf->SampleLen || samples > albuf->SampleLen-offset) - { - WriteUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } - if((samples%align) != 0) - { - WriteUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } - - /* offset -> byte offset */ - offset *= FrameSizeFromFmt(albuf->FmtChannels, albuf->FmtType); - ConvertData((char*)albuf->data+offset, (enum UserFmtType)albuf->FmtType, - data, type, ChannelsFromFmt(albuf->FmtChannels), samples, align); - WriteUnlock(&albuf->lock); - -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } -AL_API void AL_APIENTRY alGetBufferSamplesSOFT(ALuint buffer, - ALsizei offset, ALsizei samples, - ALenum channels, ALenum type, ALvoid *data) +AL_API void AL_APIENTRY alGetBufferSamplesSOFT(ALuint UNUSED(buffer), + ALsizei UNUSED(offset), ALsizei UNUSED(samples), + ALenum UNUSED(channels), ALenum UNUSED(type), ALvoid *UNUSED(data)) { - ALCdevice *device; ALCcontext *context; - ALbuffer *albuf; - ALsizei align; context = GetContextRef(); if(!context) return; - device = context->Device; - LockBuffersRead(device); - if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - if(!(samples >= 0 && offset >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - if(IsValidType(type) == AL_FALSE) - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); - - ReadLock(&albuf->lock); - align = SanitizeAlignment(type, ATOMIC_LOAD_SEQ(&albuf->PackAlign)); - if(align < 1) - { - ReadUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } - if(channels != (ALenum)albuf->FmtChannels) - { - ReadUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); - } - if(offset > albuf->SampleLen || samples > albuf->SampleLen-offset) - { - ReadUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } - if((samples%align) != 0) - { - ReadUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } - - /* offset -> byte offset */ - offset *= FrameSizeFromFmt(albuf->FmtChannels, albuf->FmtType); - ConvertData(data, type, (char*)albuf->data+offset, (enum UserFmtType)albuf->FmtType, - ChannelsFromFmt(albuf->FmtChannels), samples, align); - ReadUnlock(&albuf->lock); + alSetError(context, AL_INVALID_OPERATION); -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } -AL_API ALboolean AL_APIENTRY alIsBufferFormatSupportedSOFT(ALenum format) +AL_API ALboolean AL_APIENTRY alIsBufferFormatSupportedSOFT(ALenum UNUSED(format)) { - enum FmtChannels dstchannels; - enum FmtType dsttype; ALCcontext *context; - ALboolean ret; context = GetContextRef(); if(!context) return AL_FALSE; - ret = DecomposeFormat(format, &dstchannels, &dsttype); + alSetError(context, AL_INVALID_OPERATION); ALCcontext_DecRef(context); - - return ret; + return AL_FALSE; } @@ -1391,40 +1279,6 @@ static ALsizei SanitizeAlignment(enum UserFmtType type, ALsizei align) } -static ALboolean IsValidType(ALenum type) -{ - switch(type) - { - case AL_BYTE_SOFT: - case AL_UNSIGNED_BYTE_SOFT: - case AL_SHORT_SOFT: - case AL_UNSIGNED_SHORT_SOFT: - case AL_INT_SOFT: - case AL_UNSIGNED_INT_SOFT: - case AL_FLOAT_SOFT: - case AL_DOUBLE_SOFT: - return AL_TRUE; - } - return AL_FALSE; -} - -static ALboolean IsValidChannels(ALenum channels) -{ - switch(channels) - { - case AL_MONO_SOFT: - case AL_STEREO_SOFT: - case AL_REAR_SOFT: - case AL_QUAD_SOFT: - case AL_5POINT1_SOFT: - case AL_6POINT1_SOFT: - case AL_7POINT1_SOFT: - return AL_TRUE; - } - return AL_FALSE; -} - - ALbuffer *NewBuffer(ALCcontext *context) { ALCdevice *device = context->Device; |