diff options
-rw-r--r-- | al/auxeffectslot.cpp | 53 | ||||
-rw-r--r-- | al/auxeffectslot.h | 16 | ||||
-rw-r--r-- | al/eax_effect.h | 8 | ||||
-rw-r--r-- | al/eax_fx_slots.cpp | 1 | ||||
-rw-r--r-- | al/effect.cpp | 138 | ||||
-rw-r--r-- | al/effect.h | 52 | ||||
-rw-r--r-- | al/effects/autowah.cpp | 16 | ||||
-rw-r--r-- | al/effects/chorus.cpp | 31 | ||||
-rw-r--r-- | al/effects/compressor.cpp | 16 | ||||
-rw-r--r-- | al/effects/distortion.cpp | 16 | ||||
-rw-r--r-- | al/effects/echo.cpp | 16 | ||||
-rw-r--r-- | al/effects/effects.cpp | 80 | ||||
-rw-r--r-- | al/effects/effects.h | 4 | ||||
-rw-r--r-- | al/effects/equalizer.cpp | 16 | ||||
-rw-r--r-- | al/effects/fshifter.cpp | 16 | ||||
-rw-r--r-- | al/effects/modulator.cpp | 16 | ||||
-rw-r--r-- | al/effects/null.cpp | 7 | ||||
-rw-r--r-- | al/effects/pshifter.cpp | 18 | ||||
-rw-r--r-- | al/effects/reverb.cpp | 18 | ||||
-rw-r--r-- | al/effects/vmorpher.cpp | 18 |
20 files changed, 124 insertions, 432 deletions
diff --git a/al/auxeffectslot.cpp b/al/auxeffectslot.cpp index e0f2be73..5ddd2a28 100644 --- a/al/auxeffectslot.cpp +++ b/al/auxeffectslot.cpp @@ -1091,11 +1091,6 @@ void ALeffectslot::eax_initialize( eax_set_default_slots_defaults(); } -void ALeffectslot::eax_uninitialize() noexcept -{ - eax_al_effect_ = nullptr; -} - const EAX50FXSLOTPROPERTIES& ALeffectslot::eax_get_eax_fx_slot() const noexcept { return eax_eax_fx_slot_; @@ -1436,21 +1431,13 @@ bool ALeffectslot::eax_get( void ALeffectslot::eax_set_fx_slot_effect( ALenum al_effect_type) { - if (!eax_al_effect_) - { - eax_al_effect_ = eax_create_al_effect(*eax_al_context_, al_effect_type); - } - else - { - auto& device = eax_al_context_->mALDevice; - std::lock_guard<std::mutex> effect_lock{device->EffectLock}; - - eax_al_effect_->eax_al_set_effect(al_effect_type); - } + if(!IsValidEffectType(al_effect_type)) + eax_fail("Unsupported effect."); - eax_al_effect_->eax_initialize(); + eax_effect_ = nullptr; + eax_effect_ = eax_create_eax_effect(al_effect_type); - eax_set_effect_slot_effect(*eax_al_effect_); + eax_set_effect_slot_effect(*eax_effect_); } void ALeffectslot::eax_set_fx_slot_effect() @@ -1704,35 +1691,17 @@ void ALeffectslot::eax_dispatch_effect( const EaxEaxCall& eax_call) { auto is_changed = false; - - { - std::lock_guard<std::mutex> effect_lock{eax_al_context_->mALDevice->EffectLock}; - - if (!eax_al_effect_->eax_effect) - { - return; - } - - is_changed = eax_al_effect_->eax_effect->dispatch(eax_call); - } - - if (is_changed) - { - eax_set_effect_slot_effect(*eax_al_effect_); - } + if(eax_effect_) + is_changed = eax_effect_->dispatch(eax_call); + if(is_changed) + eax_set_effect_slot_effect(*eax_effect_); } -void ALeffectslot::eax_set_effect_slot_effect( - ALeffect& effect) +void ALeffectslot::eax_set_effect_slot_effect(EaxEffect &effect) { #define EAX_PREFIX "[EAX_SET_EFFECT_SLOT_EFFECT] " - auto& device = *eax_al_context_->mALDevice; - - std::lock_guard<std::mutex> effect_slot_lock{eax_al_context_->mEffectSlotLock}; - std::lock_guard<std::mutex> effect_lock{device.EffectLock}; - - const auto error = initEffect(effect.type, effect.Props, eax_al_context_); + const auto error = initEffect(effect.al_effect_type_, effect.al_effect_props_, eax_al_context_); if (error != AL_NO_ERROR) { ERR(EAX_PREFIX "%s\n", "Failed to initialize an effect."); diff --git a/al/auxeffectslot.h b/al/auxeffectslot.h index 2c462cd0..8182c082 100644 --- a/al/auxeffectslot.h +++ b/al/auxeffectslot.h @@ -19,9 +19,8 @@ #ifdef ALSOFT_EAX #include <memory> -#include "al/effect.h" - #include "eax_eax_call.h" +#include "eax_effect.h" #include "eax_fx_slot_index.h" #endif // ALSOFT_EAX @@ -78,8 +77,6 @@ public: ALCcontext& al_context, EaxFxSlotIndexValue index); - void eax_uninitialize() noexcept; - const EAX50FXSLOTPROPERTIES& eax_get_eax_fx_slot() const noexcept; @@ -96,7 +93,7 @@ private: EAX50FXSLOTPROPERTIES eax_eax_fx_slot_{}; - EaxAlEffectUPtr eax_al_effect_{}; + EaxEffectUPtr eax_effect_{}; [[noreturn]] @@ -243,16 +240,13 @@ private: // `alAuxiliaryEffectSloti(effect_slot, AL_EFFECTSLOT_EFFECT, effect)` - void eax_set_effect_slot_effect( - ALeffect& effect); + void eax_set_effect_slot_effect(EaxEffect &effect); // `alAuxiliaryEffectSloti(effect_slot, AL_EFFECTSLOT_AUXILIARY_SEND_AUTO, value)` - void eax_set_effect_slot_send_auto( - bool is_send_auto); + void eax_set_effect_slot_send_auto(bool is_send_auto); // `alAuxiliaryEffectSlotf(effect_slot, AL_EFFECTSLOT_GAIN, gain)` - void eax_set_effect_slot_gain( - ALfloat gain); + void eax_set_effect_slot_gain(ALfloat gain); #endif // ALSOFT_EAX }; diff --git a/al/eax_effect.h b/al/eax_effect.h index 23dbb73e..2688ca9b 100644 --- a/al/eax_effect.h +++ b/al/eax_effect.h @@ -4,16 +4,18 @@ #include <memory> +#include "AL/al.h" +#include "core/effects/base.h" #include "eax_eax_call.h" - class EaxEffect { public: - EaxEffect() = default; - + EaxEffect(ALenum type) : al_effect_type_{type} { } virtual ~EaxEffect() = default; + const ALenum al_effect_type_; + EffectProps al_effect_props_{}; // Returns "true" if any immediated property was changed. // [[nodiscard]] diff --git a/al/eax_fx_slots.cpp b/al/eax_fx_slots.cpp index 63e867ec..f2db3ede 100644 --- a/al/eax_fx_slots.cpp +++ b/al/eax_fx_slots.cpp @@ -39,7 +39,6 @@ void EaxFxSlots::uninitialize() noexcept { for (auto& fx_slot : fx_slots_) { - fx_slot->eax_uninitialize(); fx_slot = nullptr; } } diff --git a/al/effect.cpp b/al/effect.cpp index e4fe95b3..5a74ca53 100644 --- a/al/effect.cpp +++ b/al/effect.cpp @@ -751,139 +751,15 @@ void LoadReverbPreset(const char *name, ALeffect *effect) WARN("Reverb preset '%s' not found\n", name); } -#ifdef ALSOFT_EAX -namespace { - -class EaxAlEffectException : - public EaxException -{ -public: - explicit EaxAlEffectException( - const char* message) - : - EaxException{"[EAX_AL_EFFECT]", message} - { - } -}; // EaxAlEffectException - - -} // namespace - - -void ALeffect::eax_initialize() -{ - eax_effect = nullptr; - eax_effect = eax_create_eax_effect(type, Props); -} - -void ALeffect::eax_al_set_effect( - ALenum al_effect_type) -{ - if (al_effect_type != AL_EFFECT_NULL) - { - auto has_effect = false; - - for (const auto &effect_item : gEffectList) - { - if (al_effect_type == effect_item.val && !DisabledEffects[effect_item.type]) - { - has_effect = true; - break; - } - } - - if (!has_effect) - { - eax_fail("Effect not available."); - } - } - - InitEffectParams(this, al_effect_type); -} - -[[noreturn]] -void ALeffect::eax_fail( - const char* message) -{ - throw EaxAlEffectException{message}; -} - -EaxAlEffectDeleter::EaxAlEffectDeleter( - ALCcontext& context) noexcept - : - context_{&context} -{ -} - -void EaxAlEffectDeleter::operator()( - ALeffect* effect) const -{ - assert(effect); - - eax_al_delete_effect(*context_, *effect); -} - -EaxAlEffectUPtr eax_create_al_effect( - ALCcontext& context, - ALenum effect_type) +bool IsValidEffectType(ALenum type) noexcept { -#define EAX_PREFIX "[EAX_MAKE_EFFECT] " + if(type == AL_EFFECT_NULL) + return true; - auto& device = *context.mALDevice; - std::lock_guard<std::mutex> effect_lock{device.EffectLock}; - - // Allocate. - // - if (!EnsureEffects(&device, 1)) + for(const auto &effect_item : gEffectList) { - ERR(EAX_PREFIX "%s\n", "Failed to ensure."); - return nullptr; + if(type == effect_item.val && !DisabledEffects[effect_item.type]) + return true; } - - auto effect = EaxAlEffectUPtr{AllocEffect(&device), EaxAlEffectDeleter{context}}; - - if (!effect) - { - ERR(EAX_PREFIX "%s\n", "Failed to allocate."); - return nullptr; - } - - // Set the type. - // - auto is_supported = (effect_type == AL_EFFECT_NULL); - - if (!is_supported) - { - for (const auto& effect_item : gEffectList) - { - if(effect_type == effect_item.val && !DisabledEffects[effect_item.type]) - { - is_supported = true; - break; - } - } - } - - if (!is_supported) - { - ERR(EAX_PREFIX "Effect type 0x%04x not supported.\n", effect_type); - return nullptr; - } - - InitEffectParams(effect.get(), effect_type); - - return effect; - -#undef EAX_PREFIX -} - -void eax_al_delete_effect( - ALCcontext& context, - ALeffect& effect) -{ - auto& device = *context.mALDevice; - std::lock_guard<std::mutex> effect_lock{device.EffectLock}; - - FreeEffect(&device, &effect); + return false; } -#endif // ALSOFT_EAX diff --git a/al/effect.h b/al/effect.h index 0e4948f7..a1d43313 100644 --- a/al/effect.h +++ b/al/effect.h @@ -7,12 +7,6 @@ #include "al/effects/effects.h" #include "alc/effects/base.h" -#ifdef ALSOFT_EAX -#include <memory> - -#include "eax_effect.h" -#endif // ALSOFT_EAX - enum { EAXREVERB_EFFECT = 0, @@ -57,56 +51,12 @@ struct ALeffect { ALuint id{0u}; DISABLE_ALLOC() - - -#ifdef ALSOFT_EAX -public: - EaxEffectUPtr eax_effect{}; - - - void eax_initialize(); - - void eax_al_set_effect( - ALenum al_effect_type); - - -private: - [[noreturn]] - static void eax_fail( - const char* message); -#endif // ALSOFT_EAX }; void InitEffect(ALeffect *effect); void LoadReverbPreset(const char *name, ALeffect *effect); -#ifdef ALSOFT_EAX -class EaxAlEffectDeleter { -public: - EaxAlEffectDeleter() noexcept = default; - - EaxAlEffectDeleter( - ALCcontext& context) noexcept; - - void operator()( - ALeffect* effect) const; - - -private: - ALCcontext* context_{}; -}; // EaxAlEffectDeleter - -using EaxAlEffectUPtr = std::unique_ptr<ALeffect, EaxAlEffectDeleter>; - - -EaxAlEffectUPtr eax_create_al_effect( - ALCcontext& context, - ALenum effect_type); - -void eax_al_delete_effect( - ALCcontext& context, - ALeffect& effect); -#endif // ALSOFT_EAX +bool IsValidEffectType(ALenum type) noexcept; #endif diff --git a/al/effects/autowah.cpp b/al/effects/autowah.cpp index 6dbafca3..51f8fff6 100644 --- a/al/effects/autowah.cpp +++ b/al/effects/autowah.cpp @@ -136,8 +136,7 @@ class EaxAutoWahEffect final : public EaxEffect { public: - EaxAutoWahEffect( - EffectProps& al_effect_props); + EaxAutoWahEffect(); // [[nodiscard]] @@ -146,8 +145,6 @@ public: private: - EffectProps& al_effect_props_; - EAXAUTOWAHPROPERTIES eax_{}; EAXAUTOWAHPROPERTIES eax_d_{}; EaxAutoWahEffectDirtyFlags eax_dirty_flags_{}; @@ -241,10 +238,8 @@ public: }; // EaxAutoWahEffectException -EaxAutoWahEffect::EaxAutoWahEffect( - EffectProps& al_effect_props) - : - al_effect_props_{al_effect_props} +EaxAutoWahEffect::EaxAutoWahEffect() + : EaxEffect{AL_EFFECT_AUTOWAH} { set_eax_defaults(); set_efx_defaults(); @@ -566,10 +561,9 @@ bool EaxAutoWahEffect::set( } // namespace -EaxEffectUPtr eax_create_eax_auto_wah_effect( - EffectProps& al_effect_props) +EaxEffectUPtr eax_create_eax_auto_wah_effect() { - return std::make_unique<::EaxAutoWahEffect>(al_effect_props); + return std::make_unique<::EaxAutoWahEffect>(); } #endif // ALSOFT_EAX diff --git a/al/effects/chorus.cpp b/al/effects/chorus.cpp index 37651406..15b9d635 100644 --- a/al/effects/chorus.cpp +++ b/al/effects/chorus.cpp @@ -357,8 +357,7 @@ class EaxChorusEffect final : public EaxEffect { public: - EaxChorusEffect( - EffectProps& al_effect_props); + EaxChorusEffect(); // [[nodiscard]] @@ -367,7 +366,6 @@ public: private: - EffectProps& al_effect_props_; EAXCHORUSPROPERTIES eax_{}; EAXCHORUSPROPERTIES eax_d_{}; EaxChorusEffectDirtyFlags eax_dirty_flags_{}; @@ -484,10 +482,8 @@ public: }; // EaxChorusEffectException -EaxChorusEffect::EaxChorusEffect( - EffectProps& al_effect_props) - : - al_effect_props_{al_effect_props} +EaxChorusEffect::EaxChorusEffect() + : EaxEffect{AL_EFFECT_CHORUS} { set_eax_defaults(); set_efx_defaults(); @@ -917,10 +913,9 @@ bool EaxChorusEffect::set( } // namespace -EaxEffectUPtr eax_create_eax_chorus_effect( - EffectProps& al_effect_props) +EaxEffectUPtr eax_create_eax_chorus_effect() { - return std::make_unique<::EaxChorusEffect>(al_effect_props); + return std::make_unique<::EaxChorusEffect>(); } @@ -947,8 +942,7 @@ class EaxFlangerEffect final : public EaxEffect { public: - EaxFlangerEffect( - EffectProps& al_effect_props); + EaxFlangerEffect(); // [[nodiscard]] @@ -957,8 +951,6 @@ public: private: - EffectProps& al_effect_props_; - EAXFLANGERPROPERTIES eax_{}; EAXFLANGERPROPERTIES eax_d_{}; EaxFlangerEffectDirtyFlags eax_dirty_flags_{}; @@ -1075,10 +1067,8 @@ public: }; // EaxFlangerEffectException -EaxFlangerEffect::EaxFlangerEffect( - EffectProps& al_effect_props) - : - al_effect_props_{al_effect_props} +EaxFlangerEffect::EaxFlangerEffect() + : EaxEffect{AL_EFFECT_FLANGER} { set_eax_defaults(); set_efx_defaults(); @@ -1507,10 +1497,9 @@ bool EaxFlangerEffect::set( } // namespace -EaxEffectUPtr eax_create_eax_flanger_effect( - EffectProps& al_effect_props) +EaxEffectUPtr eax_create_eax_flanger_effect() { - return std::make_unique<EaxFlangerEffect>(al_effect_props); + return std::make_unique<EaxFlangerEffect>(); } #endif // ALSOFT_EAX diff --git a/al/effects/compressor.cpp b/al/effects/compressor.cpp index a4835178..d4a8e9c2 100644 --- a/al/effects/compressor.cpp +++ b/al/effects/compressor.cpp @@ -95,8 +95,7 @@ class EaxCompressorEffect final : public EaxEffect { public: - EaxCompressorEffect( - EffectProps& al_effect_props); + EaxCompressorEffect(); // [[nodiscard]] @@ -105,8 +104,6 @@ public: private: - EffectProps& al_effect_props_; - EAXAGCCOMPRESSORPROPERTIES eax_{}; EAXAGCCOMPRESSORPROPERTIES eax_d_{}; EaxCompressorEffectDirtyFlags eax_dirty_flags_{}; @@ -168,10 +165,8 @@ public: }; // EaxCompressorEffectException -EaxCompressorEffect::EaxCompressorEffect( - EffectProps& al_effect_props) - : - al_effect_props_{al_effect_props} +EaxCompressorEffect::EaxCompressorEffect() + : EaxEffect{AL_EFFECT_COMPRESSOR} { set_eax_defaults(); set_efx_defaults(); @@ -330,10 +325,9 @@ bool EaxCompressorEffect::set( } // namespace -EaxEffectUPtr eax_create_eax_compressor_effect( - EffectProps& al_effect_props) +EaxEffectUPtr eax_create_eax_compressor_effect() { - return std::make_unique<EaxCompressorEffect>(al_effect_props); + return std::make_unique<EaxCompressorEffect>(); } #endif // ALSOFT_EAX diff --git a/al/effects/distortion.cpp b/al/effects/distortion.cpp index d0c9a3c2..4554901c 100644 --- a/al/effects/distortion.cpp +++ b/al/effects/distortion.cpp @@ -141,8 +141,7 @@ class EaxDistortionEffect final : public EaxEffect { public: - EaxDistortionEffect( - EffectProps& al_effect_props); + EaxDistortionEffect(); // [[nodiscard]] @@ -151,8 +150,6 @@ public: private: - EffectProps& al_effect_props_; - EAXDISTORTIONPROPERTIES eax_{}; EAXDISTORTIONPROPERTIES eax_d_{}; EaxDistortionEffectDirtyFlags eax_dirty_flags_{}; @@ -258,10 +255,8 @@ public: }; // EaxDistortionEffectException -EaxDistortionEffect::EaxDistortionEffect( - EffectProps& al_effect_props) - : - al_effect_props_{al_effect_props} +EaxDistortionEffect::EaxDistortionEffect() + : EaxEffect{AL_EFFECT_DISTORTION} { set_eax_defaults(); set_efx_defaults(); @@ -636,10 +631,9 @@ bool EaxDistortionEffect::set( } // namespace -EaxEffectUPtr eax_create_eax_distortion_effect( - EffectProps& al_effect_props) +EaxEffectUPtr eax_create_eax_distortion_effect() { - return std::make_unique<EaxDistortionEffect>(al_effect_props); + return std::make_unique<EaxDistortionEffect>(); } #endif // ALSOFT_EAX diff --git a/al/effects/echo.cpp b/al/effects/echo.cpp index 7e7a38bc..f54e4f31 100644 --- a/al/effects/echo.cpp +++ b/al/effects/echo.cpp @@ -138,8 +138,7 @@ class EaxEchoEffect final : public EaxEffect { public: - EaxEchoEffect( - EffectProps& al_effect_props); + EaxEchoEffect(); // [[nodiscard]] @@ -148,8 +147,6 @@ public: private: - EffectProps& al_effect_props_; - EAXECHOPROPERTIES eax_{}; EAXECHOPROPERTIES eax_d_{}; EaxEchoEffectDirtyFlags eax_dirty_flags_{}; @@ -253,10 +250,8 @@ public: }; // EaxEchoEffectException -EaxEchoEffect::EaxEchoEffect( - EffectProps& al_effect_props) - : - al_effect_props_{al_effect_props} +EaxEchoEffect::EaxEchoEffect() + : EaxEffect{AL_EFFECT_ECHO} { set_eax_defaults(); set_efx_defaults(); @@ -631,10 +626,9 @@ bool EaxEchoEffect::set( } // namespace -EaxEffectUPtr eax_create_eax_echo_effect( - EffectProps& al_effect_props) +EaxEffectUPtr eax_create_eax_echo_effect() { - return std::make_unique<EaxEchoEffect>(al_effect_props); + return std::make_unique<EaxEchoEffect>(); } #endif // ALSOFT_EAX diff --git a/al/effects/effects.cpp b/al/effects/effects.cpp index ede88f91..7be85dc0 100644 --- a/al/effects/effects.cpp +++ b/al/effects/effects.cpp @@ -11,47 +11,21 @@ EaxEffectUPtr eax_create_eax_null_effect(); - -EaxEffectUPtr eax_create_eax_chorus_effect( - EffectProps& al_effect_props); - -EaxEffectUPtr eax_create_eax_distortion_effect( - EffectProps& al_effect_props); - -EaxEffectUPtr eax_create_eax_echo_effect( - EffectProps& al_effect_props); - -EaxEffectUPtr eax_create_eax_flanger_effect( - EffectProps& al_effect_props); - -EaxEffectUPtr eax_create_eax_frequency_shifter_effect( - EffectProps& al_effect_props); - -EaxEffectUPtr eax_create_eax_vocal_morpher_effect( - EffectProps& al_effect_props); - -EaxEffectUPtr eax_create_eax_pitch_shifter_effect( - EffectProps& al_effect_props); - -EaxEffectUPtr eax_create_eax_ring_modulator_effect( - EffectProps& al_effect_props); - -EaxEffectUPtr eax_create_eax_auto_wah_effect( - EffectProps& al_effect_props); - -EaxEffectUPtr eax_create_eax_compressor_effect( - EffectProps& al_effect_props); - -EaxEffectUPtr eax_create_eax_equalizer_effect( - EffectProps& al_effect_props); - -EaxEffectUPtr eax_create_eax_reverb_effect( - EffectProps& al_effect_props); - - -EaxEffectUPtr eax_create_eax_effect( - ALenum al_effect_type, - EffectProps& al_effect_props) +EaxEffectUPtr eax_create_eax_chorus_effect(); +EaxEffectUPtr eax_create_eax_distortion_effect(); +EaxEffectUPtr eax_create_eax_echo_effect(); +EaxEffectUPtr eax_create_eax_flanger_effect(); +EaxEffectUPtr eax_create_eax_frequency_shifter_effect(); +EaxEffectUPtr eax_create_eax_vocal_morpher_effect(); +EaxEffectUPtr eax_create_eax_pitch_shifter_effect(); +EaxEffectUPtr eax_create_eax_ring_modulator_effect(); +EaxEffectUPtr eax_create_eax_auto_wah_effect(); +EaxEffectUPtr eax_create_eax_compressor_effect(); +EaxEffectUPtr eax_create_eax_equalizer_effect(); +EaxEffectUPtr eax_create_eax_reverb_effect(); + + +EaxEffectUPtr eax_create_eax_effect(ALenum al_effect_type) { #define EAX_PREFIX "[EAX_MAKE_EAX_EFFECT] " @@ -61,40 +35,40 @@ EaxEffectUPtr eax_create_eax_effect( return eax_create_eax_null_effect(); case AL_EFFECT_CHORUS: - return eax_create_eax_chorus_effect(al_effect_props); + return eax_create_eax_chorus_effect(); case AL_EFFECT_DISTORTION: - return eax_create_eax_distortion_effect(al_effect_props); + return eax_create_eax_distortion_effect(); case AL_EFFECT_ECHO: - return eax_create_eax_echo_effect(al_effect_props); + return eax_create_eax_echo_effect(); case AL_EFFECT_FLANGER: - return eax_create_eax_flanger_effect(al_effect_props); + return eax_create_eax_flanger_effect(); case AL_EFFECT_FREQUENCY_SHIFTER: - return eax_create_eax_frequency_shifter_effect(al_effect_props); + return eax_create_eax_frequency_shifter_effect(); case AL_EFFECT_VOCAL_MORPHER: - return eax_create_eax_vocal_morpher_effect(al_effect_props); + return eax_create_eax_vocal_morpher_effect(); case AL_EFFECT_PITCH_SHIFTER: - return eax_create_eax_pitch_shifter_effect(al_effect_props); + return eax_create_eax_pitch_shifter_effect(); case AL_EFFECT_RING_MODULATOR: - return eax_create_eax_ring_modulator_effect(al_effect_props); + return eax_create_eax_ring_modulator_effect(); case AL_EFFECT_AUTOWAH: - return eax_create_eax_auto_wah_effect(al_effect_props); + return eax_create_eax_auto_wah_effect(); case AL_EFFECT_COMPRESSOR: - return eax_create_eax_compressor_effect(al_effect_props); + return eax_create_eax_compressor_effect(); case AL_EFFECT_EQUALIZER: - return eax_create_eax_equalizer_effect(al_effect_props); + return eax_create_eax_equalizer_effect(); case AL_EFFECT_EAXREVERB: - return eax_create_eax_reverb_effect(al_effect_props); + return eax_create_eax_reverb_effect(); default: assert(false && "Unsupported AL effect type."); diff --git a/al/effects/effects.h b/al/effects/effects.h index a2ab8485..830e7191 100644 --- a/al/effects/effects.h +++ b/al/effects/effects.h @@ -86,9 +86,7 @@ extern const EffectVtable ConvolutionEffectVtable; #ifdef ALSOFT_EAX -EaxEffectUPtr eax_create_eax_effect( - ALenum al_effect_type, - EffectProps& al_effect_props); +EaxEffectUPtr eax_create_eax_effect(ALenum al_effect_type); #endif // ALSOFT_EAX #endif /* AL_EFFECTS_EFFECTS_H */ diff --git a/al/effects/equalizer.cpp b/al/effects/equalizer.cpp index 4ff26178..43597972 100644 --- a/al/effects/equalizer.cpp +++ b/al/effects/equalizer.cpp @@ -201,8 +201,7 @@ class EaxEqualizerEffect final : public EaxEffect { public: - EaxEqualizerEffect( - EffectProps& al_effect_props); + EaxEqualizerEffect(); // [[nodiscard]] @@ -211,8 +210,6 @@ public: private: - EffectProps& al_effect_props_; - EAXEQUALIZERPROPERTIES eax_{}; EAXEQUALIZERPROPERTIES eax_d_{}; EaxEqualizerEffectDirtyFlags eax_dirty_flags_{}; @@ -373,10 +370,8 @@ public: }; // EaxEqualizerEffectException -EaxEqualizerEffect::EaxEqualizerEffect( - EffectProps& al_effect_props) - : - al_effect_props_{al_effect_props} +EaxEqualizerEffect::EaxEqualizerEffect() + : EaxEffect{AL_EFFECT_EQUALIZER} { set_eax_defaults(); set_efx_defaults(); @@ -1021,10 +1016,9 @@ bool EaxEqualizerEffect::set( } // namespace -EaxEffectUPtr eax_create_eax_equalizer_effect( - EffectProps& al_effect_props) +EaxEffectUPtr eax_create_eax_equalizer_effect() { - return std::make_unique<EaxEqualizerEffect>(al_effect_props); + return std::make_unique<EaxEqualizerEffect>(); } #endif // ALSOFT_EAX diff --git a/al/effects/fshifter.cpp b/al/effects/fshifter.cpp index 74ef52d9..0100a864 100644 --- a/al/effects/fshifter.cpp +++ b/al/effects/fshifter.cpp @@ -157,8 +157,7 @@ class EaxFrequencyShifterEffect final : public EaxEffect { public: - EaxFrequencyShifterEffect( - EffectProps& al_effect_props); + EaxFrequencyShifterEffect(); // [[nodiscard]] @@ -167,8 +166,6 @@ public: private: - EffectProps& al_effect_props_; - EAXFREQUENCYSHIFTERPROPERTIES eax_{}; EAXFREQUENCYSHIFTERPROPERTIES eax_d_{}; EaxFrequencyShifterEffectDirtyFlags eax_dirty_flags_{}; @@ -252,10 +249,8 @@ public: }; // EaxFrequencyShifterEffectException -EaxFrequencyShifterEffect::EaxFrequencyShifterEffect( - EffectProps& al_effect_props) - : - al_effect_props_{al_effect_props} +EaxFrequencyShifterEffect::EaxFrequencyShifterEffect() + : EaxEffect{AL_EFFECT_FREQUENCY_SHIFTER} { set_eax_defaults(); set_efx_defaults(); @@ -530,10 +525,9 @@ bool EaxFrequencyShifterEffect::set( } // namespace -EaxEffectUPtr eax_create_eax_frequency_shifter_effect( - EffectProps& al_effect_props) +EaxEffectUPtr eax_create_eax_frequency_shifter_effect() { - return std::make_unique<EaxFrequencyShifterEffect>(al_effect_props); + return std::make_unique<EaxFrequencyShifterEffect>(); } #endif // ALSOFT_EAX diff --git a/al/effects/modulator.cpp b/al/effects/modulator.cpp index c33db8c3..ec7520e2 100644 --- a/al/effects/modulator.cpp +++ b/al/effects/modulator.cpp @@ -163,8 +163,7 @@ class EaxRingModulatorEffect final : public EaxEffect { public: - EaxRingModulatorEffect( - EffectProps& al_effect_props); + EaxRingModulatorEffect(); // [[nodiscard]] @@ -173,8 +172,6 @@ public: private: - EffectProps& al_effect_props_; - EAXRINGMODULATORPROPERTIES eax_{}; EAXRINGMODULATORPROPERTIES eax_d_{}; EaxRingModulatorEffectDirtyFlags eax_dirty_flags_{}; @@ -258,10 +255,8 @@ public: }; // EaxRingModulatorEffectException -EaxRingModulatorEffect::EaxRingModulatorEffect( - EffectProps& al_effect_props) - : - al_effect_props_{al_effect_props} +EaxRingModulatorEffect::EaxRingModulatorEffect() + : EaxEffect{AL_EFFECT_RING_MODULATOR} { set_eax_defaults(); set_efx_defaults(); @@ -533,10 +528,9 @@ bool EaxRingModulatorEffect::set( } // namespace -EaxEffectUPtr eax_create_eax_ring_modulator_effect( - EffectProps& al_effect_props) +EaxEffectUPtr eax_create_eax_ring_modulator_effect() { - return std::make_unique<EaxRingModulatorEffect>(al_effect_props); + return std::make_unique<EaxRingModulatorEffect>(); } #endif // ALSOFT_EAX diff --git a/al/effects/null.cpp b/al/effects/null.cpp index 8b68eec0..78c0a61a 100644 --- a/al/effects/null.cpp +++ b/al/effects/null.cpp @@ -104,6 +104,8 @@ class EaxNullEffect final : public EaxEffect { public: + EaxNullEffect(); + // [[nodiscard]] bool dispatch( const EaxEaxCall& eax_call) override; @@ -123,6 +125,11 @@ public: }; // EaxNullEffectException +EaxNullEffect::EaxNullEffect() + : EaxEffect{AL_EFFECT_NULL} +{ +} + // [[nodiscard]] bool EaxNullEffect::dispatch( const EaxEaxCall& eax_call) diff --git a/al/effects/pshifter.cpp b/al/effects/pshifter.cpp index 7c355be1..6c45ab4e 100644 --- a/al/effects/pshifter.cpp +++ b/al/effects/pshifter.cpp @@ -108,18 +108,13 @@ class EaxPitchShifterEffect final : public EaxEffect { public: - EaxPitchShifterEffect( - EffectProps& al_effect_props); - + EaxPitchShifterEffect(); // [[nodiscard]] bool dispatch( const EaxEaxCall& eax_call) override; - private: - EffectProps& al_effect_props_; - EAXPITCHSHIFTERPROPERTIES eax_{}; EAXPITCHSHIFTERPROPERTIES eax_d_{}; EaxPitchShifterEffectDirtyFlags eax_dirty_flags_{}; @@ -192,10 +187,8 @@ public: }; // EaxPitchShifterEffectException -EaxPitchShifterEffect::EaxPitchShifterEffect( - EffectProps& al_effect_props) - : - al_effect_props_{al_effect_props} +EaxPitchShifterEffect::EaxPitchShifterEffect() + : EaxEffect{AL_EFFECT_PITCH_SHIFTER} { set_eax_defaults(); set_efx_defaults(); @@ -408,10 +401,9 @@ bool EaxPitchShifterEffect::set( } // namespace -EaxEffectUPtr eax_create_eax_pitch_shifter_effect( - EffectProps& al_effect_props) +EaxEffectUPtr eax_create_eax_pitch_shifter_effect() { - return std::make_unique<EaxPitchShifterEffect>(al_effect_props); + return std::make_unique<EaxPitchShifterEffect>(); } #endif // ALSOFT_EAX diff --git a/al/effects/reverb.cpp b/al/effects/reverb.cpp index a8404f8b..ef23f869 100644 --- a/al/effects/reverb.cpp +++ b/al/effects/reverb.cpp @@ -604,18 +604,13 @@ class EaxReverbEffect final : public EaxEffect { public: - EaxReverbEffect( - EffectProps& al_effect_props); - + EaxReverbEffect(); // [[nodiscard]] bool dispatch( const EaxEaxCall& eax_call) override; - private: - EffectProps& al_effect_props_; - EAXREVERBPROPERTIES eax_{}; EAXREVERBPROPERTIES eax_d_{}; EaxReverbEffectDirtyFlags eax_dirty_flags_{}; @@ -941,10 +936,8 @@ public: }; // EaxReverbEffectException -EaxReverbEffect::EaxReverbEffect( - EffectProps& al_effect_props) - : - al_effect_props_{al_effect_props} +EaxReverbEffect::EaxReverbEffect() + : EaxEffect{AL_EFFECT_EAXREVERB} { set_eax_defaults(); set_efx_defaults(); @@ -2464,10 +2457,9 @@ bool EaxReverbEffect::set( } // namespace -EaxEffectUPtr eax_create_eax_reverb_effect( - EffectProps& al_effect_props) +EaxEffectUPtr eax_create_eax_reverb_effect() { - return std::make_unique<EaxReverbEffect>(al_effect_props); + return std::make_unique<EaxReverbEffect>(); } #endif // ALSOFT_EAX diff --git a/al/effects/vmorpher.cpp b/al/effects/vmorpher.cpp index 2ea2594e..3081201c 100644 --- a/al/effects/vmorpher.cpp +++ b/al/effects/vmorpher.cpp @@ -279,18 +279,13 @@ class EaxVocalMorpherEffect final : public EaxEffect { public: - EaxVocalMorpherEffect( - EffectProps& al_effect_props); - + EaxVocalMorpherEffect(); // [[nodiscard]] bool dispatch( const EaxEaxCall& eax_call) override; - private: - EffectProps& al_effect_props_; - EAXVOCALMORPHERPROPERTIES eax_{}; EAXVOCALMORPHERPROPERTIES eax_d_{}; EaxVocalMorpherEffectDirtyFlags eax_dirty_flags_{}; @@ -407,10 +402,8 @@ public: }; // EaxVocalMorpherEffectException -EaxVocalMorpherEffect::EaxVocalMorpherEffect( - EffectProps& al_effect_props) - : - al_effect_props_{al_effect_props} +EaxVocalMorpherEffect::EaxVocalMorpherEffect() + : EaxEffect{AL_EFFECT_VOCAL_MORPHER} { set_eax_defaults(); set_efx_defaults(); @@ -860,10 +853,9 @@ bool EaxVocalMorpherEffect::set( } // namespace -EaxEffectUPtr eax_create_eax_vocal_morpher_effect( - EffectProps& al_effect_props) +EaxEffectUPtr eax_create_eax_vocal_morpher_effect() { - return std::make_unique<EaxVocalMorpherEffect>(al_effect_props); + return std::make_unique<EaxVocalMorpherEffect>(); } #endif // ALSOFT_EAX |