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 | |
parent | 194e7ff815d744830c8aaedfb0d32ed3c3d01645 (diff) |
Remove extraneous typedef, struct, and enum keywords
56 files changed, 242 insertions, 275 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp index bde9aa79..b6065e97 100644 --- a/Alc/alc.cpp +++ b/Alc/alc.cpp @@ -1148,11 +1148,11 @@ static void alc_initconfig(void) continue; size_t len{next ? (size_t)(next-str) : strlen(str)}; - for(n = 0;n < EFFECTLIST_SIZE;n++) + for(size_t n{0u};n < countof(gEffectList);n++) { - if(len == strlen(EffectList[n].name) && - strncmp(EffectList[n].name, str, len) == 0) - DisabledEffects[EffectList[n].type] = AL_TRUE; + if(len == strlen(gEffectList[n].name) && + strncmp(gEffectList[n].name, str, len) == 0) + DisabledEffects[gEffectList[n].type] = AL_TRUE; } } while(next++); } @@ -1168,7 +1168,7 @@ static void alc_initconfig(void) /************************************************ * Device enumeration ************************************************/ -static void ProbeDevices(std::string *list, BackendInfo *backendinfo, enum DevProbe type) +static void ProbeDevices(std::string *list, BackendInfo *backendinfo, DevProbe type) { DO_INITCONFIG(); @@ -1246,13 +1246,12 @@ ALsizei ChannelsFromDevFmt(DevFmtChannels chans, ALsizei ambiorder) noexcept return 0; } -static ALboolean DecomposeDevFormat(ALenum format, enum DevFmtChannels *chans, - enum DevFmtType *type) +static ALboolean DecomposeDevFormat(ALenum format, DevFmtChannels *chans, DevFmtType *type) { static const struct { ALenum format; - enum DevFmtChannels channels; - enum DevFmtType type; + DevFmtChannels channels; + DevFmtType type; } list[] = { { AL_FORMAT_MONO8, DevFmtMono, DevFmtUByte }, { AL_FORMAT_MONO16, DevFmtMono, DevFmtShort }, @@ -1585,13 +1584,13 @@ static inline void UpdateClockBase(ALCdevice *device) */ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) { - enum HrtfRequestMode hrtf_userreq = Hrtf_Default; - enum HrtfRequestMode hrtf_appreq = Hrtf_Default; + HrtfRequestMode hrtf_userreq = Hrtf_Default; + HrtfRequestMode hrtf_appreq = Hrtf_Default; ALCenum gainLimiter = device->LimiterState; const ALsizei old_sends = device->NumAuxSends; ALsizei new_sends = device->NumAuxSends; - enum DevFmtChannels oldChans; - enum DevFmtType oldType; + DevFmtChannels oldChans; + DevFmtType oldType; ALboolean update_failed; ALCsizei hrtf_id = -1; ALCcontext *context; @@ -1778,8 +1777,8 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) else { device->Frequency = freq; - device->FmtChans = static_cast<enum DevFmtChannels>(schans); - device->FmtType = static_cast<enum DevFmtType>(stype); + device->FmtChans = static_cast<DevFmtChannels>(schans); + device->FmtType = static_cast<DevFmtType>(stype); if(schans == ALC_BFORMAT3D_SOFT) { device->mAmbiOrder = aorder; @@ -3661,7 +3660,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) { static constexpr struct ChannelMap { const char name[16]; - enum DevFmtChannels chans; + DevFmtChannels chans; ALsizei order; } chanlist[] = { { "mono", DevFmtMono, 0 }, @@ -3693,7 +3692,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) { static constexpr struct TypeMap { const char name[16]; - enum DevFmtType type; + DevFmtType type; } typelist[] = { { "int8", DevFmtByte }, { "uint8", DevFmtUByte }, diff --git a/Alc/alu.cpp b/Alc/alu.cpp index b039f5af..01b4f3c3 100644 --- a/Alc/alu.cpp +++ b/Alc/alu.cpp @@ -100,7 +100,7 @@ void ClearArray(ALfloat (&f)[MAX_OUTPUT_CHANNELS]) } struct ChanMap { - enum Channel channel; + Channel channel; ALfloat angle; ALfloat elevation; }; @@ -454,7 +454,7 @@ bool CalcEffectSlotParams(ALeffectslot *slot, ALCcontext *context, bool force) } -constexpr struct ChanMap MonoMap[1]{ +constexpr ChanMap MonoMap[1]{ { FrontCenter, 0.0f, 0.0f } }, RearMap[2]{ { BackLeft, Deg2Rad(-150.0f), Deg2Rad(0.0f) }, @@ -509,7 +509,7 @@ void CalcPanningAndFilters(ALvoice *voice, const ALfloat Azi, const ALfloat Elev ALsizei num_channels{0}; bool isbformat{false}; ALfloat downmix_gain{1.0f}; - switch(Buffer->FmtChannels) + switch(Buffer->mFmtChannels) { case FmtMono: chans = MonoMap; @@ -633,7 +633,7 @@ void CalcPanningAndFilters(ALvoice *voice, const ALfloat Azi, const ALfloat Elev * responses. */ ALfloat coeffs[MAX_AMBI_COEFFS]; - CalcAngleCoeffs((Device->Render_Mode==StereoPair) ? ScaleAzimuthFront(Azi, 1.5f) : Azi, + CalcAngleCoeffs((Device->mRenderMode==StereoPair) ? ScaleAzimuthFront(Azi, 1.5f) : Azi, Elev, Spread, coeffs); /* NOTE: W needs to be scaled due to FuMa normalization. */ @@ -745,7 +745,7 @@ void CalcPanningAndFilters(ALvoice *voice, const ALfloat Azi, const ALfloat Elev } } } - else if(Device->Render_Mode == HrtfRender) + else if(Device->mRenderMode == HrtfRender) { /* Full HRTF rendering. Skip the virtual channels and render to the * real outputs. @@ -858,7 +858,7 @@ void CalcPanningAndFilters(ALvoice *voice, const ALfloat Azi, const ALfloat Elev * input channels. */ ALfloat coeffs[MAX_AMBI_COEFFS]; - CalcAngleCoeffs((Device->Render_Mode==StereoPair) ? ScaleAzimuthFront(Azi, 1.5f) : Azi, + CalcAngleCoeffs((Device->mRenderMode==StereoPair) ? ScaleAzimuthFront(Azi, 1.5f) : Azi, Elev, Spread, coeffs); for(ALsizei c{0};c < num_channels;c++) @@ -927,7 +927,7 @@ void CalcPanningAndFilters(ALvoice *voice, const ALfloat Azi, const ALfloat Elev ALfloat coeffs[MAX_AMBI_COEFFS]; CalcAngleCoeffs( - (Device->Render_Mode==StereoPair) ? ScaleAzimuthFront(chans[c].angle, 3.0f) + (Device->mRenderMode==StereoPair) ? ScaleAzimuthFront(chans[c].angle, 3.0f) : chans[c].angle, chans[c].elevation, Spread, coeffs ); @@ -1023,11 +1023,11 @@ void CalcNonAttnSourceParams(ALvoice *voice, const ALvoicePropsBase *props, cons voice->Step = MAX_PITCH<<FRACTIONBITS; else voice->Step = maxi(fastf2i(Pitch * FRACTIONONE), 1); - if(props->Resampler == BSinc24Resampler) + if(props->mResampler == BSinc24Resampler) BsincPrepare(voice->Step, &voice->ResampleState.bsinc, &bsinc24); - else if(props->Resampler == BSinc12Resampler) + else if(props->mResampler == BSinc12Resampler) BsincPrepare(voice->Step, &voice->ResampleState.bsinc, &bsinc12); - voice->Resampler = SelectResampler(props->Resampler); + voice->Resampler = SelectResampler(props->mResampler); /* Calculate gains */ const ALlistener &Listener = ALContext->Listener; @@ -1361,11 +1361,11 @@ void CalcAttnSourceParams(ALvoice *voice, const ALvoicePropsBase *props, const A voice->Step = MAX_PITCH<<FRACTIONBITS; else voice->Step = maxi(fastf2i(Pitch * FRACTIONONE), 1); - if(props->Resampler == BSinc24Resampler) + if(props->mResampler == BSinc24Resampler) BsincPrepare(voice->Step, &voice->ResampleState.bsinc, &bsinc24); - else if(props->Resampler == BSinc12Resampler) + else if(props->mResampler == BSinc12Resampler) BsincPrepare(voice->Step, &voice->ResampleState.bsinc, &bsinc12); - voice->Resampler = SelectResampler(props->Resampler); + voice->Resampler = SelectResampler(props->mResampler); ALfloat ev{0.0f}, az{0.0f}; if(Distance > 0.0f) @@ -1413,8 +1413,8 @@ void CalcSourceParams(ALvoice *voice, ALCcontext *context, bool force) ); if(LIKELY(buffer != buffers_end)) { - if(voice->Props.SpatializeMode==SpatializeOn || - (voice->Props.SpatializeMode==SpatializeAuto && (*buffer)->FmtChannels==FmtMono)) + if(voice->Props.mSpatializeMode==SpatializeOn || + (voice->Props.mSpatializeMode==SpatializeAuto && (*buffer)->mFmtChannels==FmtMono)) CalcAttnSourceParams(voice, &voice->Props, *buffer, context); else CalcNonAttnSourceParams(voice, &voice->Props, *buffer, context); diff --git a/Alc/backends/alsa.cpp b/Alc/backends/alsa.cpp index 228cafe0..cf3f7fff 100644 --- a/Alc/backends/alsa.cpp +++ b/Alc/backends/alsa.cpp @@ -742,7 +742,7 @@ ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self) { static const struct { snd_pcm_format_t format; - enum DevFmtType fmttype; + DevFmtType fmttype; } formatlist[] = { { SND_PCM_FORMAT_FLOAT, DevFmtFloat }, { SND_PCM_FORMAT_S32, DevFmtInt }, @@ -767,7 +767,7 @@ ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self) /* test and set channels (implicitly sets frame bits) */ if(snd_pcm_hw_params_test_channels(self->PcmHandle, hp, device->channelsFromFmt()) < 0) { - static const enum DevFmtChannels channellist[] = { + static const DevFmtChannels channellist[] = { DevFmtStereo, DevFmtQuad, DevFmtX51, @@ -1308,7 +1308,7 @@ void AlsaBackendFactory::deinit() bool AlsaBackendFactory::querySupport(ALCbackend_Type type) { return (type == ALCbackend_Playback || type == ALCbackend_Capture); } -void AlsaBackendFactory::probe(enum DevProbe type, std::string *outnames) +void AlsaBackendFactory::probe(DevProbe type, std::string *outnames) { auto add_device = [outnames](const DevMap &entry) -> void { diff --git a/Alc/backends/alsa.h b/Alc/backends/alsa.h index 3f772115..8ee78f56 100644 --- a/Alc/backends/alsa.h +++ b/Alc/backends/alsa.h @@ -10,7 +10,7 @@ public: bool querySupport(ALCbackend_Type type) override; - void probe(enum DevProbe type, std::string *outnames) override; + void probe(DevProbe type, std::string *outnames) override; ALCbackend *createBackend(ALCdevice *device, ALCbackend_Type type) override; diff --git a/Alc/backends/base.h b/Alc/backends/base.h index f4de5176..f7be5cd0 100644 --- a/Alc/backends/base.h +++ b/Alc/backends/base.h @@ -34,7 +34,7 @@ ClockLatency GetClockLatency(ALCdevice *device); struct ALCbackendVtable; struct ALCbackend { - const struct ALCbackendVtable *vtbl; + const ALCbackendVtable *vtbl; ALCdevice *mDevice; @@ -84,7 +84,7 @@ DECLARE_THUNK(T, ALCbackend, void, unlock) \ static void T##_ALCbackend_Delete(void *ptr) \ { T##_Delete(STATIC_UPCAST(T, ALCbackend, (ALCbackend*)ptr)); } \ \ -static const struct ALCbackendVtable T##_ALCbackend_vtable = { \ +static const ALCbackendVtable T##_ALCbackend_vtable = { \ T##_ALCbackend_Destruct, \ \ T##_ALCbackend_open, \ @@ -114,7 +114,7 @@ struct BackendFactory { virtual bool querySupport(ALCbackend_Type type) = 0; - virtual void probe(enum DevProbe type, std::string *outnames) = 0; + virtual void probe(DevProbe type, std::string *outnames) = 0; virtual ALCbackend *createBackend(ALCdevice *device, ALCbackend_Type type) = 0; }; diff --git a/Alc/backends/coreaudio.cpp b/Alc/backends/coreaudio.cpp index aaaf6221..c73a67f9 100644 --- a/Alc/backends/coreaudio.cpp +++ b/Alc/backends/coreaudio.cpp @@ -754,7 +754,7 @@ bool CoreAudioBackendFactory::init() { return true; } bool CoreAudioBackendFactory::querySupport(ALCbackend_Type type) { return (type == ALCbackend_Playback || ALCbackend_Capture); } -void CoreAudioBackendFactory::probe(enum DevProbe type, std::string *outnames) +void CoreAudioBackendFactory::probe(DevProbe type, std::string *outnames) { switch(type) { diff --git a/Alc/backends/coreaudio.h b/Alc/backends/coreaudio.h index 2926ee12..bc9c492c 100644 --- a/Alc/backends/coreaudio.h +++ b/Alc/backends/coreaudio.h @@ -10,7 +10,7 @@ public: bool querySupport(ALCbackend_Type type) override; - void probe(enum DevProbe type, std::string *outnames) override; + void probe(DevProbe type, std::string *outnames) override; ALCbackend *createBackend(ALCdevice *device, ALCbackend_Type type) override; diff --git a/Alc/backends/dsound.cpp b/Alc/backends/dsound.cpp index 26e561bf..4ada7419 100644 --- a/Alc/backends/dsound.cpp +++ b/Alc/backends/dsound.cpp @@ -45,7 +45,7 @@ #include "compat.h" /* MinGW-w64 needs this for some unknown reason now. */ -typedef const WAVEFORMATEX *LPCWAVEFORMATEX; +using LPCWAVEFORMATEX = const WAVEFORMATEX*; #include <dsound.h> @@ -960,7 +960,7 @@ void DSoundBackendFactory::deinit() bool DSoundBackendFactory::querySupport(ALCbackend_Type type) { return (type == ALCbackend_Playback || type == ALCbackend_Capture); } -void DSoundBackendFactory::probe(enum DevProbe type, std::string *outnames) +void DSoundBackendFactory::probe(DevProbe type, std::string *outnames) { auto add_device = [outnames](const DevMap &entry) -> void { diff --git a/Alc/backends/dsound.h b/Alc/backends/dsound.h index ebaa9c64..3911686e 100644 --- a/Alc/backends/dsound.h +++ b/Alc/backends/dsound.h @@ -10,7 +10,7 @@ public: bool querySupport(ALCbackend_Type type) override; - void probe(enum DevProbe type, std::string *outnames) override; + void probe(DevProbe type, std::string *outnames) override; ALCbackend *createBackend(ALCdevice *device, ALCbackend_Type type) override; diff --git a/Alc/backends/jack.cpp b/Alc/backends/jack.cpp index 88f60c93..c768983d 100644 --- a/Alc/backends/jack.cpp +++ b/Alc/backends/jack.cpp @@ -559,7 +559,7 @@ void JackBackendFactory::deinit() bool JackBackendFactory::querySupport(ALCbackend_Type type) { return (type == ALCbackend_Playback); } -void JackBackendFactory::probe(enum DevProbe type, std::string *outnames) +void JackBackendFactory::probe(DevProbe type, std::string *outnames) { switch(type) { diff --git a/Alc/backends/jack.h b/Alc/backends/jack.h index 8a6e3a22..bdf73701 100644 --- a/Alc/backends/jack.h +++ b/Alc/backends/jack.h @@ -10,7 +10,7 @@ public: bool querySupport(ALCbackend_Type type) override; - void probe(enum DevProbe type, std::string *outnames) override; + void probe(DevProbe type, std::string *outnames) override; ALCbackend *createBackend(ALCdevice *device, ALCbackend_Type type) override; diff --git a/Alc/backends/loopback.cpp b/Alc/backends/loopback.cpp index 5a6e14b5..65c87971 100644 --- a/Alc/backends/loopback.cpp +++ b/Alc/backends/loopback.cpp @@ -92,7 +92,7 @@ bool LoopbackBackendFactory::init() bool LoopbackBackendFactory::querySupport(ALCbackend_Type type) { return (type == ALCbackend_Loopback); } -void LoopbackBackendFactory::probe(enum DevProbe, std::string*) +void LoopbackBackendFactory::probe(DevProbe, std::string*) { } ALCbackend *LoopbackBackendFactory::createBackend(ALCdevice *device, ALCbackend_Type type) diff --git a/Alc/backends/loopback.h b/Alc/backends/loopback.h index 68f33a5c..4607d6ed 100644 --- a/Alc/backends/loopback.h +++ b/Alc/backends/loopback.h @@ -10,7 +10,7 @@ public: bool querySupport(ALCbackend_Type type) override; - void probe(enum DevProbe type, std::string *outnames) override; + void probe(DevProbe type, std::string *outnames) override; ALCbackend *createBackend(ALCdevice *device, ALCbackend_Type type) override; diff --git a/Alc/backends/null.cpp b/Alc/backends/null.cpp index 969193b8..fb113077 100644 --- a/Alc/backends/null.cpp +++ b/Alc/backends/null.cpp @@ -180,7 +180,7 @@ bool NullBackendFactory::init() bool NullBackendFactory::querySupport(ALCbackend_Type type) { return (type == ALCbackend_Playback); } -void NullBackendFactory::probe(enum DevProbe type, std::string *outnames) +void NullBackendFactory::probe(DevProbe type, std::string *outnames) { switch(type) { diff --git a/Alc/backends/null.h b/Alc/backends/null.h index e2adfc33..37457d94 100644 --- a/Alc/backends/null.h +++ b/Alc/backends/null.h @@ -10,7 +10,7 @@ public: bool querySupport(ALCbackend_Type type) override; - void probe(enum DevProbe type, std::string *outnames) override; + void probe(DevProbe type, std::string *outnames) override; ALCbackend *createBackend(ALCdevice *device, ALCbackend_Type type) override; diff --git a/Alc/backends/opensl.cpp b/Alc/backends/opensl.cpp index ab829e05..9213919b 100644 --- a/Alc/backends/opensl.cpp +++ b/Alc/backends/opensl.cpp @@ -46,7 +46,7 @@ static const ALCchar opensl_device[] = "OpenSL"; -static SLuint32 GetChannelMask(enum DevFmtChannels chans) +static SLuint32 GetChannelMask(DevFmtChannels chans) { switch(chans) { @@ -75,7 +75,7 @@ static SLuint32 GetChannelMask(enum DevFmtChannels chans) } #ifdef SL_DATAFORMAT_PCM_EX -static SLuint32 GetTypeRepresentation(enum DevFmtType type) +static SLuint32 GetTypeRepresentation(DevFmtType type) { switch(type) { @@ -979,7 +979,7 @@ bool OSLBackendFactory::init() { return true; } bool OSLBackendFactory::querySupport(ALCbackend_Type type) { return (type == ALCbackend_Playback || type == ALCbackend_Capture); } -void OSLBackendFactory::probe(enum DevProbe type, std::string *outnames) +void OSLBackendFactory::probe(DevProbe type, std::string *outnames) { switch(type) { diff --git a/Alc/backends/opensl.h b/Alc/backends/opensl.h index 799d568f..31d0caae 100644 --- a/Alc/backends/opensl.h +++ b/Alc/backends/opensl.h @@ -10,7 +10,7 @@ public: bool querySupport(ALCbackend_Type type) override; - void probe(enum DevProbe type, std::string *outnames) override; + void probe(DevProbe type, std::string *outnames) override; ALCbackend *createBackend(ALCdevice *device, ALCbackend_Type type) override; diff --git a/Alc/backends/oss.cpp b/Alc/backends/oss.cpp index 4b1d468c..e338c40d 100644 --- a/Alc/backends/oss.cpp +++ b/Alc/backends/oss.cpp @@ -170,7 +170,7 @@ void ALCossListPopulate(al::vector<DevMap> *devlist, int type_flag) goto done; } - struct oss_sysinfo si; + oss_sysinfo si; if(ioctl(fd, SNDCTL_SYSINFO, &si) == -1) { TRACE("SNDCTL_SYSINFO failed: %s\n", strerror(errno)); @@ -179,7 +179,7 @@ void ALCossListPopulate(al::vector<DevMap> *devlist, int type_flag) for(int i{0};i < si.numaudios;i++) { - struct oss_audioinfo ai; + oss_audioinfo ai; ai.dev = i; if(ioctl(fd, SNDCTL_AUDIOINFO, &ai) == -1) { @@ -759,7 +759,7 @@ void OSSBackendFactory::deinit() bool OSSBackendFactory::querySupport(ALCbackend_Type type) { return (type == ALCbackend_Playback || type == ALCbackend_Capture); } -void OSSBackendFactory::probe(enum DevProbe type, std::string *outnames) +void OSSBackendFactory::probe(DevProbe type, std::string *outnames) { auto add_device = [outnames](const DevMap &entry) -> void { diff --git a/Alc/backends/oss.h b/Alc/backends/oss.h index c3865d84..4652a779 100644 --- a/Alc/backends/oss.h +++ b/Alc/backends/oss.h @@ -10,7 +10,7 @@ public: bool querySupport(ALCbackend_Type type) override; - void probe(enum DevProbe type, std::string *outnames) override; + void probe(DevProbe type, std::string *outnames) override; ALCbackend *createBackend(ALCdevice *device, ALCbackend_Type type) override; diff --git a/Alc/backends/portaudio.cpp b/Alc/backends/portaudio.cpp index a89959b6..59b357b5 100644 --- a/Alc/backends/portaudio.cpp +++ b/Alc/backends/portaudio.cpp @@ -488,7 +488,7 @@ void PortBackendFactory::deinit() bool PortBackendFactory::querySupport(ALCbackend_Type type) { return (type == ALCbackend_Playback || type == ALCbackend_Capture); } -void PortBackendFactory::probe(enum DevProbe type, std::string *outnames) +void PortBackendFactory::probe(DevProbe type, std::string *outnames) { switch(type) { diff --git a/Alc/backends/portaudio.h b/Alc/backends/portaudio.h index 598cd13d..581d4901 100644 --- a/Alc/backends/portaudio.h +++ b/Alc/backends/portaudio.h @@ -10,7 +10,7 @@ public: bool querySupport(ALCbackend_Type type) override; - void probe(enum DevProbe type, std::string *outnames) override; + void probe(DevProbe type, std::string *outnames) override; ALCbackend *createBackend(ALCdevice *device, ALCbackend_Type type) override; diff --git a/Alc/backends/pulseaudio.cpp b/Alc/backends/pulseaudio.cpp index cbf2992d..8428b9d8 100644 --- a/Alc/backends/pulseaudio.cpp +++ b/Alc/backends/pulseaudio.cpp @@ -1791,7 +1791,7 @@ bool PulseBackendFactory::querySupport(ALCbackend_Type type) return false; } -void PulseBackendFactory::probe(enum DevProbe type, std::string *outnames) +void PulseBackendFactory::probe(DevProbe type, std::string *outnames) { auto add_device = [outnames](const DevMap &entry) -> void { diff --git a/Alc/backends/pulseaudio.h b/Alc/backends/pulseaudio.h index 63b5bbbb..eb7045dc 100644 --- a/Alc/backends/pulseaudio.h +++ b/Alc/backends/pulseaudio.h @@ -10,7 +10,7 @@ public: bool querySupport(ALCbackend_Type type) override; - void probe(enum DevProbe type, std::string *outnames) override; + void probe(DevProbe type, std::string *outnames) override; ALCbackend *createBackend(ALCdevice *device, ALCbackend_Type type) override; diff --git a/Alc/backends/qsa.cpp b/Alc/backends/qsa.cpp index f0d1876e..f14718c0 100644 --- a/Alc/backends/qsa.cpp +++ b/Alc/backends/qsa.cpp @@ -119,7 +119,7 @@ void deviceList(int type, al::vector<DevMap> *devmap) int max_cards, card, err, dev; DevMap entry; char name[1024]; - struct snd_ctl_hw_info info; + snd_ctl_hw_info info; max_cards = snd_cards(); if(max_cards < 0) @@ -195,7 +195,7 @@ FORCE_ALIGN static int qsa_proc_playback(void *ptr) ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; qsa_data *data = self->ExtraData; snd_pcm_channel_status_t status; - struct sched_param param; + sched_param param; char* write_ptr; ALint len; int sret; @@ -978,7 +978,7 @@ void QSABackendFactory::deinit() bool QSABackendFactory::querySupport(ALCbackend_Type type) { return (type == ALCbackend_Playback || type == ALCbackend_Capture); } -void QSABackendFactory::probe(enum DevProbe type, std::string *outnames) +void QSABackendFactory::probe(DevProbe type, std::string *outnames) { auto add_device = [outnames](const DevMap &entry) -> void { diff --git a/Alc/backends/qsa.h b/Alc/backends/qsa.h index c4941392..99d80106 100644 --- a/Alc/backends/qsa.h +++ b/Alc/backends/qsa.h @@ -10,7 +10,7 @@ public: bool querySupport(ALCbackend_Type type) override; - void probe(enum DevProbe type, std::string *outnames) override; + void probe(DevProbe type, std::string *outnames) override; ALCbackend *createBackend(ALCdevice *device, ALCbackend_Type type) override; diff --git a/Alc/backends/sdl2.cpp b/Alc/backends/sdl2.cpp index f0c98fab..d61e0a1b 100644 --- a/Alc/backends/sdl2.cpp +++ b/Alc/backends/sdl2.cpp @@ -44,8 +44,8 @@ struct ALCsdl2Backend final : public ALCbackend { ALsizei frameSize; ALuint Frequency; - enum DevFmtChannels FmtChans; - enum DevFmtType FmtType; + DevFmtChannels FmtChans; + DevFmtType FmtType; ALuint UpdateSize; }; @@ -233,7 +233,7 @@ bool SDL2BackendFactory::querySupport(ALCbackend_Type type) return (type == ALCbackend_Playback); } -void SDL2BackendFactory::probe(enum DevProbe type, std::string *outnames) +void SDL2BackendFactory::probe(DevProbe type, std::string *outnames) { if(type != ALL_DEVICE_PROBE) return; diff --git a/Alc/backends/sdl2.h b/Alc/backends/sdl2.h index 7f383447..7bf4d0e4 100644 --- a/Alc/backends/sdl2.h +++ b/Alc/backends/sdl2.h @@ -10,7 +10,7 @@ public: bool querySupport(ALCbackend_Type type) override; - void probe(enum DevProbe type, std::string *outnames) override; + void probe(DevProbe type, std::string *outnames) override; ALCbackend *createBackend(ALCdevice *device, ALCbackend_Type type) override; diff --git a/Alc/backends/sndio.cpp b/Alc/backends/sndio.cpp index 25566490..2be1d26c 100644 --- a/Alc/backends/sndio.cpp +++ b/Alc/backends/sndio.cpp @@ -40,7 +40,7 @@ static const ALCchar sndio_device[] = "SndIO Default"; struct SndioPlayback final : public ALCbackend { - struct sio_hdl *sndHandle{nullptr}; + sio_hdl *sndHandle{nullptr}; ALvoid *mix_data{nullptr}; ALsizei data_size{0}; @@ -152,7 +152,7 @@ static ALCenum SndioPlayback_open(SndioPlayback *self, const ALCchar *name) static ALCboolean SndioPlayback_reset(SndioPlayback *self) { ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; - struct sio_par par; + sio_par par; sio_initpar(&par); @@ -277,7 +277,7 @@ static void SndioPlayback_stop(SndioPlayback *self) struct SndioCapture final : public ALCbackend { - struct sio_hdl *sndHandle{nullptr}; + sio_hdl *sndHandle{nullptr}; RingBufferPtr ring{nullptr}; @@ -379,7 +379,7 @@ static int SndioCapture_recordProc(SndioCapture *self) static ALCenum SndioCapture_open(SndioCapture *self, const ALCchar *name) { ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; - struct sio_par par; + sio_par par; if(!name) name = sndio_device; @@ -536,7 +536,7 @@ bool SndIOBackendFactory::init() bool SndIOBackendFactory::querySupport(ALCbackend_Type type) { return (type == ALCbackend_Playback || type == ALCbackend_Capture); } -void SndIOBackendFactory::probe(enum DevProbe type, std::string *outnames) +void SndIOBackendFactory::probe(DevProbe type, std::string *outnames) { switch(type) { diff --git a/Alc/backends/sndio.h b/Alc/backends/sndio.h index 38cd2767..20e99afb 100644 --- a/Alc/backends/sndio.h +++ b/Alc/backends/sndio.h @@ -10,7 +10,7 @@ public: bool querySupport(ALCbackend_Type type) override; - void probe(enum DevProbe type, std::string *outnames) override; + void probe(DevProbe type, std::string *outnames) override; ALCbackend *createBackend(ALCdevice *device, ALCbackend_Type type) override; diff --git a/Alc/backends/solaris.cpp b/Alc/backends/solaris.cpp index 79341ad1..41026de8 100644 --- a/Alc/backends/solaris.cpp +++ b/Alc/backends/solaris.cpp @@ -301,7 +301,7 @@ bool SolarisBackendFactory::init() bool SolarisBackendFactory::querySupport(ALCbackend_Type type) { return (type == ALCbackend_Playback); } -void SolarisBackendFactory::probe(enum DevProbe type, std::string *outnames) +void SolarisBackendFactory::probe(DevProbe type, std::string *outnames) { switch(type) { diff --git a/Alc/backends/solaris.h b/Alc/backends/solaris.h index dcb34570..73f4a467 100644 --- a/Alc/backends/solaris.h +++ b/Alc/backends/solaris.h @@ -10,7 +10,7 @@ public: bool querySupport(ALCbackend_Type type) override; - void probe(enum DevProbe type, std::string *outnames) override; + void probe(DevProbe type, std::string *outnames) override; ALCbackend *createBackend(ALCdevice *device, ALCbackend_Type type) override; diff --git a/Alc/backends/wasapi.cpp b/Alc/backends/wasapi.cpp index 3f8cad23..c1b4bddb 100644 --- a/Alc/backends/wasapi.cpp +++ b/Alc/backends/wasapi.cpp @@ -1601,7 +1601,7 @@ HRESULT ALCwasapiCapture::resetProxy() wfx = nullptr; } - enum DevFmtType srcType; + DevFmtType srcType; if(IsEqualGUID(OutputType.SubFormat, KSDATAFORMAT_SUBTYPE_PCM)) { if(OutputType.Format.wBitsPerSample == 8) @@ -1839,7 +1839,7 @@ void WasapiBackendFactory::deinit() bool WasapiBackendFactory::querySupport(ALCbackend_Type type) { return (type == ALCbackend_Playback || type == ALCbackend_Capture); } -void WasapiBackendFactory::probe(enum DevProbe type, std::string *outnames) +void WasapiBackendFactory::probe(DevProbe type, std::string *outnames) { ThreadRequest req{ nullptr, 0 }; diff --git a/Alc/backends/wasapi.h b/Alc/backends/wasapi.h index 2ee10ac8..a94f85df 100644 --- a/Alc/backends/wasapi.h +++ b/Alc/backends/wasapi.h @@ -10,7 +10,7 @@ public: bool querySupport(ALCbackend_Type type) override; - void probe(enum DevProbe type, std::string *outnames) override; + void probe(DevProbe type, std::string *outnames) override; ALCbackend *createBackend(ALCdevice *device, ALCbackend_Type type) override; diff --git a/Alc/backends/wave.cpp b/Alc/backends/wave.cpp index 463e6bd7..d40e93f0 100644 --- a/Alc/backends/wave.cpp +++ b/Alc/backends/wave.cpp @@ -385,7 +385,7 @@ bool WaveBackendFactory::init() bool WaveBackendFactory::querySupport(ALCbackend_Type type) { return (type == ALCbackend_Playback); } -void WaveBackendFactory::probe(enum DevProbe type, std::string *outnames) +void WaveBackendFactory::probe(DevProbe type, std::string *outnames) { switch(type) { diff --git a/Alc/backends/wave.h b/Alc/backends/wave.h index 65bb5ecf..bb51cc71 100644 --- a/Alc/backends/wave.h +++ b/Alc/backends/wave.h @@ -10,7 +10,7 @@ public: bool querySupport(ALCbackend_Type type) override; - void probe(enum DevProbe type, std::string *outnames) override; + void probe(DevProbe type, std::string *outnames) override; ALCbackend *createBackend(ALCdevice *device, ALCbackend_Type type) override; diff --git a/Alc/backends/winmm.cpp b/Alc/backends/winmm.cpp index 38766869..0ebba81c 100644 --- a/Alc/backends/winmm.cpp +++ b/Alc/backends/winmm.cpp @@ -669,7 +669,7 @@ void WinMMBackendFactory::deinit() bool WinMMBackendFactory::querySupport(ALCbackend_Type type) { return (type == ALCbackend_Playback || type == ALCbackend_Capture); } -void WinMMBackendFactory::probe(enum DevProbe type, std::string *outnames) +void WinMMBackendFactory::probe(DevProbe type, std::string *outnames) { auto add_device = [outnames](const std::string &dname) -> void { diff --git a/Alc/backends/winmm.h b/Alc/backends/winmm.h index b60dbc10..e5801c01 100644 --- a/Alc/backends/winmm.h +++ b/Alc/backends/winmm.h @@ -10,7 +10,7 @@ public: bool querySupport(ALCbackend_Type type) override; - void probe(enum DevProbe type, std::string *outnames) override; + void probe(DevProbe type, std::string *outnames) override; ALCbackend *createBackend(ALCdevice *device, ALCbackend_Type type) override; diff --git a/Alc/converter.cpp b/Alc/converter.cpp index 3effddd8..66627879 100644 --- a/Alc/converter.cpp +++ b/Alc/converter.cpp @@ -44,8 +44,7 @@ inline void LoadSampleArray(ALfloat *RESTRICT dst, const void *src, ALint srcste dst[i] = LoadSample<T>(ssrc[i*srcstep]); } -void LoadSamples(ALfloat *dst, const ALvoid *src, ALint srcstep, enum DevFmtType srctype, - ALsizei samples) +void LoadSamples(ALfloat *dst, const ALvoid *src, ALint srcstep, DevFmtType srctype, ALsizei samples) { #define HANDLE_FMT(T) \ case T: LoadSampleArray<T>(dst, src, srcstep, samples); break @@ -95,7 +94,7 @@ inline void StoreSampleArray(void *dst, const ALfloat *RESTRICT src, ALint dstst } -void StoreSamples(ALvoid *dst, const ALfloat *src, ALint dststep, enum DevFmtType dsttype, ALsizei samples) +void StoreSamples(ALvoid *dst, const ALfloat *src, ALint dststep, DevFmtType dsttype, ALsizei samples) { #define HANDLE_FMT(T) \ case T: StoreSampleArray<T>(dst, src, dststep, samples); break @@ -136,9 +135,8 @@ void Stereo2Mono(ALfloat *RESTRICT dst, const void *src, ALsizei frames) } // namespace -SampleConverter *CreateSampleConverter(enum DevFmtType srcType, enum DevFmtType dstType, - ALsizei numchans, ALsizei srcRate, ALsizei dstRate, - Resampler resampler) +SampleConverter *CreateSampleConverter(DevFmtType srcType, DevFmtType dstType, ALsizei numchans, + ALsizei srcRate, ALsizei dstRate, Resampler resampler) { if(numchans <= 0 || srcRate <= 0 || dstRate <= 0) return nullptr; diff --git a/Alc/converter.h b/Alc/converter.h index 7444d4fa..1c473f49 100644 --- a/Alc/converter.h +++ b/Alc/converter.h @@ -29,9 +29,8 @@ struct SampleConverter { DEF_PLACE_NEWDEL() }; -SampleConverter *CreateSampleConverter(enum DevFmtType srcType, enum DevFmtType dstType, - ALsizei numchans, ALsizei srcRate, ALsizei dstRate, - Resampler resampler); +SampleConverter *CreateSampleConverter(DevFmtType srcType, DevFmtType dstType, ALsizei numchans, + ALsizei srcRate, ALsizei dstRate, Resampler resampler); void DestroySampleConverter(SampleConverter **converter); ALsizei SampleConverterInput(SampleConverter *converter, const ALvoid **src, ALsizei *srcframes, ALvoid *dst, ALsizei dstframes); @@ -49,7 +48,7 @@ struct ChannelConverter { DEF_NEWDEL(ChannelConverter) }; -ChannelConverter *CreateChannelConverter(enum DevFmtType srcType, enum DevFmtChannels srcChans, enum DevFmtChannels dstChans); +ChannelConverter *CreateChannelConverter(DevFmtType srcType, DevFmtChannels srcChans, DevFmtChannels dstChans); void DestroyChannelConverter(ChannelConverter **converter); void ChannelConverterInput(ChannelConverter *converter, const ALvoid *src, ALfloat *dst, ALsizei frames); diff --git a/Alc/helpers.cpp b/Alc/helpers.cpp index 17942855..beee4bff 100644 --- a/Alc/helpers.cpp +++ b/Alc/helpers.cpp @@ -125,13 +125,13 @@ DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_GUID, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x #if defined(HAVE_GCC_GET_CPUID) && (defined(__i386__) || defined(__x86_64__) || \ defined(_M_IX86) || defined(_M_X64)) -typedef unsigned int reg_type; +using reg_type = unsigned int; static inline void get_cpuid(int f, reg_type *regs) { __get_cpuid(f, ®s[0], ®s[1], ®s[2], ®s[3]); } #define CAN_GET_CPUID #elif defined(HAVE_CPUID_INTRINSIC) && (defined(__i386__) || defined(__x86_64__) || \ defined(_M_IX86) || defined(_M_X64)) -typedef int reg_type; +using reg_type = int; static inline void get_cpuid(int f, reg_type *regs) { (__cpuid)(regs, f); } #define CAN_GET_CPUID diff --git a/Alc/mixer/defs.h b/Alc/mixer/defs.h index 46f70982..5fa88773 100644 --- a/Alc/mixer/defs.h +++ b/Alc/mixer/defs.h @@ -6,12 +6,8 @@ #include "alMain.h" #include "alu.h" -#ifdef __cplusplus -extern "C" { -#endif struct MixGains; - struct MixHrtfParams; struct HrtfState; @@ -26,8 +22,8 @@ const ALfloat *Resample_bsinc_C(const InterpState *state, const ALfloat *RESTRIC /* C mixers */ void MixHrtf_C(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, const ALfloat *data, ALsizei Offset, ALsizei OutPos, - const ALsizei IrSize, struct MixHrtfParams *hrtfparams, - struct HrtfState *hrtfstate, ALsizei BufferSize); + const ALsizei IrSize, MixHrtfParams *hrtfparams, + HrtfState *hrtfstate, ALsizei BufferSize); void MixHrtfBlend_C(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, const ALfloat *data, ALsizei Offset, ALsizei OutPos, const ALsizei IrSize, const HrtfParams *oldparams, @@ -47,8 +43,8 @@ void MixRow_C(ALfloat *OutBuffer, const ALfloat *Gains, /* SSE mixers */ void MixHrtf_SSE(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, const ALfloat *data, ALsizei Offset, ALsizei OutPos, - const ALsizei IrSize, struct MixHrtfParams *hrtfparams, - struct HrtfState *hrtfstate, ALsizei BufferSize); + const ALsizei IrSize, MixHrtfParams *hrtfparams, + HrtfState *hrtfstate, ALsizei BufferSize); void MixHrtfBlend_SSE(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, const ALfloat *data, ALsizei Offset, ALsizei OutPos, const ALsizei IrSize, const HrtfParams *oldparams, @@ -94,8 +90,8 @@ const ALfloat *Resample_bsinc_SSE(const InterpState *state, const ALfloat *RESTR /* Neon mixers */ void MixHrtf_Neon(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, const ALfloat *data, ALsizei Offset, ALsizei OutPos, - const ALsizei IrSize, struct MixHrtfParams *hrtfparams, - struct HrtfState *hrtfstate, ALsizei BufferSize); + const ALsizei IrSize, MixHrtfParams *hrtfparams, + HrtfState *hrtfstate, ALsizei BufferSize); void MixHrtfBlend_Neon(ALfloat *RESTRICT LeftOut, ALfloat *RESTRICT RightOut, const ALfloat *data, ALsizei Offset, ALsizei OutPos, const ALsizei IrSize, const HrtfParams *oldparams, @@ -120,8 +116,4 @@ const ALfloat *Resample_bsinc_Neon(const InterpState *state, const ALfloat *REST ALsizei frac, ALint increment, ALfloat *RESTRICT dst, ALsizei dstlen); -#ifdef __cplusplus -} // extern "C" -#endif - #endif /* MIXER_DEFS_H */ diff --git a/Alc/mixvoice.cpp b/Alc/mixvoice.cpp index db2609f5..680f4a31 100644 --- a/Alc/mixvoice.cpp +++ b/Alc/mixvoice.cpp @@ -54,7 +54,7 @@ static_assert((INT_MAX>>FRACTIONBITS)/MAX_PITCH > BUFFERSIZE, static_assert(MAX_RESAMPLE_PADDING >= 24, "MAX_RESAMPLE_PADDING must be at least 24!"); -enum Resampler ResamplerDefault = LinearResampler; +Resampler ResamplerDefault = LinearResampler; MixerFunc MixSamples = Mix_C; RowMixerFunc MixRowSamples = MixRow_C; @@ -113,7 +113,7 @@ static inline HrtfMixerBlendFunc SelectHrtfBlendMixer(void) return MixHrtfBlend_C; } -ResamplerFunc SelectResampler(enum Resampler resampler) +ResamplerFunc SelectResampler(Resampler resampler) { switch(resampler) { @@ -183,7 +183,7 @@ void aluInitMixer(void) char *end; long n = strtol(str, &end, 0); if(*end == '\0' && (n == PointResampler || n == LinearResampler || n == FIR4Resampler)) - ResamplerDefault = static_cast<enum Resampler>(n); + ResamplerDefault = static_cast<Resampler>(n); else WARN("Invalid resampler: %s\n", str); } @@ -393,7 +393,7 @@ ALboolean MixSource(ALvoice *voice, ALuint SourceID, ALCcontext *Context, ALsize const ALbyte *Data{buffer->mData.data()}; LoadSamples(&SrcData[FilledAmt], &Data[(DataPosInt*NumChannels + chan)*SampleSize], - NumChannels, buffer->FmtType, DataSize + NumChannels, buffer->mFmtType, DataSize ); return CompLen; }; @@ -417,7 +417,7 @@ ALboolean MixSource(ALvoice *voice, ALuint SourceID, ALCcontext *Context, ALsize const ALbyte *Data{buffer->mData.data()}; LoadSamples(&SrcData[FilledAmt], &Data[(DataPosInt*NumChannels + chan)*SampleSize], - NumChannels, buffer->FmtType, DataSize + NumChannels, buffer->mFmtType, DataSize ); return CompLen; }; @@ -440,7 +440,7 @@ ALboolean MixSource(ALvoice *voice, ALuint SourceID, ALCcontext *Context, ALsize const ALbyte *Data{buffer->mData.data()}; LoadSamples(&SrcData[FilledAmt], &Data[(LoopStart*NumChannels + chan)*SampleSize], - NumChannels, buffer->FmtType, DataSize + NumChannels, buffer->mFmtType, DataSize ); return CompLen; }; @@ -479,7 +479,7 @@ ALboolean MixSource(ALvoice *voice, ALuint SourceID, ALCcontext *Context, ALsize Data += (pos*NumChannels + chan)*SampleSize; LoadSamples(&SrcData[FilledAmt], Data, NumChannels, - buffer->FmtType, DataSize); + buffer->mFmtType, DataSize); return CompLen; }; auto buffers_end = tmpiter->buffers + tmpiter->num_buffers; diff --git a/Alc/panning.cpp b/Alc/panning.cpp index cec6eaf7..5e7806ec 100644 --- a/Alc/panning.cpp +++ b/Alc/panning.cpp @@ -678,7 +678,7 @@ void InitHrtfPanning(ALCdevice *device) /* Don't bother with HOA when using full HRTF rendering. Nothing needs it, * and it eases the CPU/memory load. */ - if(device->Render_Mode != HrtfRender) + if(device->mRenderMode != HrtfRender) { device->AmbiUp.reset(new AmbiUpsampler{}); @@ -879,7 +879,7 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, HrtfRequestMode hrtf_appr device->mHrtfState = nullptr; device->mHrtf = nullptr; device->HrtfName.clear(); - device->Render_Mode = NormalRender; + device->mRenderMode = NormalRender; device->Dry.Ambi = AmbiConfig{}; device->Dry.CoeffCount = 0; @@ -1063,20 +1063,20 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, HrtfRequestMode hrtf_appr Hrtf_DecRef(old_hrtf); old_hrtf = nullptr; - device->Render_Mode = HrtfRender; + device->mRenderMode = HrtfRender; const char *mode; if(ConfigValueStr(device->DeviceName.c_str(), nullptr, "hrtf-mode", &mode)) { if(strcasecmp(mode, "full") == 0) - device->Render_Mode = HrtfRender; + device->mRenderMode = HrtfRender; else if(strcasecmp(mode, "basic") == 0) - device->Render_Mode = NormalRender; + device->mRenderMode = NormalRender; else ERR("Unexpected hrtf-mode: %s\n", mode); } TRACE("%s HRTF rendering enabled, using \"%s\"\n", - ((device->Render_Mode == HrtfRender) ? "Full" : "Basic"), device->HrtfName.c_str() + ((device->mRenderMode == HrtfRender) ? "Full" : "Basic"), device->HrtfName.c_str() ); InitHrtfPanning(device); return; @@ -1089,7 +1089,7 @@ no_hrtf: old_hrtf = nullptr; TRACE("HRTF disabled\n"); - device->Render_Mode = StereoPair; + device->mRenderMode = StereoPair; int bs2blevel{((headphones && hrtf_appreq != Hrtf_Disable) || (hrtf_appreq == Hrtf_Enable)) ? 5 : 0}; @@ -1110,11 +1110,11 @@ no_hrtf: if(ConfigValueStr(device->DeviceName.c_str(), nullptr, "stereo-encoding", &mode)) { if(strcasecmp(mode, "uhj") == 0) - device->Render_Mode = NormalRender; + device->mRenderMode = NormalRender; else if(strcasecmp(mode, "panpot") != 0) ERR("Unexpected stereo-encoding: %s\n", mode); } - if(device->Render_Mode == NormalRender) + if(device->mRenderMode == NormalRender) { device->Uhj_Encoder.reset(new Uhj2Encoder{}); TRACE("UHJ enabled\n"); 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, |