diff options
Diffstat (limited to 'al')
-rw-r--r-- | al/auxeffectslot.cpp | 40 | ||||
-rw-r--r-- | al/debug.cpp | 2 | ||||
-rw-r--r-- | al/eax/call.cpp | 3 | ||||
-rw-r--r-- | al/eax/call.h | 14 | ||||
-rw-r--r-- | al/effect.cpp | 47 | ||||
-rw-r--r-- | al/filter.cpp | 2 | ||||
-rw-r--r-- | al/state.cpp | 2 |
7 files changed, 56 insertions, 54 deletions
diff --git a/al/auxeffectslot.cpp b/al/auxeffectslot.cpp index 7b7672a5..02c061a4 100644 --- a/al/auxeffectslot.cpp +++ b/al/auxeffectslot.cpp @@ -55,31 +55,31 @@ namespace { struct FactoryItem { EffectSlotType Type; - EffectStateFactory* (&GetFactory)(void); + EffectStateFactory* (&GetFactory)(); }; -constexpr FactoryItem FactoryList[] = { - { EffectSlotType::None, NullStateFactory_getFactory }, - { EffectSlotType::EAXReverb, ReverbStateFactory_getFactory }, - { EffectSlotType::Reverb, StdReverbStateFactory_getFactory }, - { EffectSlotType::Autowah, AutowahStateFactory_getFactory }, - { EffectSlotType::Chorus, ChorusStateFactory_getFactory }, - { EffectSlotType::Compressor, CompressorStateFactory_getFactory }, - { EffectSlotType::Distortion, DistortionStateFactory_getFactory }, - { EffectSlotType::Echo, EchoStateFactory_getFactory }, - { EffectSlotType::Equalizer, EqualizerStateFactory_getFactory }, - { EffectSlotType::Flanger, FlangerStateFactory_getFactory }, - { EffectSlotType::FrequencyShifter, FshifterStateFactory_getFactory }, - { EffectSlotType::RingModulator, ModulatorStateFactory_getFactory }, - { EffectSlotType::PitchShifter, PshifterStateFactory_getFactory }, - { EffectSlotType::VocalMorpher, VmorpherStateFactory_getFactory }, - { EffectSlotType::DedicatedDialog, DedicatedStateFactory_getFactory }, - { EffectSlotType::DedicatedLFE, DedicatedStateFactory_getFactory }, - { EffectSlotType::Convolution, ConvolutionStateFactory_getFactory }, +constexpr std::array FactoryList{ + FactoryItem{EffectSlotType::None, NullStateFactory_getFactory}, + FactoryItem{EffectSlotType::EAXReverb, ReverbStateFactory_getFactory}, + FactoryItem{EffectSlotType::Reverb, StdReverbStateFactory_getFactory}, + FactoryItem{EffectSlotType::Autowah, AutowahStateFactory_getFactory}, + FactoryItem{EffectSlotType::Chorus, ChorusStateFactory_getFactory}, + FactoryItem{EffectSlotType::Compressor, CompressorStateFactory_getFactory}, + FactoryItem{EffectSlotType::Distortion, DistortionStateFactory_getFactory}, + FactoryItem{EffectSlotType::Echo, EchoStateFactory_getFactory}, + FactoryItem{EffectSlotType::Equalizer, EqualizerStateFactory_getFactory}, + FactoryItem{EffectSlotType::Flanger, FlangerStateFactory_getFactory}, + FactoryItem{EffectSlotType::FrequencyShifter, FshifterStateFactory_getFactory}, + FactoryItem{EffectSlotType::RingModulator, ModulatorStateFactory_getFactory}, + FactoryItem{EffectSlotType::PitchShifter, PshifterStateFactory_getFactory}, + FactoryItem{EffectSlotType::VocalMorpher, VmorpherStateFactory_getFactory}, + FactoryItem{EffectSlotType::DedicatedDialog, DedicatedStateFactory_getFactory}, + FactoryItem{EffectSlotType::DedicatedLFE, DedicatedStateFactory_getFactory}, + FactoryItem{EffectSlotType::Convolution, ConvolutionStateFactory_getFactory}, }; EffectStateFactory *getFactoryByType(EffectSlotType type) { - auto iter = std::find_if(std::begin(FactoryList), std::end(FactoryList), + auto iter = std::find_if(FactoryList.begin(), FactoryList.end(), [type](const FactoryItem &item) noexcept -> bool { return item.Type == type; }); return (iter != std::end(FactoryList)) ? iter->GetFactory() : nullptr; diff --git a/al/debug.cpp b/al/debug.cpp index b76ec9af..cd79c148 100644 --- a/al/debug.cpp +++ b/al/debug.cpp @@ -4,10 +4,10 @@ #include <algorithm> #include <array> +#include <cstddef> #include <cstring> #include <mutex> #include <optional> -#include <stddef.h> #include <stdexcept> #include <string> #include <utility> diff --git a/al/eax/call.cpp b/al/eax/call.cpp index 689d5cf1..013a3992 100644 --- a/al/eax/call.cpp +++ b/al/eax/call.cpp @@ -22,8 +22,7 @@ EaxCall::EaxCall( ALuint property_source_id, ALvoid* property_buffer, ALuint property_size) - : mCallType{type}, mVersion{0}, mPropertySetId{EaxCallPropertySetId::none} - , mIsDeferred{(property_id & deferred_flag) != 0} + : mCallType{type}, mIsDeferred{(property_id & deferred_flag) != 0} , mPropertyId{property_id & ~deferred_flag}, mPropertySourceId{property_source_id} , mPropertyBuffer{property_buffer}, mPropertyBufferSize{property_size} { diff --git a/al/eax/call.h b/al/eax/call.h index 04e94f3e..e7f2329f 100644 --- a/al/eax/call.h +++ b/al/eax/call.h @@ -71,16 +71,16 @@ public: } private: - const EaxCallType mCallType{}; + const EaxCallType mCallType; int mVersion{}; EaxFxSlotIndex mFxSlotIndex{}; - EaxCallPropertySetId mPropertySetId{}; - bool mIsDeferred{}; + EaxCallPropertySetId mPropertySetId{EaxCallPropertySetId::none}; + bool mIsDeferred; - const ALuint mPropertyId{}; - const ALuint mPropertySourceId{}; - ALvoid*const mPropertyBuffer{}; - const ALuint mPropertyBufferSize{}; + const ALuint mPropertyId; + const ALuint mPropertySourceId; + ALvoid*const mPropertyBuffer; + const ALuint mPropertyBufferSize; [[noreturn]] static void fail(const char* message); [[noreturn]] static void fail_too_small(); diff --git a/al/effect.cpp b/al/effect.cpp index e99226c8..7cd6a67b 100644 --- a/al/effect.cpp +++ b/al/effect.cpp @@ -94,24 +94,24 @@ struct EffectPropsItem { const EffectProps &DefaultProps; const EffectVtable &Vtable; }; -constexpr EffectPropsItem EffectPropsList[] = { - { AL_EFFECT_NULL, NullEffectProps, NullEffectVtable }, - { AL_EFFECT_EAXREVERB, ReverbEffectProps, ReverbEffectVtable }, - { AL_EFFECT_REVERB, StdReverbEffectProps, StdReverbEffectVtable }, - { AL_EFFECT_AUTOWAH, AutowahEffectProps, AutowahEffectVtable }, - { AL_EFFECT_CHORUS, ChorusEffectProps, ChorusEffectVtable }, - { AL_EFFECT_COMPRESSOR, CompressorEffectProps, CompressorEffectVtable }, - { AL_EFFECT_DISTORTION, DistortionEffectProps, DistortionEffectVtable }, - { AL_EFFECT_ECHO, EchoEffectProps, EchoEffectVtable }, - { AL_EFFECT_EQUALIZER, EqualizerEffectProps, EqualizerEffectVtable }, - { AL_EFFECT_FLANGER, FlangerEffectProps, FlangerEffectVtable }, - { AL_EFFECT_FREQUENCY_SHIFTER, FshifterEffectProps, FshifterEffectVtable }, - { AL_EFFECT_RING_MODULATOR, ModulatorEffectProps, ModulatorEffectVtable }, - { AL_EFFECT_PITCH_SHIFTER, PshifterEffectProps, PshifterEffectVtable }, - { AL_EFFECT_VOCAL_MORPHER, VmorpherEffectProps, VmorpherEffectVtable }, - { AL_EFFECT_DEDICATED_DIALOGUE, DedicatedEffectProps, DedicatedEffectVtable }, - { AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT, DedicatedEffectProps, DedicatedEffectVtable }, - { AL_EFFECT_CONVOLUTION_SOFT, ConvolutionEffectProps, ConvolutionEffectVtable }, +constexpr std::array EffectPropsList{ + EffectPropsItem{AL_EFFECT_NULL, NullEffectProps, NullEffectVtable}, + EffectPropsItem{AL_EFFECT_EAXREVERB, ReverbEffectProps, ReverbEffectVtable}, + EffectPropsItem{AL_EFFECT_REVERB, StdReverbEffectProps, StdReverbEffectVtable}, + EffectPropsItem{AL_EFFECT_AUTOWAH, AutowahEffectProps, AutowahEffectVtable}, + EffectPropsItem{AL_EFFECT_CHORUS, ChorusEffectProps, ChorusEffectVtable}, + EffectPropsItem{AL_EFFECT_COMPRESSOR, CompressorEffectProps, CompressorEffectVtable}, + EffectPropsItem{AL_EFFECT_DISTORTION, DistortionEffectProps, DistortionEffectVtable}, + EffectPropsItem{AL_EFFECT_ECHO, EchoEffectProps, EchoEffectVtable}, + EffectPropsItem{AL_EFFECT_EQUALIZER, EqualizerEffectProps, EqualizerEffectVtable}, + EffectPropsItem{AL_EFFECT_FLANGER, FlangerEffectProps, FlangerEffectVtable}, + EffectPropsItem{AL_EFFECT_FREQUENCY_SHIFTER, FshifterEffectProps, FshifterEffectVtable}, + EffectPropsItem{AL_EFFECT_RING_MODULATOR, ModulatorEffectProps, ModulatorEffectVtable}, + EffectPropsItem{AL_EFFECT_PITCH_SHIFTER, PshifterEffectProps, PshifterEffectVtable}, + EffectPropsItem{AL_EFFECT_VOCAL_MORPHER, VmorpherEffectProps, VmorpherEffectVtable}, + EffectPropsItem{AL_EFFECT_DEDICATED_DIALOGUE, DedicatedEffectProps, DedicatedEffectVtable}, + EffectPropsItem{AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT, DedicatedEffectProps, DedicatedEffectVtable}, + EffectPropsItem{AL_EFFECT_CONVOLUTION_SOFT, ConvolutionEffectProps, ConvolutionEffectVtable}, }; @@ -136,7 +136,7 @@ void ALeffect_getParamfv(const ALeffect *effect, ALenum param, float *values) const EffectPropsItem *getEffectPropsItemByType(ALenum type) { - auto iter = std::find_if(std::begin(EffectPropsList), std::end(EffectPropsList), + auto iter = std::find_if(EffectPropsList.begin(), EffectPropsList.end(), [type](const EffectPropsItem &item) noexcept -> bool { return item.Type == type; }); return (iter != std::end(EffectPropsList)) ? al::to_address(iter) : nullptr; @@ -542,11 +542,12 @@ EffectSubList::~EffectSubList() } -#define DECL(x) { #x, EFX_REVERB_PRESET_##x } -static const struct { - const char name[32]; +struct EffectPreset { + const char name[32]; /* NOLINT(*-avoid-c-arrays) */ EFXEAXREVERBPROPERTIES props; -} reverblist[] = { +}; +#define DECL(x) EffectPreset{#x, EFX_REVERB_PRESET_##x} +static constexpr std::array reverblist{ DECL(GENERIC), DECL(PADDEDCELL), DECL(ROOM), diff --git a/al/filter.cpp b/al/filter.cpp index 4f79db7d..9c8e4c62 100644 --- a/al/filter.cpp +++ b/al/filter.cpp @@ -61,7 +61,7 @@ public: filter_exception(ALenum code, const char *msg, ...); ~filter_exception() override; - ALenum errorCode() const noexcept { return mErrorCode; } + [[nodiscard]] auto errorCode() const noexcept -> ALenum { return mErrorCode; } }; filter_exception::filter_exception(ALenum code, const char* msg, ...) : mErrorCode{code} diff --git a/al/state.cpp b/al/state.cpp index 5131edd9..fd5dc5e3 100644 --- a/al/state.cpp +++ b/al/state.cpp @@ -60,6 +60,7 @@ namespace { +/* NOLINTBEGIN(*-avoid-c-arrays) */ constexpr ALchar alVendor[] = "OpenAL Community"; constexpr ALchar alVersion[] = "1.1 ALSOFT " ALSOFT_VERSION; constexpr ALchar alRenderer[] = "OpenAL Soft"; @@ -73,6 +74,7 @@ constexpr ALchar alErrInvalidOp[] = "Invalid Operation"; constexpr ALchar alErrOutOfMemory[] = "Out of Memory"; constexpr ALchar alStackOverflow[] = "Stack Overflow"; constexpr ALchar alStackUnderflow[] = "Stack Underflow"; +/* NOLINTEND(*-avoid-c-arrays) */ /* Resampler strings */ template<Resampler rtype> struct ResamplerName { }; |