diff options
author | Chris Robinson <[email protected]> | 2018-12-24 19:29:01 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-12-24 19:29:01 -0800 |
commit | fbae41020d8968d0e65af08584df4736b5ed7239 (patch) | |
tree | b2bb3297e5e5b4cf348e4e9379dfa4366dd8aa2d /OpenAL32 | |
parent | 194e7ff815d744830c8aaedfb0d32ed3c3d01645 (diff) |
Remove extraneous typedef, struct, and enum keywords
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alAuxEffectSlot.h | 2 | ||||
-rw-r--r-- | OpenAL32/Include/alBuffer.h | 26 | ||||
-rw-r--r-- | OpenAL32/Include/alEffect.h | 8 | ||||
-rw-r--r-- | OpenAL32/Include/alFilter.h | 40 | ||||
-rw-r--r-- | OpenAL32/Include/alMain.h | 34 | ||||
-rw-r--r-- | OpenAL32/Include/alSource.h | 25 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 61 | ||||
-rw-r--r-- | OpenAL32/alAuxEffectSlot.cpp | 4 | ||||
-rw-r--r-- | OpenAL32/alBuffer.cpp | 25 | ||||
-rw-r--r-- | OpenAL32/alEffect.cpp | 6 | ||||
-rw-r--r-- | OpenAL32/alListener.cpp | 2 | ||||
-rw-r--r-- | OpenAL32/alSource.cpp | 38 | ||||
-rw-r--r-- | OpenAL32/alState.cpp | 4 |
13 files changed, 127 insertions, 148 deletions
diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h index 1b14dd36..d970444c 100644 --- a/OpenAL32/Include/alAuxEffectSlot.h +++ b/OpenAL32/Include/alAuxEffectSlot.h @@ -46,7 +46,7 @@ struct EffectStateFactory { struct ALeffectslotArray { ALsizei count; - struct ALeffectslot *slot[]; + ALeffectslot *slot[]; }; diff --git a/OpenAL32/Include/alBuffer.h b/OpenAL32/Include/alBuffer.h index 691c7e22..ec9f6c37 100644 --- a/OpenAL32/Include/alBuffer.h +++ b/OpenAL32/Include/alBuffer.h @@ -33,12 +33,10 @@ enum UserFmtChannels { UserFmtBFormat3D, /* WXYZ */ }; -ALsizei BytesFromUserFmt(enum UserFmtType type); -ALsizei ChannelsFromUserFmt(enum UserFmtChannels chans); -inline ALsizei FrameSizeFromUserFmt(enum UserFmtChannels chans, enum UserFmtType type) -{ - return ChannelsFromUserFmt(chans) * BytesFromUserFmt(type); -} +ALsizei BytesFromUserFmt(UserFmtType type); +ALsizei ChannelsFromUserFmt(UserFmtChannels chans); +inline ALsizei FrameSizeFromUserFmt(UserFmtChannels chans, UserFmtType type) +{ return ChannelsFromUserFmt(chans) * BytesFromUserFmt(type); } /* Storable formats */ @@ -81,12 +79,10 @@ template<> struct FmtTypeTraits<FmtAlaw> { using Type = ALubyte; }; -ALsizei BytesFromFmt(enum FmtType type); -ALsizei ChannelsFromFmt(enum FmtChannels chans); -inline ALsizei FrameSizeFromFmt(enum FmtChannels chans, enum FmtType type) -{ - return ChannelsFromFmt(chans) * BytesFromFmt(type); -} +ALsizei BytesFromFmt(FmtType type); +ALsizei ChannelsFromFmt(FmtChannels chans); +inline ALsizei FrameSizeFromFmt(FmtChannels chans, FmtType type) +{ return ChannelsFromFmt(chans) * BytesFromFmt(type); } struct ALbuffer { @@ -96,11 +92,11 @@ struct ALbuffer { ALbitfieldSOFT Access{0u}; ALsizei SampleLen{0}; - enum FmtChannels FmtChannels{}; - enum FmtType FmtType{}; + FmtChannels mFmtChannels{}; + FmtType mFmtType{}; ALsizei BytesAlloc{0}; - enum UserFmtType OriginalType{}; + UserFmtType OriginalType{}; ALsizei OriginalSize{0}; ALsizei OriginalAlign{0}; diff --git a/OpenAL32/Include/alEffect.h b/OpenAL32/Include/alEffect.h index 441a8e97..710f512a 100644 --- a/OpenAL32/Include/alEffect.h +++ b/OpenAL32/Include/alEffect.h @@ -32,9 +32,7 @@ struct EffectList { int type; ALenum val; }; -#define EFFECTLIST_SIZE 14 -extern const EffectList EffectList[EFFECTLIST_SIZE]; - +extern const EffectList gEffectList[14]; struct ALeffectVtable { void (*const setParami)(ALeffect *effect, ALCcontext *context, ALenum param, ALint val); @@ -72,7 +70,7 @@ extern const ALeffectVtable ALpshifter_vtable; extern const ALeffectVtable ALdedicated_vtable; -typedef union ALeffectProps { +union ALeffectProps { struct { // Shared Reverb Properties ALfloat Density; @@ -173,7 +171,7 @@ typedef union ALeffectProps { struct { ALfloat Gain; } Dedicated; -} ALeffectProps; +}; struct ALeffect { // Effect type (AL_EFFECT_NULL, ...) diff --git a/OpenAL32/Include/alFilter.h b/OpenAL32/Include/alFilter.h index feca54e3..1c033ac3 100644 --- a/OpenAL32/Include/alFilter.h +++ b/OpenAL32/Include/alFilter.h @@ -11,27 +11,25 @@ struct ALfilter; -typedef struct ALfilterVtable { - void (*const setParami)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALint val); - void (*const setParamiv)(struct ALfilter *filter, ALCcontext *context, ALenum param, const ALint *vals); - void (*const setParamf)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val); - void (*const setParamfv)(struct ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals); - - void (*const getParami)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALint *val); - void (*const getParamiv)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALint *vals); - void (*const getParamf)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val); - void (*const getParamfv)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals); -} ALfilterVtable; - -#define DEFINE_ALFILTER_VTABLE(T) \ -const struct ALfilterVtable T##_vtable = { \ - T##_setParami, T##_setParamiv, \ - T##_setParamf, T##_setParamfv, \ - T##_getParami, T##_getParamiv, \ - T##_getParamf, T##_getParamfv, \ +struct ALfilterVtable { + void (*const setParami)(ALfilter *filter, ALCcontext *context, ALenum param, ALint val); + void (*const setParamiv)(ALfilter *filter, ALCcontext *context, ALenum param, const ALint *vals); + void (*const setParamf)(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val); + void (*const setParamfv)(ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals); + + void (*const getParami)(ALfilter *filter, ALCcontext *context, ALenum param, ALint *val); + void (*const getParamiv)(ALfilter *filter, ALCcontext *context, ALenum param, ALint *vals); + void (*const getParamf)(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val); + void (*const getParamfv)(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals); +}; + +#define DEFINE_ALFILTER_VTABLE(T) \ +const ALfilterVtable T##_vtable = { \ + T##_setParami, T##_setParamiv, T##_setParamf, T##_setParamfv, \ + T##_getParami, T##_getParamiv, T##_getParamf, T##_getParamfv, \ } -typedef struct ALfilter { +struct ALfilter { // Filter type (AL_FILTER_NULL, ...) ALenum type; @@ -41,11 +39,11 @@ typedef struct ALfilter { ALfloat GainLF; ALfloat LFReference; - const struct ALfilterVtable *vtab; + const ALfilterVtable *vtab; /* Self ID */ ALuint id; -} ALfilter; +}; #define ALfilter_setParami(o, c, p, v) ((o)->vtab->setParami(o, c, p, v)) #define ALfilter_setParamf(o, c, p, v) ((o)->vtab->setParamf(o, c, p, v)) #define ALfilter_setParamiv(o, c, p, v) ((o)->vtab->setParamiv(o, c, p, v)) diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index d12ea780..2ffea8aa 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -100,8 +100,8 @@ constexpr inline size_t countof(const T(&)[N]) noexcept #define FAM_SIZE(T, M, N) (offsetof(T, M) + sizeof(((T*)NULL)->M[0])*(N)) -typedef ALint64SOFT ALint64; -typedef ALuint64SOFT ALuint64; +using ALint64 = ALint64SOFT; +using ALuint64 = ALuint64SOFT; #ifndef U64 #if defined(_MSC_VER) @@ -537,23 +537,23 @@ enum RenderMode { }; -typedef ALfloat ChannelConfig[MAX_AMBI_COEFFS]; +using ChannelConfig = ALfloat[MAX_AMBI_COEFFS]; struct BFChannelConfig { ALfloat Scale; ALsizei Index; }; -typedef union AmbiConfig { +union AmbiConfig { /* Ambisonic coefficients for mixing to the dry buffer. */ ChannelConfig Coeffs[MAX_OUTPUT_CHANNELS]; /* Coefficient channel mapping for mixing to the dry buffer. */ BFChannelConfig Map[MAX_OUTPUT_CHANNELS]; -} AmbiConfig; +}; struct BufferSubList { uint64_t FreeMask{~uint64_t{}}; - struct ALbuffer *Buffers{nullptr}; /* 64 */ + ALbuffer *Buffers{nullptr}; /* 64 */ BufferSubList() noexcept = default; BufferSubList(const BufferSubList&) = delete; @@ -568,7 +568,7 @@ struct BufferSubList { struct EffectSubList { uint64_t FreeMask{~uint64_t{}}; - struct ALeffect *Effects{nullptr}; /* 64 */ + ALeffect *Effects{nullptr}; /* 64 */ EffectSubList() noexcept = default; EffectSubList(const EffectSubList&) = delete; @@ -583,7 +583,7 @@ struct EffectSubList { struct FilterSubList { uint64_t FreeMask{~uint64_t{}}; - struct ALfilter *Filters{nullptr}; /* 64 */ + ALfilter *Filters{nullptr}; /* 64 */ FilterSubList() noexcept = default; FilterSubList(const FilterSubList&) = delete; @@ -597,11 +597,11 @@ struct FilterSubList { }; -typedef struct EnumeratedHrtf { +struct EnumeratedHrtf { std::string name; HrtfHandle *hrtf; -} EnumeratedHrtf; +}; /* Maximum delay in samples for speaker distance compensation. */ @@ -654,7 +654,7 @@ public: */ #define BUFFERSIZE 2048 -typedef struct MixParams { +struct MixParams { AmbiConfig Ambi{}; /* Number of coefficients in each Ambi.Coeffs to mix together (4 for first- * order, 9 for second-order, etc). If the count is 0, Ambi.Map is used @@ -664,16 +664,16 @@ typedef struct MixParams { ALfloat (*Buffer)[BUFFERSIZE]{nullptr}; ALsizei NumChannels{0}; -} MixParams; +}; -typedef struct RealMixParams { - enum Channel ChannelName[MAX_OUTPUT_CHANNELS]{}; +struct RealMixParams { + Channel ChannelName[MAX_OUTPUT_CHANNELS]{}; ALfloat (*Buffer)[BUFFERSIZE]{nullptr}; ALsizei NumChannels{0}; -} RealMixParams; +}; -typedef void (*POSTPROCESS)(ALCdevice *device, ALsizei SamplesToDo); +using POSTPROCESS = void(*)(ALCdevice *device, ALsizei SamplesToDo); struct ALCdevice_struct { RefCount ref{1u}; @@ -729,7 +729,7 @@ struct ALCdevice_struct { std::mutex FilterLock; /* Rendering mode. */ - RenderMode Render_Mode{NormalRender}; + RenderMode mRenderMode{NormalRender}; /* The average speaker distance as determined by the ambdec configuration * (or alternatively, by the NFC-HOA reference delay). Only used for NFC. diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h index 62c6fae3..381e0a9b 100644 --- a/OpenAL32/Include/alSource.h +++ b/OpenAL32/Include/alSource.h @@ -9,23 +9,20 @@ #define DEFAULT_SENDS 2 -#ifdef __cplusplus -extern "C" { -#endif - struct ALbuffer; struct ALsource; +struct ALeffectslot; -typedef struct ALbufferlistitem { +struct ALbufferlistitem { std::atomic<ALbufferlistitem*> next; ALsizei max_samples; ALsizei num_buffers; - struct ALbuffer *buffers[]; -} ALbufferlistitem; + ALbuffer *buffers[]; +}; -typedef struct ALsource { +struct ALsource { /** Source properties. */ ALfloat Pitch; ALfloat Gain; @@ -44,9 +41,9 @@ typedef struct ALsource { ALboolean HeadRelative; ALboolean Looping; DistanceModel mDistanceModel; - enum Resampler Resampler; + Resampler mResampler; ALboolean DirectChannels; - enum SpatializeMode Spatialize; + SpatializeMode mSpatialize; ALboolean DryGainHFAuto; ALboolean WetGainAuto; @@ -73,7 +70,7 @@ typedef struct ALsource { ALfloat LFReference; } Direct; struct SendData { - struct ALeffectslot *Slot; + ALeffectslot *Slot; ALfloat Gain; ALfloat GainHF; ALfloat HFReference; @@ -114,12 +111,8 @@ typedef struct ALsource { ALsource(const ALsource&) = delete; ALsource& operator=(const ALsource&) = delete; -} ALsource; +}; void UpdateAllSourceProps(ALCcontext *context); -#ifdef __cplusplus -} -#endif - #endif diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 695fc380..78733d8d 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -59,7 +59,7 @@ enum Resampler { ResamplerMax = BSinc24Resampler }; -extern enum Resampler ResamplerDefault; +extern Resampler ResamplerDefault; /* The number of distinct scale and phase intervals within the bsinc filter * table. @@ -73,7 +73,7 @@ extern enum Resampler ResamplerDefault; * stateless. This just keeps it from having to recompute scale-related * mappings for every sample. */ -typedef struct BsincState { +struct BsincState { ALfloat sf; /* Scale interpolation factor. */ ALsizei m; /* Coefficient count. */ ALsizei l; /* Left coefficient offset. */ @@ -82,18 +82,17 @@ typedef struct BsincState { * index follows contiguously. */ const ALfloat *filter; -} BsincState; +}; -typedef union InterpState { +union InterpState { BsincState bsinc; -} InterpState; +}; -typedef const ALfloat* (*ResamplerFunc)(const InterpState *state, +using ResamplerFunc = const ALfloat*(*)(const InterpState *state, const ALfloat *RESTRICT src, ALsizei frac, ALint increment, - ALfloat *RESTRICT dst, ALsizei dstlen -); + ALfloat *RESTRICT dst, ALsizei dstlen); -void BsincPrepare(const ALuint increment, BsincState *state, const struct BSincTable *table); +void BsincPrepare(const ALuint increment, BsincState *state, const BSincTable *table); extern const BSincTable bsinc12; extern const BSincTable bsinc24; @@ -161,9 +160,9 @@ struct ALvoicePropsBase { ALfloat Orientation[2][3]; ALboolean HeadRelative; DistanceModel mDistanceModel; - enum Resampler Resampler; + Resampler mResampler; ALboolean DirectChannels; - enum SpatializeMode SpatializeMode; + SpatializeMode mSpatializeMode; ALboolean DryGainHFAuto; ALboolean WetGainAuto; @@ -187,7 +186,7 @@ struct ALvoicePropsBase { ALfloat LFReference; } Direct; struct SendData { - struct ALeffectslot *Slot; + ALeffectslot *Slot; ALfloat Gain; ALfloat GainHF; ALfloat HFReference; @@ -272,26 +271,22 @@ struct ALvoice { void DeinitVoice(ALvoice *voice) noexcept; -typedef void (*MixerFunc)(const ALfloat *data, ALsizei OutChans, - ALfloat (*RESTRICT OutBuffer)[BUFFERSIZE], ALfloat *CurrentGains, - const ALfloat *TargetGains, ALsizei Counter, ALsizei OutPos, - ALsizei BufferSize); -typedef void (*RowMixerFunc)(ALfloat *OutBuffer, const ALfloat *gains, - const ALfloat (*RESTRICT data)[BUFFERSIZE], ALsizei InChans, - ALsizei InPos, ALsizei BufferSize); -typedef void (*HrtfMixerFunc)(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, - const ALfloat *data, ALsizei Offset, ALsizei OutPos, - const ALsizei IrSize, MixHrtfParams *hrtfparams, - HrtfState *hrtfstate, ALsizei BufferSize); -typedef void (*HrtfMixerBlendFunc)(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, - const ALfloat *data, ALsizei Offset, ALsizei OutPos, - const ALsizei IrSize, const HrtfParams *oldparams, - MixHrtfParams *newparams, HrtfState *hrtfstate, - ALsizei BufferSize); -typedef void (*HrtfDirectMixerFunc)(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, - const ALfloat *data, ALsizei Offset, const ALsizei IrSize, - const ALfloat (*RESTRICT Coeffs)[2], - ALfloat (*RESTRICT Values)[2], ALsizei BufferSize); +using MixerFunc = void(*)(const ALfloat *data, ALsizei OutChans, + ALfloat (*RESTRICT OutBuffer)[BUFFERSIZE], ALfloat *CurrentGains, + const ALfloat *TargetGains, ALsizei Counter, ALsizei OutPos, ALsizei BufferSize); +using RowMixerFunc = void(*)(ALfloat *OutBuffer, const ALfloat *gains, + const ALfloat (*RESTRICT data)[BUFFERSIZE], ALsizei InChans, ALsizei InPos, + ALsizei BufferSize); +using HrtfMixerFunc = void(*)(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, + const ALfloat *data, ALsizei Offset, ALsizei OutPos, const ALsizei IrSize, + MixHrtfParams *hrtfparams, HrtfState *hrtfstate, ALsizei BufferSize); +using HrtfMixerBlendFunc = void(*)(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, + const ALfloat *data, ALsizei Offset, ALsizei OutPos, const ALsizei IrSize, + const HrtfParams *oldparams, MixHrtfParams *newparams, HrtfState *hrtfstate, + ALsizei BufferSize); +using HrtfDirectMixerFunc = void(*)(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, + const ALfloat *data, ALsizei Offset, const ALsizei IrSize, const ALfloat (*RESTRICT Coeffs)[2], + ALfloat (*RESTRICT Values)[2], ALsizei BufferSize); #define GAIN_MIX_MAX (1000.0f) /* +60dB */ @@ -479,7 +474,7 @@ inline void ComputePanGains(const MixParams *dry, const ALfloat*RESTRICT coeffs, void ComputePanGains(const ALeffectslot *slot, const ALfloat*RESTRICT coeffs, ALfloat ingain, ALfloat (&gains)[MAX_OUTPUT_CHANNELS]); -ALboolean MixSource(struct ALvoice *voice, ALuint SourceID, ALCcontext *Context, ALsizei SamplesToDo); +ALboolean MixSource(ALvoice *voice, ALuint SourceID, ALCcontext *Context, ALsizei SamplesToDo); void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples); /* Caller must lock the device, and the mixer must not be running. */ diff --git a/OpenAL32/alAuxEffectSlot.cpp b/OpenAL32/alAuxEffectSlot.cpp index b91774dc..1b3b97be 100644 --- a/OpenAL32/alAuxEffectSlot.cpp +++ b/OpenAL32/alAuxEffectSlot.cpp @@ -631,7 +631,7 @@ ALeffectslot::~ALeffectslot() DecrementRef(&Target->ref); Target = nullptr; - struct ALeffectslotProps *props{Update.load()}; + ALeffectslotProps *props{Update.load()}; if(props) { if(props->State) props->State->DecRef(); @@ -653,7 +653,7 @@ void UpdateEffectSlotProps(ALeffectslot *slot, ALCcontext *context) props = static_cast<ALeffectslotProps*>(al_calloc(16, sizeof(*props))); else { - struct ALeffectslotProps *next; + ALeffectslotProps *next; do { next = props->next.load(std::memory_order_relaxed); } while(context->FreeEffectslotProps.compare_exchange_weak(props, next, diff --git a/OpenAL32/alBuffer.cpp b/OpenAL32/alBuffer.cpp index 6bc965c2..2f4b9d4d 100644 --- a/OpenAL32/alBuffer.cpp +++ b/OpenAL32/alBuffer.cpp @@ -241,7 +241,7 @@ void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALuint freq, ALsizei size, U if((access&AL_PRESERVE_DATA_BIT_SOFT)) { /* Can only preserve data with the same format and alignment. */ - if(UNLIKELY(ALBuf->FmtChannels != DstChannels || ALBuf->OriginalType != SrcType)) + if(UNLIKELY(ALBuf->mFmtChannels != DstChannels || ALBuf->OriginalType != SrcType)) SETERR_RETURN(context, AL_INVALID_VALUE,, "Preserving data of mismatched format"); if(UNLIKELY(ALBuf->OriginalAlign != align)) SETERR_RETURN(context, AL_INVALID_VALUE,, "Preserving data of mismatched alignment"); @@ -322,8 +322,8 @@ void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALuint freq, ALsizei size, U ALBuf->OriginalType = SrcType; ALBuf->Frequency = freq; - ALBuf->FmtChannels = DstChannels; - ALBuf->FmtType = DstType; + ALBuf->mFmtChannels = DstChannels; + ALBuf->mFmtType = DstType; ALBuf->Access = access; ALBuf->SampleLen = frames; @@ -683,7 +683,7 @@ AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer, ALenum format, cons ALsizei align{SanitizeAlignment(srctype, unpack_align)}; if(UNLIKELY(align < 1)) alSetError(context.get(), AL_INVALID_VALUE, "Invalid unpack alignment %d", unpack_align); - else if(UNLIKELY((long)srcchannels != (long)albuf->FmtChannels || + else if(UNLIKELY((long)srcchannels != (long)albuf->mFmtChannels || srctype != albuf->OriginalType)) alSetError(context.get(), AL_INVALID_ENUM, "Unpacking data with mismatched format"); else if(UNLIKELY(align != albuf->OriginalAlign)) @@ -695,8 +695,8 @@ AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer, ALenum format, cons buffer); else { - ALsizei num_chans{ChannelsFromFmt(albuf->FmtChannels)}; - ALsizei frame_size{num_chans * BytesFromFmt(albuf->FmtType)}; + ALsizei num_chans{ChannelsFromFmt(albuf->mFmtChannels)}; + ALsizei frame_size{num_chans * BytesFromFmt(albuf->mFmtType)}; ALsizei byte_align{ (albuf->OriginalType == UserFmtIMA4) ? ((align-1)/2 + 4) * num_chans : (albuf->OriginalType == UserFmtMSADPCM) ? ((align-2)/2 + 7) * num_chans : @@ -722,15 +722,15 @@ AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer, ALenum format, cons length = length/byte_align * align; void *dst = albuf->mData.data() + offset; - if(srctype == UserFmtIMA4 && albuf->FmtType == FmtShort) + if(srctype == UserFmtIMA4 && albuf->mFmtType == FmtShort) Convert_ALshort_ALima4(static_cast<ALshort*>(dst), static_cast<const ALubyte*>(data), num_chans, length, align); - else if(srctype == UserFmtMSADPCM && albuf->FmtType == FmtShort) + else if(srctype == UserFmtMSADPCM && albuf->mFmtType == FmtShort) Convert_ALshort_ALmsadpcm(static_cast<ALshort*>(dst), static_cast<const ALubyte*>(data), num_chans, length, align); else { - assert((long)srctype == (long)albuf->FmtType); + assert((long)srctype == (long)albuf->mFmtType); memcpy(dst, data, length*frame_size); } } @@ -1019,16 +1019,15 @@ AL_API ALvoid AL_APIENTRY alGetBufferi(ALuint buffer, ALenum param, ALint *value break; case AL_BITS: - *value = BytesFromFmt(albuf->FmtType) * 8; + *value = BytesFromFmt(albuf->mFmtType) * 8; break; case AL_CHANNELS: - *value = ChannelsFromFmt(albuf->FmtChannels); + *value = ChannelsFromFmt(albuf->mFmtChannels); break; case AL_SIZE: - *value = albuf->SampleLen * FrameSizeFromFmt(albuf->FmtChannels, - albuf->FmtType); + *value = albuf->SampleLen * FrameSizeFromFmt(albuf->mFmtChannels, albuf->mFmtType); break; case AL_UNPACK_BLOCK_ALIGNMENT_SOFT: diff --git a/OpenAL32/alEffect.cpp b/OpenAL32/alEffect.cpp index dd16acfb..6a91c852 100644 --- a/OpenAL32/alEffect.cpp +++ b/OpenAL32/alEffect.cpp @@ -35,7 +35,7 @@ #include "alError.h" -const struct EffectList EffectList[EFFECTLIST_SIZE] = { +const EffectList gEffectList[14]{ { "eaxreverb", EAXREVERB_EFFECT, AL_EFFECT_EAXREVERB }, { "reverb", REVERB_EFFECT, AL_EFFECT_REVERB }, { "autowah", AUTOWAH_EFFECT, AL_EFFECT_AUTOWAH }, @@ -397,9 +397,9 @@ AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint value) if(param == AL_EFFECT_TYPE) { ALboolean isOk = (value == AL_EFFECT_NULL); - for(ALsizei i{0};!isOk && i < EFFECTLIST_SIZE;i++) + for(size_t i{0u};!isOk && i < countof(gEffectList);i++) { - if(value == EffectList[i].val && !DisabledEffects[EffectList[i].type]) + if(value == gEffectList[i].val && !DisabledEffects[gEffectList[i].type]) isOk = AL_TRUE; } diff --git a/OpenAL32/alListener.cpp b/OpenAL32/alListener.cpp index c86c8374..b7fdf9ce 100644 --- a/OpenAL32/alListener.cpp +++ b/OpenAL32/alListener.cpp @@ -405,7 +405,7 @@ void UpdateListenerProps(ALCcontext *context) props = static_cast<ALlistenerProps*>(al_calloc(16, sizeof(*props))); else { - struct ALlistenerProps *next; + ALlistenerProps *next; do { next = props->next.load(std::memory_order_relaxed); } while(context->FreeListenerProps.compare_exchange_weak(props, next, diff --git a/OpenAL32/alSource.cpp b/OpenAL32/alSource.cpp index 53aa9389..e88df598 100644 --- a/OpenAL32/alSource.cpp +++ b/OpenAL32/alSource.cpp @@ -96,9 +96,9 @@ void UpdateSourceProps(ALsource *source, ALvoice *voice, ALCcontext *context) std::copy(std::begin(source->Orientation[1]), std::end(source->Orientation[1]), props->Orientation[1]); props->HeadRelative = source->HeadRelative; props->mDistanceModel = source->mDistanceModel; - props->Resampler = source->Resampler; + props->mResampler = source->mResampler; props->DirectChannels = source->DirectChannels; - props->SpatializeMode = source->Spatialize; + props->mSpatializeMode = source->mSpatialize; props->DryGainHFAuto = source->DryGainHFAuto; props->WetGainAuto = source->WetGainAuto; @@ -323,7 +323,7 @@ ALdouble GetSourceOffset(ALsource *Source, ALenum name, ALCcontext *context) if(BufferFmt->OriginalType == UserFmtIMA4) { ALsizei align = (BufferFmt->OriginalAlign-1)/2 + 4; - ALuint BlockSize = align * ChannelsFromFmt(BufferFmt->FmtChannels); + ALuint BlockSize = align * ChannelsFromFmt(BufferFmt->mFmtChannels); ALuint FrameBlockSize = BufferFmt->OriginalAlign; /* Round down to nearest ADPCM block */ @@ -332,7 +332,7 @@ ALdouble GetSourceOffset(ALsource *Source, ALenum name, ALCcontext *context) else if(BufferFmt->OriginalType == UserFmtMSADPCM) { ALsizei align = (BufferFmt->OriginalAlign-2)/2 + 7; - ALuint BlockSize = align * ChannelsFromFmt(BufferFmt->FmtChannels); + ALuint BlockSize = align * ChannelsFromFmt(BufferFmt->mFmtChannels); ALuint FrameBlockSize = BufferFmt->OriginalAlign; /* Round down to nearest ADPCM block */ @@ -340,8 +340,8 @@ ALdouble GetSourceOffset(ALsource *Source, ALenum name, ALCcontext *context) } else { - ALuint FrameSize = FrameSizeFromFmt(BufferFmt->FmtChannels, - BufferFmt->FmtType); + const ALsizei FrameSize{FrameSizeFromFmt(BufferFmt->mFmtChannels, + BufferFmt->mFmtType)}; offset = (ALdouble)(readPos * FrameSize); } break; @@ -388,17 +388,17 @@ ALboolean GetSampleOffset(ALsource *Source, ALuint *offset, ALsizei *frac) if(BufferFmt->OriginalType == UserFmtIMA4) { ALsizei align = (BufferFmt->OriginalAlign-1)/2 + 4; - *offset /= align * ChannelsFromFmt(BufferFmt->FmtChannels); + *offset /= align * ChannelsFromFmt(BufferFmt->mFmtChannels); *offset *= BufferFmt->OriginalAlign; } else if(BufferFmt->OriginalType == UserFmtMSADPCM) { ALsizei align = (BufferFmt->OriginalAlign-2)/2 + 7; - *offset /= align * ChannelsFromFmt(BufferFmt->FmtChannels); + *offset /= align * ChannelsFromFmt(BufferFmt->mFmtChannels); *offset *= BufferFmt->OriginalAlign; } else - *offset /= FrameSizeFromFmt(BufferFmt->FmtChannels, BufferFmt->FmtType); + *offset /= FrameSizeFromFmt(BufferFmt->mFmtChannels, BufferFmt->mFmtType); *frac = 0; break; @@ -1398,14 +1398,14 @@ ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, co case AL_SOURCE_RESAMPLER_SOFT: CHECKVAL(*values >= 0 && *values <= ResamplerMax); - Source->Resampler = static_cast<enum Resampler>(*values); + Source->mResampler = static_cast<Resampler>(*values); DO_UPDATEPROPS(); return AL_TRUE; case AL_SOURCE_SPATIALIZE_SOFT: CHECKVAL(*values >= AL_FALSE && *values <= AL_AUTO_SOFT); - Source->Spatialize = static_cast<enum SpatializeMode>(*values); + Source->mSpatialize = static_cast<SpatializeMode>(*values); DO_UPDATEPROPS(); return AL_TRUE; @@ -1889,11 +1889,11 @@ ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, AL return AL_TRUE; case AL_SOURCE_RESAMPLER_SOFT: - *values = Source->Resampler; + *values = Source->mResampler; return AL_TRUE; case AL_SOURCE_SPATIALIZE_SOFT: - *values = Source->Spatialize; + *values = Source->mSpatialize; return AL_TRUE; /* 1x float/double */ @@ -2814,8 +2814,8 @@ AL_API ALvoid AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources) ); if(buffer != buffers_end) { - voice->NumChannels = ChannelsFromFmt((*buffer)->FmtChannels); - voice->SampleSize = BytesFromFmt((*buffer)->FmtType); + voice->NumChannels = ChannelsFromFmt((*buffer)->mFmtChannels); + voice->SampleSize = BytesFromFmt((*buffer)->mFmtType); } /* Clear previous samples. */ @@ -3058,7 +3058,7 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint src, ALsizei nb, const ALu if(BufferFmt == nullptr) BufferFmt = buffer; else if(BufferFmt->Frequency != buffer->Frequency || - BufferFmt->FmtChannels != buffer->FmtChannels || + BufferFmt->mFmtChannels != buffer->mFmtChannels || BufferFmt->OriginalType != buffer->OriginalType) { alSetError(context.get(), AL_INVALID_OPERATION, @@ -3166,7 +3166,7 @@ AL_API void AL_APIENTRY alSourceQueueBufferLayersSOFT(ALuint src, ALsizei nb, co if(BufferFmt == nullptr) BufferFmt = buffer; else if(BufferFmt->Frequency != buffer->Frequency || - BufferFmt->FmtChannels != buffer->FmtChannels || + BufferFmt->mFmtChannels != buffer->mFmtChannels || BufferFmt->OriginalType != buffer->OriginalType) { alSetError(context.get(), AL_INVALID_OPERATION, @@ -3331,9 +3331,9 @@ ALsource::ALsource(ALsizei num_sends) HeadRelative = AL_FALSE; Looping = AL_FALSE; mDistanceModel = DistanceModel::Default; - Resampler = ResamplerDefault; + mResampler = ResamplerDefault; DirectChannels = AL_FALSE; - Spatialize = SpatializeAuto; + mSpatialize = SpatializeAuto; StereoPan[0] = Deg2Rad( 30.0f); StereoPan[1] = Deg2Rad(-30.0f); diff --git a/OpenAL32/alState.cpp b/OpenAL32/alState.cpp index 37bddea3..3f55687d 100644 --- a/OpenAL32/alState.cpp +++ b/OpenAL32/alState.cpp @@ -766,12 +766,12 @@ AL_API const ALchar* AL_APIENTRY alGetStringiSOFT(ALenum pname, ALsizei index) void UpdateContextProps(ALCcontext *context) { /* Get an unused proprty container, or allocate a new one as needed. */ - struct ALcontextProps *props{context->FreeContextProps.load(std::memory_order_acquire)}; + ALcontextProps *props{context->FreeContextProps.load(std::memory_order_acquire)}; if(!props) props = static_cast<ALcontextProps*>(al_calloc(16, sizeof(*props))); else { - struct ALcontextProps *next; + ALcontextProps *next; do { next = props->next.load(std::memory_order_relaxed); } while(context->FreeContextProps.compare_exchange_weak(props, next, |