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/Include | |
parent | 194e7ff815d744830c8aaedfb0d32ed3c3d01645 (diff) |
Remove extraneous typedef, struct, and enum keywords
Diffstat (limited to 'OpenAL32/Include')
-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 |
7 files changed, 88 insertions, 108 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. */ |