diff options
-rw-r--r-- | al/eax/effect.h | 82 | ||||
-rw-r--r-- | al/effects/autowah.cpp | 64 | ||||
-rw-r--r-- | al/effects/chorus.cpp | 90 | ||||
-rw-r--r-- | al/effects/compressor.cpp | 34 | ||||
-rw-r--r-- | al/effects/distortion.cpp | 74 | ||||
-rw-r--r-- | al/effects/echo.cpp | 74 | ||||
-rw-r--r-- | al/effects/effects.cpp | 2 | ||||
-rw-r--r-- | al/effects/equalizer.cpp | 124 | ||||
-rw-r--r-- | al/effects/fshifter.cpp | 54 | ||||
-rw-r--r-- | al/effects/modulator.cpp | 54 | ||||
-rw-r--r-- | al/effects/null.cpp | 10 | ||||
-rw-r--r-- | al/effects/pshifter.cpp | 44 | ||||
-rw-r--r-- | al/effects/reverb.cpp | 172 | ||||
-rw-r--r-- | al/effects/vmorpher.cpp | 84 |
14 files changed, 491 insertions, 471 deletions
diff --git a/al/eax/effect.h b/al/eax/effect.h index f09a2520..2514e79d 100644 --- a/al/eax/effect.h +++ b/al/eax/effect.h @@ -16,14 +16,65 @@ struct EaxEffectErrorMessages static constexpr auto unknown_version() noexcept { return "Unknown version."; } }; // EaxEffectErrorMessages +union EaxEffectProps { + EAXREVERBPROPERTIES mReverb; + EAXCHORUSPROPERTIES mChorus; + EAXAUTOWAHPROPERTIES mAutowah; + EAXAGCCOMPRESSORPROPERTIES mCompressor; + EAXDISTORTIONPROPERTIES mDistortion; + EAXECHOPROPERTIES mEcho; + EAXEQUALIZERPROPERTIES mEqualizer; + EAXFLANGERPROPERTIES mFlanger; + EAXFREQUENCYSHIFTERPROPERTIES mFrequencyShifter; + EAXRINGMODULATORPROPERTIES mModulator; + EAXPITCHSHIFTERPROPERTIES mPitchShifter; + EAXVOCALMORPHERPROPERTIES mVocalMorpher; +}; + class EaxEffect { public: - EaxEffect(ALenum type) noexcept : al_effect_type_{type} { } + EaxEffect(ALenum type, int eax_version) noexcept + : al_effect_type_{type}, version_{eax_version} + { } virtual ~EaxEffect() = default; const ALenum al_effect_type_; EffectProps al_effect_props_{}; + using Props1 = EAX_REVERBPROPERTIES; + using Props2 = EAX20LISTENERPROPERTIES; + using Props3 = EAXREVERBPROPERTIES; + using Props4 = EaxEffectProps; + + struct State1 { + Props1 i; // Immediate. + Props1 d; // Deferred. + }; + + struct State2 { + Props2 i; // Immediate. + Props2 d; // Deferred. + }; + + struct State3 { + Props3 i; // Immediate. + Props3 d; // Deferred. + }; + + struct State4 { + Props4 i; // Immediate. + Props4 d; // Deferred. + }; + + int version_; + bool changed_{}; + Props4 props_{}; + State1 state1_{}; + State2 state2_{}; + State3 state3_{}; + State4 state4_{}; + State4 state5_{}; + virtual void dispatch(const EaxCall& call) = 0; // Returns "true" if any immediated property was changed. @@ -31,13 +82,13 @@ public: }; // EaxEffect // Base class for EAX4+ effects. -template<typename TException, typename TProps> +template<typename TException> class EaxEffect4 : public EaxEffect { public: EaxEffect4(ALenum type, int eax_version) - : EaxEffect{type}, version_{clamp(eax_version, 4, 5)} - {} + : EaxEffect{type, clamp(eax_version, 4, 5)} + { } void initialize() { @@ -63,17 +114,6 @@ public: protected: using Exception = TException; - using Props = TProps; - - struct State { - Props i; // Immediate. - Props d; // Deferred. - }; // State - - int version_{}; - Props props_{}; - State state4_{}; - State state5_{}; template<typename TValidator, typename TProperty> static void defer(const EaxCall& call, TProperty& property) @@ -83,13 +123,13 @@ protected: property = value; } - virtual void set_defaults(Props& props) = 0; + virtual void set_defaults(Props4& props) = 0; virtual void set_efx_defaults() = 0; - virtual void get(const EaxCall& call, const Props& props) = 0; - virtual void set(const EaxCall& call, Props& props) = 0; + virtual void get(const EaxCall& call, const Props4& props) = 0; + virtual void set(const EaxCall& call, Props4& props) = 0; - virtual bool commit_props(const Props& props) = 0; + virtual bool commit_props(const Props4& props) = 0; [[noreturn]] static void fail(const char* message) { @@ -136,7 +176,7 @@ private: } } - bool commit_state(State& state) + bool commit_state(State4& state) { const auto props = props_; state.i = state.d; @@ -156,7 +196,7 @@ EaxEffectUPtr eax_create_eax4_effect(int eax_version) return effect; } -EaxEffectUPtr eax_create_eax_null_effect(); +EaxEffectUPtr eax_create_eax_null_effect(int eax_version); EaxEffectUPtr eax_create_eax_chorus_effect(int eax_version); EaxEffectUPtr eax_create_eax_distortion_effect(int eax_version); EaxEffectUPtr eax_create_eax_echo_effect(int eax_version); diff --git a/al/effects/autowah.cpp b/al/effects/autowah.cpp index 3400f5a4..7b467e78 100644 --- a/al/effects/autowah.cpp +++ b/al/effects/autowah.cpp @@ -125,7 +125,7 @@ public: {} }; // EaxAutoWahEffectException -class EaxAutoWahEffect final : public EaxEffect4<EaxAutoWahEffectException, EAXAUTOWAHPROPERTIES> { +class EaxAutoWahEffect final : public EaxEffect4<EaxAutoWahEffectException> { public: EaxAutoWahEffect(int eax_version); @@ -175,7 +175,7 @@ private: }; // PeakLevelValidator struct AllValidator { - void operator()(const Props& all) const + void operator()(const EAXAUTOWAHPROPERTIES& all) const { AttackTimeValidator{}(all.flAttackTime); ReleaseTimeValidator{}(all.flReleaseTime); @@ -184,7 +184,7 @@ private: } }; // AllValidator - void set_defaults(Props& props) override; + void set_defaults(Props4& props) override; void set_efx_attack_time() noexcept; void set_efx_release_time() noexcept; @@ -192,27 +192,27 @@ private: void set_efx_peak_gain() noexcept; void set_efx_defaults() override; - void get(const EaxCall& call, const Props& props) override; - void set(const EaxCall& call, Props& props) override; - bool commit_props(const Props& props) override; + void get(const EaxCall& call, const Props4& props) override; + void set(const EaxCall& call, Props4& props) override; + bool commit_props(const Props4& props) override; }; // EaxAutoWahEffect EaxAutoWahEffect::EaxAutoWahEffect(int eax_version) : EaxEffect4{AL_EFFECT_AUTOWAH, eax_version} {} -void EaxAutoWahEffect::set_defaults(Props& props) +void EaxAutoWahEffect::set_defaults(Props4& props) { - props.flAttackTime = EAXAUTOWAH_DEFAULTATTACKTIME; - props.flReleaseTime = EAXAUTOWAH_DEFAULTRELEASETIME; - props.lResonance = EAXAUTOWAH_DEFAULTRESONANCE; - props.lPeakLevel = EAXAUTOWAH_DEFAULTPEAKLEVEL; + props.mAutowah.flAttackTime = EAXAUTOWAH_DEFAULTATTACKTIME; + props.mAutowah.flReleaseTime = EAXAUTOWAH_DEFAULTRELEASETIME; + props.mAutowah.lResonance = EAXAUTOWAH_DEFAULTRESONANCE; + props.mAutowah.lPeakLevel = EAXAUTOWAH_DEFAULTPEAKLEVEL; } void EaxAutoWahEffect::set_efx_attack_time() noexcept { al_effect_props_.Autowah.AttackTime = clamp( - props_.flAttackTime, + props_.mAutowah.flAttackTime, AL_AUTOWAH_MIN_ATTACK_TIME, AL_AUTOWAH_MAX_ATTACK_TIME); } @@ -220,7 +220,7 @@ void EaxAutoWahEffect::set_efx_attack_time() noexcept void EaxAutoWahEffect::set_efx_release_time() noexcept { al_effect_props_.Autowah.ReleaseTime = clamp( - props_.flReleaseTime, + props_.mAutowah.flReleaseTime, AL_AUTOWAH_MIN_RELEASE_TIME, AL_AUTOWAH_MAX_RELEASE_TIME); } @@ -228,7 +228,7 @@ void EaxAutoWahEffect::set_efx_release_time() noexcept void EaxAutoWahEffect::set_efx_resonance() noexcept { al_effect_props_.Autowah.Resonance = clamp( - level_mb_to_gain(static_cast<float>(props_.lResonance)), + level_mb_to_gain(static_cast<float>(props_.mAutowah.lResonance)), AL_AUTOWAH_MIN_RESONANCE, AL_AUTOWAH_MAX_RESONANCE); } @@ -236,7 +236,7 @@ void EaxAutoWahEffect::set_efx_resonance() noexcept void EaxAutoWahEffect::set_efx_peak_gain() noexcept { al_effect_props_.Autowah.PeakGain = clamp( - level_mb_to_gain(static_cast<float>(props_.lPeakLevel)), + level_mb_to_gain(static_cast<float>(props_.mAutowah.lPeakLevel)), AL_AUTOWAH_MIN_PEAK_GAIN, AL_AUTOWAH_MAX_PEAK_GAIN); } @@ -249,57 +249,57 @@ void EaxAutoWahEffect::set_efx_defaults() set_efx_peak_gain(); } -void EaxAutoWahEffect::get(const EaxCall& call, const Props& props) +void EaxAutoWahEffect::get(const EaxCall& call, const Props4& props) { switch (call.get_property_id()) { case EAXAUTOWAH_NONE: break; - case EAXAUTOWAH_ALLPARAMETERS: call.set_value<Exception>(props); break; - case EAXAUTOWAH_ATTACKTIME: call.set_value<Exception>(props.flAttackTime); break; - case EAXAUTOWAH_RELEASETIME: call.set_value<Exception>(props.flReleaseTime); break; - case EAXAUTOWAH_RESONANCE: call.set_value<Exception>(props.lResonance); break; - case EAXAUTOWAH_PEAKLEVEL: call.set_value<Exception>(props.lPeakLevel); break; + case EAXAUTOWAH_ALLPARAMETERS: call.set_value<Exception>(props.mAutowah); break; + case EAXAUTOWAH_ATTACKTIME: call.set_value<Exception>(props.mAutowah.flAttackTime); break; + case EAXAUTOWAH_RELEASETIME: call.set_value<Exception>(props.mAutowah.flReleaseTime); break; + case EAXAUTOWAH_RESONANCE: call.set_value<Exception>(props.mAutowah.lResonance); break; + case EAXAUTOWAH_PEAKLEVEL: call.set_value<Exception>(props.mAutowah.lPeakLevel); break; default: fail_unknown_property_id(); } } -void EaxAutoWahEffect::set(const EaxCall& call, Props& props) +void EaxAutoWahEffect::set(const EaxCall& call, Props4& props) { switch (call.get_property_id()) { case EAXAUTOWAH_NONE: break; - case EAXAUTOWAH_ALLPARAMETERS: defer<AllValidator>(call, props); break; - case EAXAUTOWAH_ATTACKTIME: defer<AttackTimeValidator>(call, props.flAttackTime); break; - case EAXAUTOWAH_RELEASETIME: defer<ReleaseTimeValidator>(call, props.flReleaseTime); break; - case EAXAUTOWAH_RESONANCE: defer<ResonanceValidator>(call, props.lResonance); break; - case EAXAUTOWAH_PEAKLEVEL: defer<PeakLevelValidator>(call, props.lPeakLevel); break; + case EAXAUTOWAH_ALLPARAMETERS: defer<AllValidator>(call, props.mAutowah); break; + case EAXAUTOWAH_ATTACKTIME: defer<AttackTimeValidator>(call, props.mAutowah.flAttackTime); break; + case EAXAUTOWAH_RELEASETIME: defer<ReleaseTimeValidator>(call, props.mAutowah.flReleaseTime); break; + case EAXAUTOWAH_RESONANCE: defer<ResonanceValidator>(call, props.mAutowah.lResonance); break; + case EAXAUTOWAH_PEAKLEVEL: defer<PeakLevelValidator>(call, props.mAutowah.lPeakLevel); break; default: fail_unknown_property_id(); } } -bool EaxAutoWahEffect::commit_props(const Props& props) +bool EaxAutoWahEffect::commit_props(const Props4& props) { auto is_dirty = false; - if (props_.flAttackTime != props.flAttackTime) + if (props_.mAutowah.flAttackTime != props.mAutowah.flAttackTime) { is_dirty = true; set_efx_attack_time(); } - if (props_.flReleaseTime != props.flReleaseTime) + if (props_.mAutowah.flReleaseTime != props.mAutowah.flReleaseTime) { is_dirty = true; set_efx_release_time(); } - if (props_.lResonance != props.lResonance) + if (props_.mAutowah.lResonance != props.mAutowah.lResonance) { is_dirty = true; set_efx_resonance(); } - if (props_.lPeakLevel != props.lPeakLevel) + if (props_.mAutowah.lPeakLevel != props.mAutowah.lPeakLevel) { is_dirty = true; set_efx_peak_gain(); diff --git a/al/effects/chorus.cpp b/al/effects/chorus.cpp index eec67d46..9fc5a44e 100644 --- a/al/effects/chorus.cpp +++ b/al/effects/chorus.cpp @@ -309,6 +309,7 @@ struct EaxChorusTraits { using Exception = EaxChorusEffectException; using Props = EAXCHORUSPROPERTIES; + static constexpr auto Field = &EaxEffectProps::mChorus; static constexpr auto efx_effect() { return AL_EFFECT_CHORUS; } @@ -368,6 +369,7 @@ struct EaxFlangerTraits { using Exception = EaxFlangerEffectException; using Props = EAXFLANGERPROPERTIES; + static constexpr auto Field = &EaxEffectProps::mFlanger; static constexpr auto efx_effect() { return AL_EFFECT_FLANGER; } @@ -424,15 +426,16 @@ struct EaxFlangerTraits }; // EaxFlangerTraits template<typename TTraits> -class EaxChorusFlangerEffect final : public EaxEffect4<typename TTraits::Exception, typename TTraits::Props> { +class EaxChorusFlangerEffect final : public EaxEffect4<typename TTraits::Exception> { public: using Traits = TTraits; - using Base = EaxEffect4<typename Traits::Exception, typename Traits::Props>; + using Base = EaxEffect4<typename Traits::Exception>; using typename Base::Exception; - using typename Base::Props; - using typename Base::State; + using typename Base::Props4; using Base::defer; + static constexpr auto Field = Traits::Field; + EaxChorusFlangerEffect(int eax_version) : Base{Traits::efx_effect(), eax_version} {} @@ -505,7 +508,7 @@ private: }; // DelayValidator struct AllValidator { - void operator()(const Props& all) const + void operator()(const typename Traits::Props& all) const { WaveformValidator{}(all.ulWaveform); PhaseValidator{}(all.lPhase); @@ -516,20 +519,21 @@ private: } }; // AllValidator - void set_defaults(Props& props) override + void set_defaults(Props4& props) override { - props.ulWaveform = Traits::eax_default_waveform(); - props.lPhase = Traits::eax_default_phase(); - props.flRate = Traits::eax_default_rate(); - props.flDepth = Traits::eax_default_depth(); - props.flFeedback = Traits::eax_default_feedback(); - props.flDelay = Traits::eax_default_delay(); + auto&& all = props.*Field; + all.ulWaveform = Traits::eax_default_waveform(); + all.lPhase = Traits::eax_default_phase(); + all.flRate = Traits::eax_default_rate(); + all.flDepth = Traits::eax_default_depth(); + all.flFeedback = Traits::eax_default_feedback(); + all.flDelay = Traits::eax_default_delay(); } void set_efx_waveform() { const auto waveform = clamp( - static_cast<ALint>(Base::props_.ulWaveform), + static_cast<ALint>((Base::props_.*Field).ulWaveform), Traits::efx_min_waveform(), Traits::efx_max_waveform()); const auto efx_waveform = WaveformFromEnum(waveform); @@ -540,7 +544,7 @@ private: void set_efx_phase() noexcept { Base::al_effect_props_.Chorus.Phase = clamp( - static_cast<ALint>(Base::props_.lPhase), + static_cast<ALint>((Base::props_.*Field).lPhase), Traits::efx_min_phase(), Traits::efx_max_phase()); } @@ -548,7 +552,7 @@ private: void set_efx_rate() noexcept { Base::al_effect_props_.Chorus.Rate = clamp( - Base::props_.flRate, + (Base::props_.*Field).flRate, Traits::efx_min_rate(), Traits::efx_max_rate()); } @@ -556,7 +560,7 @@ private: void set_efx_depth() noexcept { Base::al_effect_props_.Chorus.Depth = clamp( - Base::props_.flDepth, + (Base::props_.*Field).flDepth, Traits::efx_min_depth(), Traits::efx_max_depth()); } @@ -564,7 +568,7 @@ private: void set_efx_feedback() noexcept { Base::al_effect_props_.Chorus.Feedback = clamp( - Base::props_.flFeedback, + (Base::props_.*Field).flFeedback, Traits::efx_min_feedback(), Traits::efx_max_feedback()); } @@ -572,7 +576,7 @@ private: void set_efx_delay() noexcept { Base::al_effect_props_.Chorus.Delay = clamp( - Base::props_.flDelay, + (Base::props_.*Field).flDelay, Traits::efx_min_delay(), Traits::efx_max_delay()); } @@ -587,39 +591,40 @@ private: set_efx_delay(); } - void get(const EaxCall& call, const Props& props) override + void get(const EaxCall& call, const Props4& props) override { + auto&& all = props.*Field; switch(call.get_property_id()) { case Traits::eax_none_param_id(): break; case Traits::eax_allparameters_param_id(): - call.template set_value<Exception>(props); + call.template set_value<Exception>(all); break; case Traits::eax_waveform_param_id(): - call.template set_value<Exception>(props.ulWaveform); + call.template set_value<Exception>(all.ulWaveform); break; case Traits::eax_phase_param_id(): - call.template set_value<Exception>(props.lPhase); + call.template set_value<Exception>(all.lPhase); break; case Traits::eax_rate_param_id(): - call.template set_value<Exception>(props.flRate); + call.template set_value<Exception>(all.flRate); break; case Traits::eax_depth_param_id(): - call.template set_value<Exception>(props.flDepth); + call.template set_value<Exception>(all.flDepth); break; case Traits::eax_feedback_param_id(): - call.template set_value<Exception>(props.flFeedback); + call.template set_value<Exception>(all.flFeedback); break; case Traits::eax_delay_param_id(): - call.template set_value<Exception>(props.flDelay); + call.template set_value<Exception>(all.flDelay); break; default: @@ -627,39 +632,40 @@ private: } } - void set(const EaxCall& call, Props& props) override + void set(const EaxCall& call, Props4& props) override { + auto&& all = props.*Field; switch(call.get_property_id()) { case Traits::eax_none_param_id(): break; case Traits::eax_allparameters_param_id(): - Base::template defer<AllValidator>(call, props); + Base::template defer<AllValidator>(call, all); break; case Traits::eax_waveform_param_id(): - Base::template defer<WaveformValidator>(call, props.ulWaveform); + Base::template defer<WaveformValidator>(call, all.ulWaveform); break; case Traits::eax_phase_param_id(): - Base::template defer<PhaseValidator>(call, props.lPhase); + Base::template defer<PhaseValidator>(call, all.lPhase); break; case Traits::eax_rate_param_id(): - Base::template defer<RateValidator>(call, props.flRate); + Base::template defer<RateValidator>(call, all.flRate); break; case Traits::eax_depth_param_id(): - Base::template defer<DepthValidator>(call, props.flDepth); + Base::template defer<DepthValidator>(call, all.flDepth); break; case Traits::eax_feedback_param_id(): - Base::template defer<FeedbackValidator>(call, props.flFeedback); + Base::template defer<FeedbackValidator>(call, all.flFeedback); break; case Traits::eax_delay_param_id(): - Base::template defer<DelayValidator>(call, props.flDelay); + Base::template defer<DelayValidator>(call, all.flDelay); break; default: @@ -667,41 +673,43 @@ private: } } - bool commit_props(const Props& props) override + bool commit_props(const Props4& props) override { auto is_dirty = false; + auto&& src = props.*Field; + auto&& dst = Base::props_.*Field; - if (Base::props_.ulWaveform != props.ulWaveform) + if (dst.ulWaveform != src.ulWaveform) { is_dirty = true; set_efx_waveform(); } - if (Base::props_.lPhase != props.lPhase) + if (dst.lPhase != src.lPhase) { is_dirty = true; set_efx_phase(); } - if (Base::props_.flRate != props.flRate) + if (dst.flRate != src.flRate) { is_dirty = true; set_efx_rate(); } - if (Base::props_.flDepth != props.flDepth) + if (dst.flDepth != src.flDepth) { is_dirty = true; set_efx_depth(); } - if (Base::props_.flFeedback != props.flFeedback) + if (dst.flFeedback != src.flFeedback) { is_dirty = true; set_efx_feedback(); } - if (Base::props_.flDelay != props.flDelay) + if (dst.flDelay != src.flDelay) { is_dirty = true; set_efx_delay(); diff --git a/al/effects/compressor.cpp b/al/effects/compressor.cpp index df318709..38dca247 100644 --- a/al/effects/compressor.cpp +++ b/al/effects/compressor.cpp @@ -88,7 +88,7 @@ public: {} }; // EaxCompressorEffectException -class EaxCompressorEffect final : public EaxEffect4<EaxCompressorEffectException, EAXAGCCOMPRESSORPROPERTIES> +class EaxCompressorEffect final : public EaxEffect4<EaxCompressorEffectException> { public: EaxCompressorEffect(int eax_version); @@ -106,35 +106,35 @@ private: }; // OnOffValidator struct AllValidator { - void operator()(const Props& all) const + void operator()(const EAXAGCCOMPRESSORPROPERTIES& all) const { OnOffValidator{}(all.ulOnOff); } }; // AllValidator - void set_defaults(Props& props) override; + void set_defaults(Props4& props) override; void set_efx_on_off() noexcept; void set_efx_defaults() override; - void get(const EaxCall& call, const Props& props) override; - void set(const EaxCall& call, Props& props) override; - bool commit_props(const Props& props) override; + void get(const EaxCall& call, const Props4& props) override; + void set(const EaxCall& call, Props4& props) override; + bool commit_props(const Props4& props) override; }; // EaxCompressorEffect EaxCompressorEffect::EaxCompressorEffect(int eax_version) : EaxEffect4{AL_EFFECT_COMPRESSOR, eax_version} {} -void EaxCompressorEffect::set_defaults(Props& props) +void EaxCompressorEffect::set_defaults(Props4& props) { - props.ulOnOff = EAXAGCCOMPRESSOR_DEFAULTONOFF; + props.mCompressor.ulOnOff = EAXAGCCOMPRESSOR_DEFAULTONOFF; } void EaxCompressorEffect::set_efx_on_off() noexcept { const auto on_off = clamp( - static_cast<ALint>(props_.ulOnOff), + static_cast<ALint>(props_.mCompressor.ulOnOff), AL_COMPRESSOR_MIN_ONOFF, AL_COMPRESSOR_MAX_ONOFF); al_effect_props_.Compressor.OnOff = (on_off != AL_FALSE); @@ -145,33 +145,33 @@ void EaxCompressorEffect::set_efx_defaults() set_efx_on_off(); } -void EaxCompressorEffect::get(const EaxCall& call, const Props& props) +void EaxCompressorEffect::get(const EaxCall& call, const Props4& props) { switch(call.get_property_id()) { case EAXAGCCOMPRESSOR_NONE: break; - case EAXAGCCOMPRESSOR_ALLPARAMETERS: call.set_value<Exception>(props); break; - case EAXAGCCOMPRESSOR_ONOFF: call.set_value<Exception>(props.ulOnOff); break; + case EAXAGCCOMPRESSOR_ALLPARAMETERS: call.set_value<Exception>(props.mCompressor); break; + case EAXAGCCOMPRESSOR_ONOFF: call.set_value<Exception>(props.mCompressor.ulOnOff); break; default: fail_unknown_property_id(); } } -void EaxCompressorEffect::set(const EaxCall& call, Props& props) +void EaxCompressorEffect::set(const EaxCall& call, Props4& props) { switch(call.get_property_id()) { case EAXAGCCOMPRESSOR_NONE: break; - case EAXAGCCOMPRESSOR_ALLPARAMETERS: defer<AllValidator>(call, props); break; - case EAXAGCCOMPRESSOR_ONOFF: defer<OnOffValidator>(call, props.ulOnOff); break; + case EAXAGCCOMPRESSOR_ALLPARAMETERS: defer<AllValidator>(call, props.mCompressor); break; + case EAXAGCCOMPRESSOR_ONOFF: defer<OnOffValidator>(call, props.mCompressor.ulOnOff); break; default: fail_unknown_property_id(); } } -bool EaxCompressorEffect::commit_props(const Props& props) +bool EaxCompressorEffect::commit_props(const Props4& props) { auto is_dirty = false; - if (props_.ulOnOff != props.ulOnOff) + if (props_.mCompressor.ulOnOff != props.mCompressor.ulOnOff) { is_dirty = true; set_efx_on_off(); diff --git a/al/effects/distortion.cpp b/al/effects/distortion.cpp index 80e5f46d..f6f94775 100644 --- a/al/effects/distortion.cpp +++ b/al/effects/distortion.cpp @@ -130,7 +130,7 @@ public: {} }; // EaxDistortionEffectException -class EaxDistortionEffect final : public EaxEffect4<EaxDistortionEffectException, EAXDISTORTIONPROPERTIES> +class EaxDistortionEffect final : public EaxEffect4<EaxDistortionEffectException> { public: EaxDistortionEffect(int eax_version); @@ -192,7 +192,7 @@ private: }; // EqBandwidthValidator struct AllValidator { - void operator()(const Props& all) const + void operator()(const EAXDISTORTIONPROPERTIES& all) const { EdgeValidator{}(all.flEdge); GainValidator{}(all.lGain); @@ -202,7 +202,7 @@ private: } }; // AllValidator - void set_defaults(Props& props) override; + void set_defaults(Props4& props) override; void set_efx_edge() noexcept; void set_efx_gain() noexcept; @@ -211,28 +211,28 @@ private: void set_efx_eq_bandwidth() noexcept; void set_efx_defaults() override; - void get(const EaxCall& call, const Props& props) override; - void set(const EaxCall& call, Props& props) override; - bool commit_props(const Props& props) override; + void get(const EaxCall& call, const Props4& props) override; + void set(const EaxCall& call, Props4& props) override; + bool commit_props(const Props4& props) override; }; // EaxDistortionEffect EaxDistortionEffect::EaxDistortionEffect(int eax_version) : EaxEffect4{AL_EFFECT_DISTORTION, eax_version} {} -void EaxDistortionEffect::set_defaults(Props& props) +void EaxDistortionEffect::set_defaults(Props4& props) { - props.flEdge = EAXDISTORTION_DEFAULTEDGE; - props.lGain = EAXDISTORTION_DEFAULTGAIN; - props.flLowPassCutOff = EAXDISTORTION_DEFAULTLOWPASSCUTOFF; - props.flEQCenter = EAXDISTORTION_DEFAULTEQCENTER; - props.flEQBandwidth = EAXDISTORTION_DEFAULTEQBANDWIDTH; + props.mDistortion.flEdge = EAXDISTORTION_DEFAULTEDGE; + props.mDistortion.lGain = EAXDISTORTION_DEFAULTGAIN; + props.mDistortion.flLowPassCutOff = EAXDISTORTION_DEFAULTLOWPASSCUTOFF; + props.mDistortion.flEQCenter = EAXDISTORTION_DEFAULTEQCENTER; + props.mDistortion.flEQBandwidth = EAXDISTORTION_DEFAULTEQBANDWIDTH; } void EaxDistortionEffect::set_efx_edge() noexcept { al_effect_props_.Distortion.Edge = clamp( - props_.flEdge, + props_.mDistortion.flEdge, AL_DISTORTION_MIN_EDGE, AL_DISTORTION_MAX_EDGE); } @@ -240,7 +240,7 @@ void EaxDistortionEffect::set_efx_edge() noexcept void EaxDistortionEffect::set_efx_gain() noexcept { al_effect_props_.Distortion.Gain = clamp( - level_mb_to_gain(static_cast<float>(props_.lGain)), + level_mb_to_gain(static_cast<float>(props_.mDistortion.lGain)), AL_DISTORTION_MIN_GAIN, AL_DISTORTION_MAX_GAIN); } @@ -248,7 +248,7 @@ void EaxDistortionEffect::set_efx_gain() noexcept void EaxDistortionEffect::set_efx_lowpass_cutoff() noexcept { al_effect_props_.Distortion.LowpassCutoff = clamp( - props_.flLowPassCutOff, + props_.mDistortion.flLowPassCutOff, AL_DISTORTION_MIN_LOWPASS_CUTOFF, AL_DISTORTION_MAX_LOWPASS_CUTOFF); } @@ -256,7 +256,7 @@ void EaxDistortionEffect::set_efx_lowpass_cutoff() noexcept void EaxDistortionEffect::set_efx_eq_center() noexcept { al_effect_props_.Distortion.EQCenter = clamp( - props_.flEQCenter, + props_.mDistortion.flEQCenter, AL_DISTORTION_MIN_EQCENTER, AL_DISTORTION_MAX_EQCENTER); } @@ -264,7 +264,7 @@ void EaxDistortionEffect::set_efx_eq_center() noexcept void EaxDistortionEffect::set_efx_eq_bandwidth() noexcept { al_effect_props_.Distortion.EQBandwidth = clamp( - props_.flEdge, + props_.mDistortion.flEdge, AL_DISTORTION_MIN_EQBANDWIDTH, AL_DISTORTION_MAX_EQBANDWIDTH); } @@ -278,65 +278,65 @@ void EaxDistortionEffect::set_efx_defaults() set_efx_eq_bandwidth(); } -void EaxDistortionEffect::get(const EaxCall& call, const Props& props) +void EaxDistortionEffect::get(const EaxCall& call, const Props4& props) { switch(call.get_property_id()) { case EAXDISTORTION_NONE: break; - case EAXDISTORTION_ALLPARAMETERS: call.set_value<Exception>(props); break; - case EAXDISTORTION_EDGE: call.set_value<Exception>(props.flEdge); break; - case EAXDISTORTION_GAIN: call.set_value<Exception>(props.lGain); break; - case EAXDISTORTION_LOWPASSCUTOFF: call.set_value<Exception>(props.flLowPassCutOff); break; - case EAXDISTORTION_EQCENTER: call.set_value<Exception>(props.flEQCenter); break; - case EAXDISTORTION_EQBANDWIDTH: call.set_value<Exception>(props.flEQBandwidth); break; + case EAXDISTORTION_ALLPARAMETERS: call.set_value<Exception>(props.mDistortion); break; + case EAXDISTORTION_EDGE: call.set_value<Exception>(props.mDistortion.flEdge); break; + case EAXDISTORTION_GAIN: call.set_value<Exception>(props.mDistortion.lGain); break; + case EAXDISTORTION_LOWPASSCUTOFF: call.set_value<Exception>(props.mDistortion.flLowPassCutOff); break; + case EAXDISTORTION_EQCENTER: call.set_value<Exception>(props.mDistortion.flEQCenter); break; + case EAXDISTORTION_EQBANDWIDTH: call.set_value<Exception>(props.mDistortion.flEQBandwidth); break; default: fail_unknown_property_id(); } } -void EaxDistortionEffect::set(const EaxCall& call, Props& props) +void EaxDistortionEffect::set(const EaxCall& call, Props4& props) { switch(call.get_property_id()) { case EAXDISTORTION_NONE: break; - case EAXDISTORTION_ALLPARAMETERS: defer<AllValidator>(call, props); break; - case EAXDISTORTION_EDGE: defer<EdgeValidator>(call, props.flEdge); break; - case EAXDISTORTION_GAIN: defer<GainValidator>(call, props.lGain); break; - case EAXDISTORTION_LOWPASSCUTOFF: defer<LowPassCutOffValidator>(call, props.flLowPassCutOff); break; - case EAXDISTORTION_EQCENTER: defer<EqCenterValidator>(call, props.flEQCenter); break; - case EAXDISTORTION_EQBANDWIDTH: defer<EqBandwidthValidator>(call, props.flEQBandwidth); break; + case EAXDISTORTION_ALLPARAMETERS: defer<AllValidator>(call, props.mDistortion); break; + case EAXDISTORTION_EDGE: defer<EdgeValidator>(call, props.mDistortion.flEdge); break; + case EAXDISTORTION_GAIN: defer<GainValidator>(call, props.mDistortion.lGain); break; + case EAXDISTORTION_LOWPASSCUTOFF: defer<LowPassCutOffValidator>(call, props.mDistortion.flLowPassCutOff); break; + case EAXDISTORTION_EQCENTER: defer<EqCenterValidator>(call, props.mDistortion.flEQCenter); break; + case EAXDISTORTION_EQBANDWIDTH: defer<EqBandwidthValidator>(call, props.mDistortion.flEQBandwidth); break; default: fail_unknown_property_id(); } } -bool EaxDistortionEffect::commit_props(const Props& props) +bool EaxDistortionEffect::commit_props(const Props4& props) { auto is_dirty = false; - if (props_.flEdge != props.flEdge) + if (props_.mDistortion.flEdge != props.mDistortion.flEdge) { is_dirty = true; set_efx_edge(); } - if (props_.lGain != props.lGain) + if (props_.mDistortion.lGain != props.mDistortion.lGain) { is_dirty = true; set_efx_gain(); } - if (props_.flLowPassCutOff != props.flLowPassCutOff) + if (props_.mDistortion.flLowPassCutOff != props.mDistortion.flLowPassCutOff) { is_dirty = true; set_efx_lowpass_cutoff(); } - if (props_.flEQCenter != props.flEQCenter) + if (props_.mDistortion.flEQCenter != props.mDistortion.flEQCenter) { is_dirty = true; set_efx_eq_center(); } - if (props_.flEQBandwidth != props.flEQBandwidth) + if (props_.mDistortion.flEQBandwidth != props.mDistortion.flEQBandwidth) { is_dirty = true; set_efx_eq_bandwidth(); diff --git a/al/effects/echo.cpp b/al/effects/echo.cpp index c0968676..05218793 100644 --- a/al/effects/echo.cpp +++ b/al/effects/echo.cpp @@ -127,7 +127,7 @@ public: {} }; // EaxEchoEffectException -class EaxEchoEffect final : public EaxEffect4<EaxEchoEffectException, EAXECHOPROPERTIES> +class EaxEchoEffect final : public EaxEffect4<EaxEchoEffectException> { public: EaxEchoEffect(int eax_version); @@ -189,7 +189,7 @@ private: }; // SpreadValidator struct AllValidator { - void operator()(const Props& all) const + void operator()(const EAXECHOPROPERTIES& all) const { DelayValidator{}(all.flDelay); LrDelayValidator{}(all.flLRDelay); @@ -199,7 +199,7 @@ private: } }; // AllValidator - void set_defaults(Props& props) override; + void set_defaults(Props4& props) override; void set_efx_delay() noexcept; void set_efx_lr_delay() noexcept; @@ -208,28 +208,28 @@ private: void set_efx_spread() noexcept; void set_efx_defaults() override; - void get(const EaxCall& call, const Props& props) override; - void set(const EaxCall& call, Props& props) override; - bool commit_props(const Props& props) override; + void get(const EaxCall& call, const Props4& props) override; + void set(const EaxCall& call, Props4& props) override; + bool commit_props(const Props4& props) override; }; // EaxEchoEffect EaxEchoEffect::EaxEchoEffect(int eax_version) : EaxEffect4{AL_EFFECT_ECHO, eax_version} {} -void EaxEchoEffect::set_defaults(Props& props) +void EaxEchoEffect::set_defaults(Props4& props) { - props.flDelay = EAXECHO_DEFAULTDELAY; - props.flLRDelay = EAXECHO_DEFAULTLRDELAY; - props.flDamping = EAXECHO_DEFAULTDAMPING; - props.flFeedback = EAXECHO_DEFAULTFEEDBACK; - props.flSpread = EAXECHO_DEFAULTSPREAD; + props.mEcho.flDelay = EAXECHO_DEFAULTDELAY; + props.mEcho.flLRDelay = EAXECHO_DEFAULTLRDELAY; + props.mEcho.flDamping = EAXECHO_DEFAULTDAMPING; + props.mEcho.flFeedback = EAXECHO_DEFAULTFEEDBACK; + props.mEcho.flSpread = EAXECHO_DEFAULTSPREAD; } void EaxEchoEffect::set_efx_delay() noexcept { al_effect_props_.Echo.Delay = clamp( - props_.flDelay, + props_.mEcho.flDelay, AL_ECHO_MIN_DELAY, AL_ECHO_MAX_DELAY); } @@ -237,7 +237,7 @@ void EaxEchoEffect::set_efx_delay() noexcept void EaxEchoEffect::set_efx_lr_delay() noexcept { al_effect_props_.Echo.LRDelay = clamp( - props_.flLRDelay, + props_.mEcho.flLRDelay, AL_ECHO_MIN_LRDELAY, AL_ECHO_MAX_LRDELAY); } @@ -245,7 +245,7 @@ void EaxEchoEffect::set_efx_lr_delay() noexcept void EaxEchoEffect::set_efx_damping() noexcept { al_effect_props_.Echo.Damping = clamp( - props_.flDamping, + props_.mEcho.flDamping, AL_ECHO_MIN_DAMPING, AL_ECHO_MAX_DAMPING); } @@ -253,7 +253,7 @@ void EaxEchoEffect::set_efx_damping() noexcept void EaxEchoEffect::set_efx_feedback() noexcept { al_effect_props_.Echo.Feedback = clamp( - props_.flFeedback, + props_.mEcho.flFeedback, AL_ECHO_MIN_FEEDBACK, AL_ECHO_MAX_FEEDBACK); } @@ -261,7 +261,7 @@ void EaxEchoEffect::set_efx_feedback() noexcept void EaxEchoEffect::set_efx_spread() noexcept { al_effect_props_.Echo.Spread = clamp( - props_.flSpread, + props_.mEcho.flSpread, AL_ECHO_MIN_SPREAD, AL_ECHO_MAX_SPREAD); } @@ -275,65 +275,65 @@ void EaxEchoEffect::set_efx_defaults() set_efx_spread(); } -void EaxEchoEffect::get(const EaxCall& call, const Props& props) +void EaxEchoEffect::get(const EaxCall& call, const Props4& props) { switch(call.get_property_id()) { case EAXECHO_NONE: break; - case EAXECHO_ALLPARAMETERS: call.set_value<Exception>(props); break; - case EAXECHO_DELAY: call.set_value<Exception>(props.flDelay); break; - case EAXECHO_LRDELAY: call.set_value<Exception>(props.flLRDelay); break; - case EAXECHO_DAMPING: call.set_value<Exception>(props.flDamping); break; - case EAXECHO_FEEDBACK: call.set_value<Exception>(props.flFeedback); break; - case EAXECHO_SPREAD: call.set_value<Exception>(props.flSpread); break; + case EAXECHO_ALLPARAMETERS: call.set_value<Exception>(props.mEcho); break; + case EAXECHO_DELAY: call.set_value<Exception>(props.mEcho.flDelay); break; + case EAXECHO_LRDELAY: call.set_value<Exception>(props.mEcho.flLRDelay); break; + case EAXECHO_DAMPING: call.set_value<Exception>(props.mEcho.flDamping); break; + case EAXECHO_FEEDBACK: call.set_value<Exception>(props.mEcho.flFeedback); break; + case EAXECHO_SPREAD: call.set_value<Exception>(props.mEcho.flSpread); break; default: fail_unknown_property_id(); } } -void EaxEchoEffect::set(const EaxCall& call, Props& props) +void EaxEchoEffect::set(const EaxCall& call, Props4& props) { switch(call.get_property_id()) { case EAXECHO_NONE: break; - case EAXECHO_ALLPARAMETERS: defer<AllValidator>(call, props); break; - case EAXECHO_DELAY: defer<DelayValidator>(call, props.flDelay); break; - case EAXECHO_LRDELAY: defer<LrDelayValidator>(call, props.flLRDelay); break; - case EAXECHO_DAMPING: defer<DampingValidator>(call, props.flDamping); break; - case EAXECHO_FEEDBACK: defer<FeedbackValidator>(call, props.flFeedback); break; - case EAXECHO_SPREAD: defer<SpreadValidator>(call, props.flSpread); break; + case EAXECHO_ALLPARAMETERS: defer<AllValidator>(call, props.mEcho); break; + case EAXECHO_DELAY: defer<DelayValidator>(call, props.mEcho.flDelay); break; + case EAXECHO_LRDELAY: defer<LrDelayValidator>(call, props.mEcho.flLRDelay); break; + case EAXECHO_DAMPING: defer<DampingValidator>(call, props.mEcho.flDamping); break; + case EAXECHO_FEEDBACK: defer<FeedbackValidator>(call, props.mEcho.flFeedback); break; + case EAXECHO_SPREAD: defer<SpreadValidator>(call, props.mEcho.flSpread); break; default: fail_unknown_property_id(); } } -bool EaxEchoEffect::commit_props(const Props& props) +bool EaxEchoEffect::commit_props(const Props4& props) { auto is_dirty = false; - if (props_.flDelay != props.flDelay) + if (props_.mEcho.flDelay != props.mEcho.flDelay) { is_dirty = true; set_efx_delay(); } - if (props_.flLRDelay != props.flLRDelay) + if (props_.mEcho.flLRDelay != props.mEcho.flLRDelay) { is_dirty = true; set_efx_lr_delay(); } - if (props_.flDamping != props.flDamping) + if (props_.mEcho.flDamping != props.mEcho.flDamping) { is_dirty = true; set_efx_damping(); } - if (props_.flFeedback != props.flFeedback) + if (props_.mEcho.flFeedback != props.mEcho.flFeedback) { is_dirty = true; set_efx_feedback(); } - if (props_.flSpread != props.flSpread) + if (props_.mEcho.flSpread != props.mEcho.flSpread) { is_dirty = true; set_efx_spread(); diff --git a/al/effects/effects.cpp b/al/effects/effects.cpp index 7c8447e4..820f1517 100644 --- a/al/effects/effects.cpp +++ b/al/effects/effects.cpp @@ -13,7 +13,7 @@ EaxEffectUPtr eax_create_eax_effect(ALenum al_effect_type, int eax_version) switch (al_effect_type) { case AL_EFFECT_NULL: - return eax_create_eax_null_effect(); + return eax_create_eax_null_effect(eax_version); case AL_EFFECT_CHORUS: return eax_create_eax_chorus_effect(eax_version); diff --git a/al/effects/equalizer.cpp b/al/effects/equalizer.cpp index 0ee351f3..7134e188 100644 --- a/al/effects/equalizer.cpp +++ b/al/effects/equalizer.cpp @@ -185,7 +185,7 @@ public: {} }; // EaxEqualizerEffectException -class EaxEqualizerEffect final : public EaxEffect4<EaxEqualizerEffectException, EAXEQUALIZERPROPERTIES> +class EaxEqualizerEffect final : public EaxEffect4<EaxEqualizerEffectException> { public: EaxEqualizerEffect(int eax_version); @@ -302,7 +302,7 @@ private: }; // HighCutOffValidator struct AllValidator { - void operator()(const Props& all) const + void operator()(const EAXEQUALIZERPROPERTIES& all) const { LowGainValidator{}(all.lLowGain); LowCutOffValidator{}(all.flLowCutOff); @@ -317,7 +317,7 @@ private: } }; // AllValidator - void set_defaults(Props& props) override; + void set_defaults(Props4& props) override; void set_efx_low_gain() noexcept; void set_efx_low_cutoff() noexcept; @@ -331,33 +331,33 @@ private: void set_efx_high_cutoff() noexcept; void set_efx_defaults() override; - void get(const EaxCall& call, const Props& props) override; - void set(const EaxCall& call, Props& props) override; - bool commit_props(const Props& props) override; + void get(const EaxCall& call, const Props4& props) override; + void set(const EaxCall& call, Props4& props) override; + bool commit_props(const Props4& props) override; }; // EaxEqualizerEffect EaxEqualizerEffect::EaxEqualizerEffect(int eax_version) : EaxEffect4{AL_EFFECT_EQUALIZER, eax_version} {} -void EaxEqualizerEffect::set_defaults(Props& props) +void EaxEqualizerEffect::set_defaults(Props4& props) { - props.lLowGain = EAXEQUALIZER_DEFAULTLOWGAIN; - props.flLowCutOff = EAXEQUALIZER_DEFAULTLOWCUTOFF; - props.lMid1Gain = EAXEQUALIZER_DEFAULTMID1GAIN; - props.flMid1Center = EAXEQUALIZER_DEFAULTMID1CENTER; - props.flMid1Width = EAXEQUALIZER_DEFAULTMID1WIDTH; - props.lMid2Gain = EAXEQUALIZER_DEFAULTMID2GAIN; - props.flMid2Center = EAXEQUALIZER_DEFAULTMID2CENTER; - props.flMid2Width = EAXEQUALIZER_DEFAULTMID2WIDTH; - props.lHighGain = EAXEQUALIZER_DEFAULTHIGHGAIN; - props.flHighCutOff = EAXEQUALIZER_DEFAULTHIGHCUTOFF; + props.mEqualizer.lLowGain = EAXEQUALIZER_DEFAULTLOWGAIN; + props.mEqualizer.flLowCutOff = EAXEQUALIZER_DEFAULTLOWCUTOFF; + props.mEqualizer.lMid1Gain = EAXEQUALIZER_DEFAULTMID1GAIN; + props.mEqualizer.flMid1Center = EAXEQUALIZER_DEFAULTMID1CENTER; + props.mEqualizer.flMid1Width = EAXEQUALIZER_DEFAULTMID1WIDTH; + props.mEqualizer.lMid2Gain = EAXEQUALIZER_DEFAULTMID2GAIN; + props.mEqualizer.flMid2Center = EAXEQUALIZER_DEFAULTMID2CENTER; + props.mEqualizer.flMid2Width = EAXEQUALIZER_DEFAULTMID2WIDTH; + props.mEqualizer.lHighGain = EAXEQUALIZER_DEFAULTHIGHGAIN; + props.mEqualizer.flHighCutOff = EAXEQUALIZER_DEFAULTHIGHCUTOFF; } void EaxEqualizerEffect::set_efx_low_gain() noexcept { al_effect_props_.Equalizer.LowGain = clamp( - level_mb_to_gain(static_cast<float>(props_.lLowGain)), + level_mb_to_gain(static_cast<float>(props_.mEqualizer.lLowGain)), AL_EQUALIZER_MIN_LOW_GAIN, AL_EQUALIZER_MAX_LOW_GAIN); } @@ -365,7 +365,7 @@ void EaxEqualizerEffect::set_efx_low_gain() noexcept void EaxEqualizerEffect::set_efx_low_cutoff() noexcept { al_effect_props_.Equalizer.LowCutoff = clamp( - props_.flLowCutOff, + props_.mEqualizer.flLowCutOff, AL_EQUALIZER_MIN_LOW_CUTOFF, AL_EQUALIZER_MAX_LOW_CUTOFF); } @@ -373,7 +373,7 @@ void EaxEqualizerEffect::set_efx_low_cutoff() noexcept void EaxEqualizerEffect::set_efx_mid1_gain() noexcept { al_effect_props_.Equalizer.Mid1Gain = clamp( - level_mb_to_gain(static_cast<float>(props_.lMid1Gain)), + level_mb_to_gain(static_cast<float>(props_.mEqualizer.lMid1Gain)), AL_EQUALIZER_MIN_MID1_GAIN, AL_EQUALIZER_MAX_MID1_GAIN); } @@ -381,7 +381,7 @@ void EaxEqualizerEffect::set_efx_mid1_gain() noexcept void EaxEqualizerEffect::set_efx_mid1_center() noexcept { al_effect_props_.Equalizer.Mid1Center = clamp( - props_.flMid1Center, + props_.mEqualizer.flMid1Center, AL_EQUALIZER_MIN_MID1_CENTER, AL_EQUALIZER_MAX_MID1_CENTER); } @@ -389,7 +389,7 @@ void EaxEqualizerEffect::set_efx_mid1_center() noexcept void EaxEqualizerEffect::set_efx_mid1_width() noexcept { al_effect_props_.Equalizer.Mid1Width = clamp( - props_.flMid1Width, + props_.mEqualizer.flMid1Width, AL_EQUALIZER_MIN_MID1_WIDTH, AL_EQUALIZER_MAX_MID1_WIDTH); } @@ -397,7 +397,7 @@ void EaxEqualizerEffect::set_efx_mid1_width() noexcept void EaxEqualizerEffect::set_efx_mid2_gain() noexcept { al_effect_props_.Equalizer.Mid2Gain = clamp( - level_mb_to_gain(static_cast<float>(props_.lMid2Gain)), + level_mb_to_gain(static_cast<float>(props_.mEqualizer.lMid2Gain)), AL_EQUALIZER_MIN_MID2_GAIN, AL_EQUALIZER_MAX_MID2_GAIN); } @@ -405,7 +405,7 @@ void EaxEqualizerEffect::set_efx_mid2_gain() noexcept void EaxEqualizerEffect::set_efx_mid2_center() noexcept { al_effect_props_.Equalizer.Mid2Center = clamp( - props_.flMid2Center, + props_.mEqualizer.flMid2Center, AL_EQUALIZER_MIN_MID2_CENTER, AL_EQUALIZER_MAX_MID2_CENTER); } @@ -413,7 +413,7 @@ void EaxEqualizerEffect::set_efx_mid2_center() noexcept void EaxEqualizerEffect::set_efx_mid2_width() noexcept { al_effect_props_.Equalizer.Mid2Width = clamp( - props_.flMid2Width, + props_.mEqualizer.flMid2Width, AL_EQUALIZER_MIN_MID2_WIDTH, AL_EQUALIZER_MAX_MID2_WIDTH); } @@ -421,7 +421,7 @@ void EaxEqualizerEffect::set_efx_mid2_width() noexcept void EaxEqualizerEffect::set_efx_high_gain() noexcept { al_effect_props_.Equalizer.HighGain = clamp( - level_mb_to_gain(static_cast<float>(props_.lHighGain)), + level_mb_to_gain(static_cast<float>(props_.mEqualizer.lHighGain)), AL_EQUALIZER_MIN_HIGH_GAIN, AL_EQUALIZER_MAX_HIGH_GAIN); } @@ -429,7 +429,7 @@ void EaxEqualizerEffect::set_efx_high_gain() noexcept void EaxEqualizerEffect::set_efx_high_cutoff() noexcept { al_effect_props_.Equalizer.HighCutoff = clamp( - props_.flHighCutOff, + props_.mEqualizer.flHighCutOff, AL_EQUALIZER_MIN_HIGH_CUTOFF, AL_EQUALIZER_MAX_HIGH_CUTOFF); } @@ -448,105 +448,105 @@ void EaxEqualizerEffect::set_efx_defaults() set_efx_high_cutoff(); } -void EaxEqualizerEffect::get(const EaxCall& call, const Props& props) +void EaxEqualizerEffect::get(const EaxCall& call, const Props4& props) { switch(call.get_property_id()) { case EAXEQUALIZER_NONE: break; - case EAXEQUALIZER_ALLPARAMETERS: call.set_value<Exception>(props); break; - case EAXEQUALIZER_LOWGAIN: call.set_value<Exception>(props.lLowGain); break; - case EAXEQUALIZER_LOWCUTOFF: call.set_value<Exception>(props.flLowCutOff); break; - case EAXEQUALIZER_MID1GAIN: call.set_value<Exception>(props.lMid1Gain); break; - case EAXEQUALIZER_MID1CENTER: call.set_value<Exception>(props.flMid1Center); break; - case EAXEQUALIZER_MID1WIDTH: call.set_value<Exception>(props.flMid1Width); break; - case EAXEQUALIZER_MID2GAIN: call.set_value<Exception>(props.lMid2Gain); break; - case EAXEQUALIZER_MID2CENTER: call.set_value<Exception>(props.flMid2Center); break; - case EAXEQUALIZER_MID2WIDTH: call.set_value<Exception>(props.flMid2Width); break; - case EAXEQUALIZER_HIGHGAIN: call.set_value<Exception>(props.lHighGain); break; - case EAXEQUALIZER_HIGHCUTOFF: call.set_value<Exception>(props.flHighCutOff); break; + case EAXEQUALIZER_ALLPARAMETERS: call.set_value<Exception>(props.mEqualizer); break; + case EAXEQUALIZER_LOWGAIN: call.set_value<Exception>(props.mEqualizer.lLowGain); break; + case EAXEQUALIZER_LOWCUTOFF: call.set_value<Exception>(props.mEqualizer.flLowCutOff); break; + case EAXEQUALIZER_MID1GAIN: call.set_value<Exception>(props.mEqualizer.lMid1Gain); break; + case EAXEQUALIZER_MID1CENTER: call.set_value<Exception>(props.mEqualizer.flMid1Center); break; + case EAXEQUALIZER_MID1WIDTH: call.set_value<Exception>(props.mEqualizer.flMid1Width); break; + case EAXEQUALIZER_MID2GAIN: call.set_value<Exception>(props.mEqualizer.lMid2Gain); break; + case EAXEQUALIZER_MID2CENTER: call.set_value<Exception>(props.mEqualizer.flMid2Center); break; + case EAXEQUALIZER_MID2WIDTH: call.set_value<Exception>(props.mEqualizer.flMid2Width); break; + case EAXEQUALIZER_HIGHGAIN: call.set_value<Exception>(props.mEqualizer.lHighGain); break; + case EAXEQUALIZER_HIGHCUTOFF: call.set_value<Exception>(props.mEqualizer.flHighCutOff); break; default: fail_unknown_property_id(); } } -void EaxEqualizerEffect::set(const EaxCall& call, Props& props) +void EaxEqualizerEffect::set(const EaxCall& call, Props4& props) { switch(call.get_property_id()) { case EAXEQUALIZER_NONE: break; - case EAXEQUALIZER_ALLPARAMETERS: defer<AllValidator>(call, props); break; - case EAXEQUALIZER_LOWGAIN: defer<LowGainValidator>(call, props.lLowGain); break; - case EAXEQUALIZER_LOWCUTOFF: defer<LowCutOffValidator>(call, props.flLowCutOff); break; - case EAXEQUALIZER_MID1GAIN: defer<Mid1GainValidator>(call, props.lMid1Gain); break; - case EAXEQUALIZER_MID1CENTER: defer<Mid1CenterValidator>(call, props.flMid1Center); break; - case EAXEQUALIZER_MID1WIDTH: defer<Mid1WidthValidator>(call, props.flMid1Width); break; - case EAXEQUALIZER_MID2GAIN: defer<Mid2GainValidator>(call, props.lMid2Gain); break; - case EAXEQUALIZER_MID2CENTER: defer<Mid2CenterValidator>(call, props.flMid2Center); break; - case EAXEQUALIZER_MID2WIDTH: defer<Mid2WidthValidator>(call, props.flMid2Width); break; - case EAXEQUALIZER_HIGHGAIN: defer<HighGainValidator>(call, props.lHighGain); break; - case EAXEQUALIZER_HIGHCUTOFF: defer<HighCutOffValidator>(call, props.flHighCutOff); break; + case EAXEQUALIZER_ALLPARAMETERS: defer<AllValidator>(call, props.mEqualizer); break; + case EAXEQUALIZER_LOWGAIN: defer<LowGainValidator>(call, props.mEqualizer.lLowGain); break; + case EAXEQUALIZER_LOWCUTOFF: defer<LowCutOffValidator>(call, props.mEqualizer.flLowCutOff); break; + case EAXEQUALIZER_MID1GAIN: defer<Mid1GainValidator>(call, props.mEqualizer.lMid1Gain); break; + case EAXEQUALIZER_MID1CENTER: defer<Mid1CenterValidator>(call, props.mEqualizer.flMid1Center); break; + case EAXEQUALIZER_MID1WIDTH: defer<Mid1WidthValidator>(call, props.mEqualizer.flMid1Width); break; + case EAXEQUALIZER_MID2GAIN: defer<Mid2GainValidator>(call, props.mEqualizer.lMid2Gain); break; + case EAXEQUALIZER_MID2CENTER: defer<Mid2CenterValidator>(call, props.mEqualizer.flMid2Center); break; + case EAXEQUALIZER_MID2WIDTH: defer<Mid2WidthValidator>(call, props.mEqualizer.flMid2Width); break; + case EAXEQUALIZER_HIGHGAIN: defer<HighGainValidator>(call, props.mEqualizer.lHighGain); break; + case EAXEQUALIZER_HIGHCUTOFF: defer<HighCutOffValidator>(call, props.mEqualizer.flHighCutOff); break; default: fail_unknown_property_id(); } } -bool EaxEqualizerEffect::commit_props(const Props& props) +bool EaxEqualizerEffect::commit_props(const Props4& props) { auto is_dirty = false; - if (props_.lLowGain != props.lLowGain) + if (props_.mEqualizer.lLowGain != props.mEqualizer.lLowGain) { is_dirty = true; set_efx_low_gain(); } - if (props_.flLowCutOff != props.flLowCutOff) + if (props_.mEqualizer.flLowCutOff != props.mEqualizer.flLowCutOff) { is_dirty = true; set_efx_low_cutoff(); } - if (props_.lMid1Gain != props.lMid1Gain) + if (props_.mEqualizer.lMid1Gain != props.mEqualizer.lMid1Gain) { is_dirty = true; set_efx_mid1_gain(); } - if (props_.flMid1Center != props.flMid1Center) + if (props_.mEqualizer.flMid1Center != props.mEqualizer.flMid1Center) { is_dirty = true; set_efx_mid1_center(); } - if (props_.flMid1Width != props.flMid1Width) + if (props_.mEqualizer.flMid1Width != props.mEqualizer.flMid1Width) { is_dirty = true; set_efx_mid1_width(); } - if (props_.lMid2Gain != props.lMid2Gain) + if (props_.mEqualizer.lMid2Gain != props.mEqualizer.lMid2Gain) { is_dirty = true; set_efx_mid2_gain(); } - if (props_.flMid2Center != props.flMid2Center) + if (props_.mEqualizer.flMid2Center != props.mEqualizer.flMid2Center) { is_dirty = true; set_efx_mid2_center(); } - if (props_.flMid2Width != props.flMid2Width) + if (props_.mEqualizer.flMid2Width != props.mEqualizer.flMid2Width) { is_dirty = true; set_efx_mid2_width(); } - if (props_.lHighGain != props.lHighGain) + if (props_.mEqualizer.lHighGain != props.mEqualizer.lHighGain) { is_dirty = true; set_efx_high_gain(); } - if (props_.flHighCutOff != props.flHighCutOff) + if (props_.mEqualizer.flHighCutOff != props.mEqualizer.flHighCutOff) { is_dirty = true; set_efx_high_cutoff(); diff --git a/al/effects/fshifter.cpp b/al/effects/fshifter.cpp index 9ca28775..1a97e339 100644 --- a/al/effects/fshifter.cpp +++ b/al/effects/fshifter.cpp @@ -147,7 +147,7 @@ public: {} }; // EaxFrequencyShifterEffectException -class EaxFrequencyShifterEffect final : public EaxEffect4<EaxFrequencyShifterEffectException, EAXFREQUENCYSHIFTERPROPERTIES> { +class EaxFrequencyShifterEffect final : public EaxEffect4<EaxFrequencyShifterEffectException> { public: EaxFrequencyShifterEffect(int eax_version); @@ -186,7 +186,7 @@ private: }; // RightDirectionValidator struct AllValidator { - void operator()(const Props& all) const + void operator()(const EAXFREQUENCYSHIFTERPROPERTIES& all) const { FrequencyValidator{}(all.flFrequency); LeftDirectionValidator{}(all.ulLeftDirection); @@ -194,16 +194,16 @@ private: } }; // AllValidator - void set_defaults(Props& props) override; + void set_defaults(Props4& props) override; void set_efx_frequency() noexcept; void set_efx_left_direction(); void set_efx_right_direction(); void set_efx_defaults() override; - void get(const EaxCall& call, const Props& props) override; - void set(const EaxCall& call, Props& props) override; - bool commit_props(const Props& props) override; + void get(const EaxCall& call, const Props4& props) override; + void set(const EaxCall& call, Props4& props) override; + bool commit_props(const Props4& props) override; }; // EaxFrequencyShifterEffect @@ -211,17 +211,17 @@ EaxFrequencyShifterEffect::EaxFrequencyShifterEffect(int eax_version) : EaxEffect4{AL_EFFECT_FREQUENCY_SHIFTER, eax_version} {} -void EaxFrequencyShifterEffect::set_defaults(Props& props) +void EaxFrequencyShifterEffect::set_defaults(Props4& props) { - props.flFrequency = EAXFREQUENCYSHIFTER_DEFAULTFREQUENCY; - props.ulLeftDirection = EAXFREQUENCYSHIFTER_DEFAULTLEFTDIRECTION; - props.ulRightDirection = EAXFREQUENCYSHIFTER_DEFAULTRIGHTDIRECTION; + props.mFrequencyShifter.flFrequency = EAXFREQUENCYSHIFTER_DEFAULTFREQUENCY; + props.mFrequencyShifter.ulLeftDirection = EAXFREQUENCYSHIFTER_DEFAULTLEFTDIRECTION; + props.mFrequencyShifter.ulRightDirection = EAXFREQUENCYSHIFTER_DEFAULTRIGHTDIRECTION; } void EaxFrequencyShifterEffect::set_efx_frequency() noexcept { al_effect_props_.Fshifter.Frequency = clamp( - props_.flFrequency, + props_.mFrequencyShifter.flFrequency, AL_FREQUENCY_SHIFTER_MIN_FREQUENCY, AL_FREQUENCY_SHIFTER_MAX_FREQUENCY); } @@ -229,7 +229,7 @@ void EaxFrequencyShifterEffect::set_efx_frequency() noexcept void EaxFrequencyShifterEffect::set_efx_left_direction() { const auto left_direction = clamp( - static_cast<ALint>(props_.ulLeftDirection), + static_cast<ALint>(props_.mFrequencyShifter.ulLeftDirection), AL_FREQUENCY_SHIFTER_MIN_LEFT_DIRECTION, AL_FREQUENCY_SHIFTER_MAX_LEFT_DIRECTION); const auto efx_left_direction = DirectionFromEmum(left_direction); @@ -240,7 +240,7 @@ void EaxFrequencyShifterEffect::set_efx_left_direction() void EaxFrequencyShifterEffect::set_efx_right_direction() { const auto right_direction = clamp( - static_cast<ALint>(props_.ulRightDirection), + static_cast<ALint>(props_.mFrequencyShifter.ulRightDirection), AL_FREQUENCY_SHIFTER_MIN_RIGHT_DIRECTION, AL_FREQUENCY_SHIFTER_MAX_RIGHT_DIRECTION); const auto efx_right_direction = DirectionFromEmum(right_direction); @@ -255,49 +255,49 @@ void EaxFrequencyShifterEffect::set_efx_defaults() set_efx_right_direction(); } -void EaxFrequencyShifterEffect::get(const EaxCall& call, const Props& props) +void EaxFrequencyShifterEffect::get(const EaxCall& call, const Props4& props) { switch(call.get_property_id()) { case EAXFREQUENCYSHIFTER_NONE: break; - case EAXFREQUENCYSHIFTER_ALLPARAMETERS: call.set_value<Exception>(props); break; - case EAXFREQUENCYSHIFTER_FREQUENCY: call.set_value<Exception>(props.flFrequency); break; - case EAXFREQUENCYSHIFTER_LEFTDIRECTION: call.set_value<Exception>(props.ulLeftDirection); break; - case EAXFREQUENCYSHIFTER_RIGHTDIRECTION: call.set_value<Exception>(props.ulRightDirection); break; + case EAXFREQUENCYSHIFTER_ALLPARAMETERS: call.set_value<Exception>(props.mFrequencyShifter); break; + case EAXFREQUENCYSHIFTER_FREQUENCY: call.set_value<Exception>(props.mFrequencyShifter.flFrequency); break; + case EAXFREQUENCYSHIFTER_LEFTDIRECTION: call.set_value<Exception>(props.mFrequencyShifter.ulLeftDirection); break; + case EAXFREQUENCYSHIFTER_RIGHTDIRECTION: call.set_value<Exception>(props.mFrequencyShifter.ulRightDirection); break; default: fail_unknown_property_id(); } } -void EaxFrequencyShifterEffect::set(const EaxCall& call, Props& props) +void EaxFrequencyShifterEffect::set(const EaxCall& call, Props4& props) { switch(call.get_property_id()) { case EAXFREQUENCYSHIFTER_NONE: break; - case EAXFREQUENCYSHIFTER_ALLPARAMETERS: defer<AllValidator>(call, props); break; - case EAXFREQUENCYSHIFTER_FREQUENCY: defer<FrequencyValidator>(call, props.flFrequency); break; - case EAXFREQUENCYSHIFTER_LEFTDIRECTION: defer<LeftDirectionValidator>(call, props.ulLeftDirection); break; - case EAXFREQUENCYSHIFTER_RIGHTDIRECTION: defer<RightDirectionValidator>(call, props.ulRightDirection); break; + case EAXFREQUENCYSHIFTER_ALLPARAMETERS: defer<AllValidator>(call, props.mFrequencyShifter); break; + case EAXFREQUENCYSHIFTER_FREQUENCY: defer<FrequencyValidator>(call, props.mFrequencyShifter.flFrequency); break; + case EAXFREQUENCYSHIFTER_LEFTDIRECTION: defer<LeftDirectionValidator>(call, props.mFrequencyShifter.ulLeftDirection); break; + case EAXFREQUENCYSHIFTER_RIGHTDIRECTION: defer<RightDirectionValidator>(call, props.mFrequencyShifter.ulRightDirection); break; default: fail_unknown_property_id(); } } -bool EaxFrequencyShifterEffect::commit_props(const Props& props) +bool EaxFrequencyShifterEffect::commit_props(const Props4& props) { auto is_dirty = false; - if (props_.flFrequency != props.flFrequency) + if (props_.mFrequencyShifter.flFrequency != props.mFrequencyShifter.flFrequency) { is_dirty = true; set_efx_frequency(); } - if (props_.ulLeftDirection != props.ulLeftDirection) + if (props_.mFrequencyShifter.ulLeftDirection != props.mFrequencyShifter.ulLeftDirection) { is_dirty = true; set_efx_left_direction(); } - if (props_.ulRightDirection != props.ulRightDirection) + if (props_.mFrequencyShifter.ulRightDirection != props.mFrequencyShifter.ulRightDirection) { is_dirty = true; set_efx_right_direction(); diff --git a/al/effects/modulator.cpp b/al/effects/modulator.cpp index 070b0998..a6a443f8 100644 --- a/al/effects/modulator.cpp +++ b/al/effects/modulator.cpp @@ -153,7 +153,7 @@ public: {} }; // EaxRingModulatorEffectException -class EaxRingModulatorEffect final : public EaxEffect4<EaxRingModulatorEffectException, EAXRINGMODULATORPROPERTIES> +class EaxRingModulatorEffect final : public EaxEffect4<EaxRingModulatorEffectException> { public: EaxRingModulatorEffect(int eax_version); @@ -193,7 +193,7 @@ private: }; // WaveformValidator struct AllValidator { - void operator()(const Props& all) const + void operator()(const EAXRINGMODULATORPROPERTIES& all) const { FrequencyValidator{}(all.flFrequency); HighPassCutOffValidator{}(all.flHighPassCutOff); @@ -201,33 +201,33 @@ private: } }; // AllValidator - void set_defaults(Props& props) override; + void set_defaults(Props4& props) override; void set_efx_frequency() noexcept; void set_efx_high_pass_cutoff() noexcept; void set_efx_waveform(); void set_efx_defaults() override; - void get(const EaxCall& call, const Props& props) override; - void set(const EaxCall& call, Props& props) override; - bool commit_props(const Props& props) override; + void get(const EaxCall& call, const Props4& props) override; + void set(const EaxCall& call, Props4& props) override; + bool commit_props(const Props4& props) override; }; // EaxRingModulatorEffect EaxRingModulatorEffect::EaxRingModulatorEffect(int eax_version) : EaxEffect4{AL_EFFECT_RING_MODULATOR, eax_version} {} -void EaxRingModulatorEffect::set_defaults(Props& props) +void EaxRingModulatorEffect::set_defaults(Props4& props) { - props.flFrequency = EAXRINGMODULATOR_DEFAULTFREQUENCY; - props.flHighPassCutOff = EAXRINGMODULATOR_DEFAULTHIGHPASSCUTOFF; - props.ulWaveform = EAXRINGMODULATOR_DEFAULTWAVEFORM; + props.mModulator.flFrequency = EAXRINGMODULATOR_DEFAULTFREQUENCY; + props.mModulator.flHighPassCutOff = EAXRINGMODULATOR_DEFAULTHIGHPASSCUTOFF; + props.mModulator.ulWaveform = EAXRINGMODULATOR_DEFAULTWAVEFORM; } void EaxRingModulatorEffect::set_efx_frequency() noexcept { al_effect_props_.Modulator.Frequency = clamp( - props_.flFrequency, + props_.mModulator.flFrequency, AL_RING_MODULATOR_MIN_FREQUENCY, AL_RING_MODULATOR_MAX_FREQUENCY); } @@ -235,7 +235,7 @@ void EaxRingModulatorEffect::set_efx_frequency() noexcept void EaxRingModulatorEffect::set_efx_high_pass_cutoff() noexcept { al_effect_props_.Modulator.HighPassCutoff = clamp( - props_.flHighPassCutOff, + props_.mModulator.flHighPassCutOff, AL_RING_MODULATOR_MIN_HIGHPASS_CUTOFF, AL_RING_MODULATOR_MAX_HIGHPASS_CUTOFF); } @@ -243,7 +243,7 @@ void EaxRingModulatorEffect::set_efx_high_pass_cutoff() noexcept void EaxRingModulatorEffect::set_efx_waveform() { const auto waveform = clamp( - static_cast<ALint>(props_.ulWaveform), + static_cast<ALint>(props_.mModulator.ulWaveform), AL_RING_MODULATOR_MIN_WAVEFORM, AL_RING_MODULATOR_MAX_WAVEFORM); const auto efx_waveform = WaveformFromEmum(waveform); @@ -258,49 +258,49 @@ void EaxRingModulatorEffect::set_efx_defaults() set_efx_waveform(); } -void EaxRingModulatorEffect::get(const EaxCall& call, const Props& props) +void EaxRingModulatorEffect::get(const EaxCall& call, const Props4& props) { switch(call.get_property_id()) { case EAXRINGMODULATOR_NONE: break; - case EAXRINGMODULATOR_ALLPARAMETERS: call.set_value<Exception>(props); break; - case EAXRINGMODULATOR_FREQUENCY: call.set_value<Exception>(props.flFrequency); break; - case EAXRINGMODULATOR_HIGHPASSCUTOFF: call.set_value<Exception>(props.flHighPassCutOff); break; - case EAXRINGMODULATOR_WAVEFORM: call.set_value<Exception>(props.ulWaveform); break; + case EAXRINGMODULATOR_ALLPARAMETERS: call.set_value<Exception>(props.mModulator); break; + case EAXRINGMODULATOR_FREQUENCY: call.set_value<Exception>(props.mModulator.flFrequency); break; + case EAXRINGMODULATOR_HIGHPASSCUTOFF: call.set_value<Exception>(props.mModulator.flHighPassCutOff); break; + case EAXRINGMODULATOR_WAVEFORM: call.set_value<Exception>(props.mModulator.ulWaveform); break; default: fail_unknown_property_id(); } } -void EaxRingModulatorEffect::set(const EaxCall& call, Props& props) +void EaxRingModulatorEffect::set(const EaxCall& call, Props4& props) { switch (call.get_property_id()) { case EAXRINGMODULATOR_NONE: break; - case EAXRINGMODULATOR_ALLPARAMETERS: defer<AllValidator>(call, props); break; - case EAXRINGMODULATOR_FREQUENCY: defer<FrequencyValidator>(call, props.flFrequency); break; - case EAXRINGMODULATOR_HIGHPASSCUTOFF: defer<HighPassCutOffValidator>(call, props.flHighPassCutOff); break; - case EAXRINGMODULATOR_WAVEFORM: defer<WaveformValidator>(call, props.ulWaveform); break; + case EAXRINGMODULATOR_ALLPARAMETERS: defer<AllValidator>(call, props.mModulator); break; + case EAXRINGMODULATOR_FREQUENCY: defer<FrequencyValidator>(call, props.mModulator.flFrequency); break; + case EAXRINGMODULATOR_HIGHPASSCUTOFF: defer<HighPassCutOffValidator>(call, props.mModulator.flHighPassCutOff); break; + case EAXRINGMODULATOR_WAVEFORM: defer<WaveformValidator>(call, props.mModulator.ulWaveform); break; default: fail_unknown_property_id(); } } -bool EaxRingModulatorEffect::commit_props(const Props& props) +bool EaxRingModulatorEffect::commit_props(const Props4& props) { auto is_dirty = false; - if (props_.flFrequency != props.flFrequency) + if (props_.mModulator.flFrequency != props.mModulator.flFrequency) { is_dirty = true; set_efx_frequency(); } - if (props_.flHighPassCutOff != props.flHighPassCutOff) + if (props_.mModulator.flHighPassCutOff != props.mModulator.flHighPassCutOff) { is_dirty = true; set_efx_high_pass_cutoff(); } - if (props_.ulWaveform != props.ulWaveform) + if (props_.mModulator.ulWaveform != props.mModulator.ulWaveform) { is_dirty = true; set_efx_waveform(); diff --git a/al/effects/null.cpp b/al/effects/null.cpp index 2243dfe1..5bbcdd62 100644 --- a/al/effects/null.cpp +++ b/al/effects/null.cpp @@ -102,7 +102,7 @@ namespace { class EaxNullEffect final : public EaxEffect { public: - EaxNullEffect() noexcept; + EaxNullEffect(int eax_version) noexcept; void dispatch(const EaxCall& call) override; /*[[nodiscard]]*/ bool commit() override; @@ -117,8 +117,8 @@ public: {} }; // EaxNullEffectException -EaxNullEffect::EaxNullEffect() noexcept - : EaxEffect{AL_EFFECT_NULL} +EaxNullEffect::EaxNullEffect(int eax_version) noexcept + : EaxEffect{AL_EFFECT_NULL, eax_version} {} void EaxNullEffect::dispatch(const EaxCall& call) @@ -134,9 +134,9 @@ bool EaxNullEffect::commit() } // namespace -EaxEffectUPtr eax_create_eax_null_effect() +EaxEffectUPtr eax_create_eax_null_effect(int eax_version) { - return std::make_unique<EaxNullEffect>(); + return std::make_unique<EaxNullEffect>(eax_version); } #endif // ALSOFT_EAX diff --git a/al/effects/pshifter.cpp b/al/effects/pshifter.cpp index 9711da28..ef3fe587 100644 --- a/al/effects/pshifter.cpp +++ b/al/effects/pshifter.cpp @@ -100,7 +100,7 @@ public: {} }; // EaxPitchShifterEffectException -class EaxPitchShifterEffect final : public EaxEffect4<EaxPitchShifterEffectException, EAXPITCHSHIFTERPROPERTIES> { +class EaxPitchShifterEffect final : public EaxEffect4<EaxPitchShifterEffectException> { public: EaxPitchShifterEffect(int eax_version); @@ -128,38 +128,38 @@ private: }; // FineTuneValidator struct AllValidator { - void operator()(const Props& all) const + void operator()(const EAXPITCHSHIFTERPROPERTIES& all) const { CoarseTuneValidator{}(all.lCoarseTune); FineTuneValidator{}(all.lFineTune); } }; // AllValidator - void set_defaults(Props& props) override; + void set_defaults(Props4& props) override; void set_efx_coarse_tune() noexcept; void set_efx_fine_tune() noexcept; void set_efx_defaults() override; - void get(const EaxCall& call, const Props& props) override; - void set(const EaxCall& call, Props& props) override; - bool commit_props(const Props& old_i) override; + void get(const EaxCall& call, const Props4& props) override; + void set(const EaxCall& call, Props4& props) override; + bool commit_props(const Props4& old_i) override; }; // EaxPitchShifterEffect EaxPitchShifterEffect::EaxPitchShifterEffect(int eax_version) : EaxEffect4{AL_EFFECT_PITCH_SHIFTER, eax_version} {} -void EaxPitchShifterEffect::set_defaults(Props& props) +void EaxPitchShifterEffect::set_defaults(Props4& props) { - props.lCoarseTune = EAXPITCHSHIFTER_DEFAULTCOARSETUNE; - props.lFineTune = EAXPITCHSHIFTER_DEFAULTFINETUNE; + props.mPitchShifter.lCoarseTune = EAXPITCHSHIFTER_DEFAULTCOARSETUNE; + props.mPitchShifter.lFineTune = EAXPITCHSHIFTER_DEFAULTFINETUNE; } void EaxPitchShifterEffect::set_efx_coarse_tune() noexcept { al_effect_props_.Pshifter.CoarseTune = clamp( - static_cast<ALint>(props_.lCoarseTune), + static_cast<ALint>(props_.mPitchShifter.lCoarseTune), AL_PITCH_SHIFTER_MIN_COARSE_TUNE, AL_PITCH_SHIFTER_MAX_COARSE_TUNE); } @@ -167,7 +167,7 @@ void EaxPitchShifterEffect::set_efx_coarse_tune() noexcept void EaxPitchShifterEffect::set_efx_fine_tune() noexcept { al_effect_props_.Pshifter.FineTune = clamp( - static_cast<ALint>(props_.lFineTune), + static_cast<ALint>(props_.mPitchShifter.lFineTune), AL_PITCH_SHIFTER_MIN_FINE_TUNE, AL_PITCH_SHIFTER_MAX_FINE_TUNE); } @@ -178,41 +178,41 @@ void EaxPitchShifterEffect::set_efx_defaults() set_efx_fine_tune(); } -void EaxPitchShifterEffect::get(const EaxCall& call, const Props& props) +void EaxPitchShifterEffect::get(const EaxCall& call, const Props4& props) { switch(call.get_property_id()) { case EAXPITCHSHIFTER_NONE: break; - case EAXPITCHSHIFTER_ALLPARAMETERS: call.set_value<Exception>(props); break; - case EAXPITCHSHIFTER_COARSETUNE: call.set_value<Exception>(props.lCoarseTune); break; - case EAXPITCHSHIFTER_FINETUNE: call.set_value<Exception>(props.lFineTune); break; + case EAXPITCHSHIFTER_ALLPARAMETERS: call.set_value<Exception>(props.mPitchShifter); break; + case EAXPITCHSHIFTER_COARSETUNE: call.set_value<Exception>(props.mPitchShifter.lCoarseTune); break; + case EAXPITCHSHIFTER_FINETUNE: call.set_value<Exception>(props.mPitchShifter.lFineTune); break; default: fail_unknown_property_id(); } } -void EaxPitchShifterEffect::set(const EaxCall& call, Props& props) +void EaxPitchShifterEffect::set(const EaxCall& call, Props4& props) { switch(call.get_property_id()) { case EAXPITCHSHIFTER_NONE: break; - case EAXPITCHSHIFTER_ALLPARAMETERS: defer<AllValidator>(call, props); break; - case EAXPITCHSHIFTER_COARSETUNE: defer<CoarseTuneValidator>(call, props.lCoarseTune); break; - case EAXPITCHSHIFTER_FINETUNE: defer<FineTuneValidator>(call, props.lFineTune); break; + case EAXPITCHSHIFTER_ALLPARAMETERS: defer<AllValidator>(call, props.mPitchShifter); break; + case EAXPITCHSHIFTER_COARSETUNE: defer<CoarseTuneValidator>(call, props.mPitchShifter.lCoarseTune); break; + case EAXPITCHSHIFTER_FINETUNE: defer<FineTuneValidator>(call, props.mPitchShifter.lFineTune); break; default: fail_unknown_property_id(); } } -bool EaxPitchShifterEffect::commit_props(const Props& props) +bool EaxPitchShifterEffect::commit_props(const Props4& props) { auto is_dirty = false; - if (props_.lCoarseTune != props.lCoarseTune) + if (props_.mPitchShifter.lCoarseTune != props.mPitchShifter.lCoarseTune) { is_dirty = true; set_efx_coarse_tune(); } - if (props_.lFineTune != props.lFineTune) + if (props_.mPitchShifter.lFineTune != props.mPitchShifter.lFineTune) { is_dirty = true; set_efx_fine_tune(); diff --git a/al/effects/reverb.cpp b/al/effects/reverb.cpp index 656642e0..ba586254 100644 --- a/al/effects/reverb.cpp +++ b/al/effects/reverb.cpp @@ -587,28 +587,6 @@ private: using Exception = EaxReverbEffectException; - using Props1 = EAX_REVERBPROPERTIES; - using Props2 = EAX20LISTENERPROPERTIES; - using Props3 = EAXREVERBPROPERTIES; - - struct State1 - { - Props1 i; // Immediate. - Props1 d; // Deferred. - }; // State1 - - struct State2 - { - Props2 i; // Immediate. - Props2 d; // Deferred. - }; // State2 - - struct State3 - { - Props3 i; // Immediate. - Props3 d; // Deferred. - }; // State3 - struct EnvironmentValidator1 { void operator()(unsigned long ulEnvironment) const { @@ -654,7 +632,7 @@ private: }; // DampingValidator struct AllValidator1 { - void operator()(const Props1& all) const + void operator()(const EAX_REVERBPROPERTIES& all) const { EnvironmentValidator1{}(all.environment); VolumeValidator{}(all.fVolume); @@ -796,7 +774,7 @@ private: }; // FlagsValidator2 struct AllValidator2 { - void operator()(const Props2& all) const + void operator()(const EAX20LISTENERPROPERTIES& all) const { RoomValidator{}(all.lRoom); RoomHFValidator{}(all.lRoomHF); @@ -931,7 +909,7 @@ private: }; // FlagsValidator3 struct AllValidator3 { - void operator()(const Props3& all) const + void operator()(const EAXREVERBPROPERTIES& all) const { EnvironmentValidator3{}(all.ulEnvironment); EnvironmentSizeValidator{}(all.flEnvironmentSize); @@ -961,14 +939,14 @@ private: }; // AllValidator3 struct EnvironmentDeferrer2 { - void operator()(Props2& props, unsigned long dwEnvironment) const + void operator()(EAX20LISTENERPROPERTIES& props, unsigned long dwEnvironment) const { props = EAX2REVERB_PRESETS[dwEnvironment]; } }; // EnvironmentDeferrer2 struct EnvironmentSizeDeferrer2 { - void operator()(Props2& props, float flEnvironmentSize) const + void operator()(EAX20LISTENERPROPERTIES& props, float flEnvironmentSize) const { if (props.flEnvironmentSize == flEnvironmentSize) { @@ -1024,7 +1002,7 @@ private: }; // EnvironmentSizeDeferrer2 struct EnvironmentDeferrer3 { - void operator()(Props3& props, unsigned long ulEnvironment) const + void operator()(EAXREVERBPROPERTIES& props, unsigned long ulEnvironment) const { if (ulEnvironment == EAX_ENVIRONMENT_UNDEFINED) { @@ -1037,7 +1015,7 @@ private: }; // EnvironmentDeferrer3 struct EnvironmentSizeDeferrer3 { - void operator()(Props3& props, float flEnvironmentSize) const + void operator()(EAXREVERBPROPERTIES& props, float flEnvironmentSize) const { if (props.flEnvironmentSize == flEnvironmentSize) { @@ -1108,14 +1086,6 @@ private: } }; // EnvironmentSizeDeferrer3 - int version_; - bool changed_{}; - Props3 props_{}; - State1 state1_{}; - State2 state2_{}; - State3 state3_{}; - State3 state4_{}; - State3 state5_{}; [[noreturn]] static void fail(const char* message); [[noreturn]] static void fail_unknown_property_id(); @@ -1195,7 +1165,7 @@ private: }; // EaxReverbEffect EaxReverbEffect::EaxReverbEffect(int eax_version) noexcept - : EaxEffect{AL_EFFECT_EAXREVERB}, version_{eax_version} + : EaxEffect{AL_EFFECT_EAXREVERB, eax_version} { set_defaults(); set_current_defaults(); @@ -1246,17 +1216,19 @@ void EaxReverbEffect::set_defaults() noexcept set_defaults(state1_); set_defaults(state2_); set_defaults(state3_); - state4_ = state3_; - state5_ = state3_; + state4_.d.mReverb = state3_.d; + state4_.i.mReverb = state3_.i; + state5_.d.mReverb = state3_.d; + state5_.i.mReverb = state3_.i; } void EaxReverbEffect::set_current_defaults() { switch (version_) { - case 1: translate(state1_.i, props_); break; - case 2: translate(state2_.i, props_); break; - case 3: props_ = state3_.i; break; + case 1: translate(state1_.i, props_.mReverb); break; + case 2: translate(state2_.i, props_.mReverb); break; + case 3: props_.mReverb = state3_.i; break; case 4: props_ = state4_.i; break; case 5: props_ = state5_.i; break; default: fail_unknown_version(); @@ -1265,7 +1237,7 @@ void EaxReverbEffect::set_current_defaults() void EaxReverbEffect::set_efx_density_from_environment_size() noexcept { - const auto size = props_.flEnvironmentSize; + const auto size = props_.mReverb.flEnvironmentSize; const auto density = (size * size * size) / 16.0F; al_effect_props_.Reverb.Density = clamp( density, @@ -1276,7 +1248,7 @@ void EaxReverbEffect::set_efx_density_from_environment_size() noexcept void EaxReverbEffect::set_efx_diffusion() noexcept { al_effect_props_.Reverb.Diffusion = clamp( - props_.flEnvironmentDiffusion, + props_.mReverb.flEnvironmentDiffusion, AL_EAXREVERB_MIN_DIFFUSION, AL_EAXREVERB_MAX_DIFFUSION); } @@ -1284,7 +1256,7 @@ void EaxReverbEffect::set_efx_diffusion() noexcept void EaxReverbEffect::set_efx_gain() noexcept { al_effect_props_.Reverb.Gain = clamp( - level_mb_to_gain(static_cast<float>(props_.lRoom)), + level_mb_to_gain(static_cast<float>(props_.mReverb.lRoom)), AL_EAXREVERB_MIN_GAIN, AL_EAXREVERB_MAX_GAIN); } @@ -1292,7 +1264,7 @@ void EaxReverbEffect::set_efx_gain() noexcept void EaxReverbEffect::set_efx_gain_hf() noexcept { al_effect_props_.Reverb.GainHF = clamp( - level_mb_to_gain(static_cast<float>(props_.lRoomHF)), + level_mb_to_gain(static_cast<float>(props_.mReverb.lRoomHF)), AL_EAXREVERB_MIN_GAINHF, AL_EAXREVERB_MAX_GAINHF); } @@ -1300,7 +1272,7 @@ void EaxReverbEffect::set_efx_gain_hf() noexcept void EaxReverbEffect::set_efx_gain_lf() noexcept { al_effect_props_.Reverb.GainLF = clamp( - level_mb_to_gain(static_cast<float>(props_.lRoomLF)), + level_mb_to_gain(static_cast<float>(props_.mReverb.lRoomLF)), AL_EAXREVERB_MIN_GAINLF, AL_EAXREVERB_MAX_GAINLF); } @@ -1308,7 +1280,7 @@ void EaxReverbEffect::set_efx_gain_lf() noexcept void EaxReverbEffect::set_efx_decay_time() noexcept { al_effect_props_.Reverb.DecayTime = clamp( - props_.flDecayTime, + props_.mReverb.flDecayTime, AL_EAXREVERB_MIN_DECAY_TIME, AL_EAXREVERB_MAX_DECAY_TIME); } @@ -1316,7 +1288,7 @@ void EaxReverbEffect::set_efx_decay_time() noexcept void EaxReverbEffect::set_efx_decay_hf_ratio() noexcept { al_effect_props_.Reverb.DecayHFRatio = clamp( - props_.flDecayHFRatio, + props_.mReverb.flDecayHFRatio, AL_EAXREVERB_MIN_DECAY_HFRATIO, AL_EAXREVERB_MAX_DECAY_HFRATIO); } @@ -1324,7 +1296,7 @@ void EaxReverbEffect::set_efx_decay_hf_ratio() noexcept void EaxReverbEffect::set_efx_decay_lf_ratio() noexcept { al_effect_props_.Reverb.DecayLFRatio = clamp( - props_.flDecayLFRatio, + props_.mReverb.flDecayLFRatio, AL_EAXREVERB_MIN_DECAY_LFRATIO, AL_EAXREVERB_MAX_DECAY_LFRATIO); } @@ -1332,7 +1304,7 @@ void EaxReverbEffect::set_efx_decay_lf_ratio() noexcept void EaxReverbEffect::set_efx_reflections_gain() noexcept { al_effect_props_.Reverb.ReflectionsGain = clamp( - level_mb_to_gain(static_cast<float>(props_.lReflections)), + level_mb_to_gain(static_cast<float>(props_.mReverb.lReflections)), AL_EAXREVERB_MIN_REFLECTIONS_GAIN, AL_EAXREVERB_MAX_REFLECTIONS_GAIN); } @@ -1340,22 +1312,22 @@ void EaxReverbEffect::set_efx_reflections_gain() noexcept void EaxReverbEffect::set_efx_reflections_delay() noexcept { al_effect_props_.Reverb.ReflectionsDelay = clamp( - props_.flReflectionsDelay, + props_.mReverb.flReflectionsDelay, AL_EAXREVERB_MIN_REFLECTIONS_DELAY, AL_EAXREVERB_MAX_REFLECTIONS_DELAY); } void EaxReverbEffect::set_efx_reflections_pan() noexcept { - al_effect_props_.Reverb.ReflectionsPan[0] = props_.vReflectionsPan.x; - al_effect_props_.Reverb.ReflectionsPan[1] = props_.vReflectionsPan.y; - al_effect_props_.Reverb.ReflectionsPan[2] = props_.vReflectionsPan.z; + al_effect_props_.Reverb.ReflectionsPan[0] = props_.mReverb.vReflectionsPan.x; + al_effect_props_.Reverb.ReflectionsPan[1] = props_.mReverb.vReflectionsPan.y; + al_effect_props_.Reverb.ReflectionsPan[2] = props_.mReverb.vReflectionsPan.z; } void EaxReverbEffect::set_efx_late_reverb_gain() noexcept { al_effect_props_.Reverb.LateReverbGain = clamp( - level_mb_to_gain(static_cast<float>(props_.lReverb)), + level_mb_to_gain(static_cast<float>(props_.mReverb.lReverb)), AL_EAXREVERB_MIN_LATE_REVERB_GAIN, AL_EAXREVERB_MAX_LATE_REVERB_GAIN); } @@ -1363,22 +1335,22 @@ void EaxReverbEffect::set_efx_late_reverb_gain() noexcept void EaxReverbEffect::set_efx_late_reverb_delay() noexcept { al_effect_props_.Reverb.LateReverbDelay = clamp( - props_.flReverbDelay, + props_.mReverb.flReverbDelay, AL_EAXREVERB_MIN_LATE_REVERB_DELAY, AL_EAXREVERB_MAX_LATE_REVERB_DELAY); } void EaxReverbEffect::set_efx_late_reverb_pan() noexcept { - al_effect_props_.Reverb.LateReverbPan[0] = props_.vReverbPan.x; - al_effect_props_.Reverb.LateReverbPan[1] = props_.vReverbPan.y; - al_effect_props_.Reverb.LateReverbPan[2] = props_.vReverbPan.z; + al_effect_props_.Reverb.LateReverbPan[0] = props_.mReverb.vReverbPan.x; + al_effect_props_.Reverb.LateReverbPan[1] = props_.mReverb.vReverbPan.y; + al_effect_props_.Reverb.LateReverbPan[2] = props_.mReverb.vReverbPan.z; } void EaxReverbEffect::set_efx_echo_time() noexcept { al_effect_props_.Reverb.EchoTime = clamp( - props_.flEchoTime, + props_.mReverb.flEchoTime, AL_EAXREVERB_MIN_ECHO_TIME, AL_EAXREVERB_MAX_ECHO_TIME); } @@ -1386,7 +1358,7 @@ void EaxReverbEffect::set_efx_echo_time() noexcept void EaxReverbEffect::set_efx_echo_depth() noexcept { al_effect_props_.Reverb.EchoDepth = clamp( - props_.flEchoDepth, + props_.mReverb.flEchoDepth, AL_EAXREVERB_MIN_ECHO_DEPTH, AL_EAXREVERB_MAX_ECHO_DEPTH); } @@ -1394,7 +1366,7 @@ void EaxReverbEffect::set_efx_echo_depth() noexcept void EaxReverbEffect::set_efx_modulation_time() noexcept { al_effect_props_.Reverb.ModulationTime = clamp( - props_.flModulationTime, + props_.mReverb.flModulationTime, AL_EAXREVERB_MIN_MODULATION_TIME, AL_EAXREVERB_MAX_MODULATION_TIME); } @@ -1402,7 +1374,7 @@ void EaxReverbEffect::set_efx_modulation_time() noexcept void EaxReverbEffect::set_efx_modulation_depth() noexcept { al_effect_props_.Reverb.ModulationDepth = clamp( - props_.flModulationDepth, + props_.mReverb.flModulationDepth, AL_EAXREVERB_MIN_MODULATION_DEPTH, AL_EAXREVERB_MAX_MODULATION_DEPTH); } @@ -1410,7 +1382,7 @@ void EaxReverbEffect::set_efx_modulation_depth() noexcept void EaxReverbEffect::set_efx_air_absorption_gain_hf() noexcept { al_effect_props_.Reverb.AirAbsorptionGainHF = clamp( - level_mb_to_gain(props_.flAirAbsorptionHF), + level_mb_to_gain(props_.mReverb.flAirAbsorptionHF), AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF, AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF); } @@ -1418,7 +1390,7 @@ void EaxReverbEffect::set_efx_air_absorption_gain_hf() noexcept void EaxReverbEffect::set_efx_hf_reference() noexcept { al_effect_props_.Reverb.HFReference = clamp( - props_.flHFReference, + props_.mReverb.flHFReference, AL_EAXREVERB_MIN_HFREFERENCE, AL_EAXREVERB_MAX_HFREFERENCE); } @@ -1426,7 +1398,7 @@ void EaxReverbEffect::set_efx_hf_reference() noexcept void EaxReverbEffect::set_efx_lf_reference() noexcept { al_effect_props_.Reverb.LFReference = clamp( - props_.flLFReference, + props_.mReverb.flLFReference, AL_EAXREVERB_MIN_LFREFERENCE, AL_EAXREVERB_MAX_LFREFERENCE); } @@ -1434,14 +1406,14 @@ void EaxReverbEffect::set_efx_lf_reference() noexcept void EaxReverbEffect::set_efx_room_rolloff_factor() noexcept { al_effect_props_.Reverb.RoomRolloffFactor = clamp( - props_.flRoomRolloffFactor, + props_.mReverb.flRoomRolloffFactor, AL_EAXREVERB_MIN_ROOM_ROLLOFF_FACTOR, AL_EAXREVERB_MAX_ROOM_ROLLOFF_FACTOR); } void EaxReverbEffect::set_efx_flags() noexcept { - al_effect_props_.Reverb.DecayHFLimit = ((props_.ulFlags & EAXREVERBFLAGS_DECAYHFLIMIT) != 0); + al_effect_props_.Reverb.DecayHFLimit = ((props_.mReverb.ulFlags & EAXREVERBFLAGS_DECAYHFLIMIT) != 0); } void EaxReverbEffect::set_efx_defaults() noexcept @@ -1549,8 +1521,8 @@ void EaxReverbEffect::get(const EaxCall& call) case 1: get1(call, state1_.i); break; case 2: get2(call, state2_.i); break; case 3: get3(call, state3_.i); break; - case 4: get3(call, state4_.i); break; - case 5: get3(call, state5_.i); break; + case 4: get3(call, state4_.i.mReverb); break; + case 5: get3(call, state5_.i.mReverb); break; default: fail_unknown_version(); } } @@ -1566,15 +1538,15 @@ void EaxReverbEffect::get(const EaxCall& call) { case 1: state1_.i = state1_.d; - translate(state1_.d, props_); + translate(state1_.d, props_.mReverb); break; case 2: state2_.i = state2_.d; - translate(state2_.d, props_); + translate(state2_.d, props_.mReverb); break; case 3: state3_.i = state3_.d; - props_ = state3_.d; + props_.mReverb = state3_.d; break; case 4: state4_.i = state4_.d; @@ -1591,139 +1563,139 @@ void EaxReverbEffect::get(const EaxCall& call) auto is_dirty = false; - if (props_.flEnvironmentSize != props.flEnvironmentSize) + if (props_.mReverb.flEnvironmentSize != props.mReverb.flEnvironmentSize) { is_dirty = true; set_efx_density_from_environment_size(); } - if (props_.flEnvironmentDiffusion != props.flEnvironmentDiffusion) + if (props_.mReverb.flEnvironmentDiffusion != props.mReverb.flEnvironmentDiffusion) { is_dirty = true; set_efx_diffusion(); } - if (props_.lRoom != props.lRoom) + if (props_.mReverb.lRoom != props.mReverb.lRoom) { is_dirty = true; set_efx_gain(); } - if (props_.lRoomHF != props.lRoomHF) + if (props_.mReverb.lRoomHF != props.mReverb.lRoomHF) { is_dirty = true; set_efx_gain_hf(); } - if (props_.lRoomLF != props.lRoomLF) + if (props_.mReverb.lRoomLF != props.mReverb.lRoomLF) { is_dirty = true; set_efx_gain_lf(); } - if (props_.flDecayTime != props.flDecayTime) + if (props_.mReverb.flDecayTime != props.mReverb.flDecayTime) { is_dirty = true; set_efx_decay_time(); } - if (props_.flDecayHFRatio != props.flDecayHFRatio) + if (props_.mReverb.flDecayHFRatio != props.mReverb.flDecayHFRatio) { is_dirty = true; set_efx_decay_hf_ratio(); } - if (props_.flDecayLFRatio != props.flDecayLFRatio) + if (props_.mReverb.flDecayLFRatio != props.mReverb.flDecayLFRatio) { is_dirty = true; set_efx_decay_lf_ratio(); } - if (props_.lReflections != props.lReflections) + if (props_.mReverb.lReflections != props.mReverb.lReflections) { is_dirty = true; set_efx_reflections_gain(); } - if (props_.flReflectionsDelay != props.flReflectionsDelay) + if (props_.mReverb.flReflectionsDelay != props.mReverb.flReflectionsDelay) { is_dirty = true; set_efx_reflections_delay(); } - if (props_.vReflectionsPan != props.vReflectionsPan) + if (props_.mReverb.vReflectionsPan != props.mReverb.vReflectionsPan) { is_dirty = true; set_efx_reflections_pan(); } - if (props_.lReverb != props.lReverb) + if (props_.mReverb.lReverb != props.mReverb.lReverb) { is_dirty = true; set_efx_late_reverb_gain(); } - if (props_.flReverbDelay != props.flReverbDelay) + if (props_.mReverb.flReverbDelay != props.mReverb.flReverbDelay) { is_dirty = true; set_efx_late_reverb_delay(); } - if (props_.vReverbPan != props.vReverbPan) + if (props_.mReverb.vReverbPan != props.mReverb.vReverbPan) { is_dirty = true; set_efx_late_reverb_pan(); } - if (props_.flEchoTime != props.flEchoTime) + if (props_.mReverb.flEchoTime != props.mReverb.flEchoTime) { is_dirty = true; set_efx_echo_time(); } - if (props_.flEchoDepth != props.flEchoDepth) + if (props_.mReverb.flEchoDepth != props.mReverb.flEchoDepth) { is_dirty = true; set_efx_echo_depth(); } - if (props_.flModulationTime != props.flModulationTime) + if (props_.mReverb.flModulationTime != props.mReverb.flModulationTime) { is_dirty = true; set_efx_modulation_time(); } - if (props_.flModulationDepth != props.flModulationDepth) + if (props_.mReverb.flModulationDepth != props.mReverb.flModulationDepth) { is_dirty = true; set_efx_modulation_depth(); } - if (props_.flAirAbsorptionHF != props.flAirAbsorptionHF) + if (props_.mReverb.flAirAbsorptionHF != props.mReverb.flAirAbsorptionHF) { is_dirty = true; set_efx_air_absorption_gain_hf(); } - if (props_.flHFReference != props.flHFReference) + if (props_.mReverb.flHFReference != props.mReverb.flHFReference) { is_dirty = true; set_efx_hf_reference(); } - if (props_.flLFReference != props.flLFReference) + if (props_.mReverb.flLFReference != props.mReverb.flLFReference) { is_dirty = true; set_efx_lf_reference(); } - if (props_.flRoomRolloffFactor != props.flRoomRolloffFactor) + if (props_.mReverb.flRoomRolloffFactor != props.mReverb.flRoomRolloffFactor) { is_dirty = true; set_efx_room_rolloff_factor(); } - if (props_.ulFlags != props.ulFlags) + if (props_.mReverb.ulFlags != props.mReverb.ulFlags) { is_dirty = true; set_efx_flags(); @@ -1937,8 +1909,8 @@ void EaxReverbEffect::set(const EaxCall& call) case 1: set1(call, state1_.d); break; case 2: set2(call, state2_.d); break; case 3: set3(call, state3_.d); break; - case 4: set3(call, state4_.d); break; - case 5: set3(call, state5_.d); break; + case 4: set3(call, state4_.d.mReverb); break; + case 5: set3(call, state5_.d.mReverb); break; default: fail_unknown_version(); } changed_ = true; diff --git a/al/effects/vmorpher.cpp b/al/effects/vmorpher.cpp index e26c6fe3..b4820c86 100644 --- a/al/effects/vmorpher.cpp +++ b/al/effects/vmorpher.cpp @@ -265,7 +265,7 @@ public: {} }; // EaxVocalMorpherEffectException -class EaxVocalMorpherEffect final : public EaxEffect4<EaxVocalMorpherEffectException, EAXVOCALMORPHERPROPERTIES> { +class EaxVocalMorpherEffect final : public EaxEffect4<EaxVocalMorpherEffectException> { public: EaxVocalMorpherEffect(int eax_version); @@ -337,7 +337,7 @@ private: }; // RateValidator struct AllValidator { - void operator()(const Props& all) const + void operator()(const EAXVOCALMORPHERPROPERTIES& all) const { PhonemeAValidator{}(all.ulPhonemeA); PhonemeACoarseTuningValidator{}(all.lPhonemeACoarseTuning); @@ -348,7 +348,7 @@ private: } }; // AllValidator - void set_defaults(Props& props) override; + void set_defaults(Props4& props) override; void set_efx_phoneme_a(); void set_efx_phoneme_a_coarse_tuning() noexcept; @@ -358,29 +358,29 @@ private: void set_efx_rate() noexcept; void set_efx_defaults() override; - void get(const EaxCall& call, const Props& props) override; - void set(const EaxCall& call, Props& props) override; - bool commit_props(const Props& props) override; + void get(const EaxCall& call, const Props4& props) override; + void set(const EaxCall& call, Props4& props) override; + bool commit_props(const Props4& props) override; }; // EaxVocalMorpherEffect EaxVocalMorpherEffect::EaxVocalMorpherEffect(int eax_version) : EaxEffect4{AL_EFFECT_VOCAL_MORPHER, eax_version} {} -void EaxVocalMorpherEffect::set_defaults(Props& props) +void EaxVocalMorpherEffect::set_defaults(Props4& props) { - props.ulPhonemeA = EAXVOCALMORPHER_DEFAULTPHONEMEA; - props.lPhonemeACoarseTuning = EAXVOCALMORPHER_DEFAULTPHONEMEACOARSETUNING; - props.ulPhonemeB = EAXVOCALMORPHER_DEFAULTPHONEMEB; - props.lPhonemeBCoarseTuning = EAXVOCALMORPHER_DEFAULTPHONEMEBCOARSETUNING; - props.ulWaveform = EAXVOCALMORPHER_DEFAULTWAVEFORM; - props.flRate = EAXVOCALMORPHER_DEFAULTRATE; + props.mVocalMorpher.ulPhonemeA = EAXVOCALMORPHER_DEFAULTPHONEMEA; + props.mVocalMorpher.lPhonemeACoarseTuning = EAXVOCALMORPHER_DEFAULTPHONEMEACOARSETUNING; + props.mVocalMorpher.ulPhonemeB = EAXVOCALMORPHER_DEFAULTPHONEMEB; + props.mVocalMorpher.lPhonemeBCoarseTuning = EAXVOCALMORPHER_DEFAULTPHONEMEBCOARSETUNING; + props.mVocalMorpher.ulWaveform = EAXVOCALMORPHER_DEFAULTWAVEFORM; + props.mVocalMorpher.flRate = EAXVOCALMORPHER_DEFAULTRATE; } void EaxVocalMorpherEffect::set_efx_phoneme_a() { const auto phoneme_a = clamp( - static_cast<ALint>(props_.ulPhonemeA), + static_cast<ALint>(props_.mVocalMorpher.ulPhonemeA), AL_VOCAL_MORPHER_MIN_PHONEMEA, AL_VOCAL_MORPHER_MAX_PHONEMEA); const auto efx_phoneme_a = PhenomeFromEnum(phoneme_a); @@ -391,7 +391,7 @@ void EaxVocalMorpherEffect::set_efx_phoneme_a() void EaxVocalMorpherEffect::set_efx_phoneme_a_coarse_tuning() noexcept { const auto phoneme_a_coarse_tuning = clamp( - static_cast<ALint>(props_.lPhonemeACoarseTuning), + static_cast<ALint>(props_.mVocalMorpher.lPhonemeACoarseTuning), AL_VOCAL_MORPHER_MIN_PHONEMEA_COARSE_TUNING, AL_VOCAL_MORPHER_MAX_PHONEMEA_COARSE_TUNING); al_effect_props_.Vmorpher.PhonemeACoarseTuning = phoneme_a_coarse_tuning; @@ -400,7 +400,7 @@ void EaxVocalMorpherEffect::set_efx_phoneme_a_coarse_tuning() noexcept void EaxVocalMorpherEffect::set_efx_phoneme_b() { const auto phoneme_b = clamp( - static_cast<ALint>(props_.ulPhonemeB), + static_cast<ALint>(props_.mVocalMorpher.ulPhonemeB), AL_VOCAL_MORPHER_MIN_PHONEMEB, AL_VOCAL_MORPHER_MAX_PHONEMEB); const auto efx_phoneme_b = PhenomeFromEnum(phoneme_b); @@ -411,7 +411,7 @@ void EaxVocalMorpherEffect::set_efx_phoneme_b() void EaxVocalMorpherEffect::set_efx_phoneme_b_coarse_tuning() noexcept { al_effect_props_.Vmorpher.PhonemeBCoarseTuning = clamp( - static_cast<ALint>(props_.lPhonemeBCoarseTuning), + static_cast<ALint>(props_.mVocalMorpher.lPhonemeBCoarseTuning), AL_VOCAL_MORPHER_MIN_PHONEMEB_COARSE_TUNING, AL_VOCAL_MORPHER_MAX_PHONEMEB_COARSE_TUNING); } @@ -419,7 +419,7 @@ void EaxVocalMorpherEffect::set_efx_phoneme_b_coarse_tuning() noexcept void EaxVocalMorpherEffect::set_efx_waveform() { const auto waveform = clamp( - static_cast<ALint>(props_.ulWaveform), + static_cast<ALint>(props_.mVocalMorpher.ulWaveform), AL_VOCAL_MORPHER_MIN_WAVEFORM, AL_VOCAL_MORPHER_MAX_WAVEFORM); const auto wfx_waveform = WaveformFromEmum(waveform); @@ -430,7 +430,7 @@ void EaxVocalMorpherEffect::set_efx_waveform() void EaxVocalMorpherEffect::set_efx_rate() noexcept { al_effect_props_.Vmorpher.Rate = clamp( - props_.flRate, + props_.mVocalMorpher.flRate, AL_VOCAL_MORPHER_MIN_RATE, AL_VOCAL_MORPHER_MAX_RATE); } @@ -445,7 +445,7 @@ void EaxVocalMorpherEffect::set_efx_defaults() set_efx_rate(); } -void EaxVocalMorpherEffect::get(const EaxCall& call, const Props& props) +void EaxVocalMorpherEffect::get(const EaxCall& call, const Props4& props) { switch(call.get_property_id()) { @@ -453,31 +453,31 @@ void EaxVocalMorpherEffect::get(const EaxCall& call, const Props& props) break; case EAXVOCALMORPHER_ALLPARAMETERS: - call.set_value<Exception>(props); + call.set_value<Exception>(props.mVocalMorpher); break; case EAXVOCALMORPHER_PHONEMEA: - call.set_value<Exception>(props.ulPhonemeA); + call.set_value<Exception>(props.mVocalMorpher.ulPhonemeA); break; case EAXVOCALMORPHER_PHONEMEACOARSETUNING: - call.set_value<Exception>(props.lPhonemeACoarseTuning); + call.set_value<Exception>(props.mVocalMorpher.lPhonemeACoarseTuning); break; case EAXVOCALMORPHER_PHONEMEB: - call.set_value<Exception>(props.ulPhonemeB); + call.set_value<Exception>(props.mVocalMorpher.ulPhonemeB); break; case EAXVOCALMORPHER_PHONEMEBCOARSETUNING: - call.set_value<Exception>(props.lPhonemeBCoarseTuning); + call.set_value<Exception>(props.mVocalMorpher.lPhonemeBCoarseTuning); break; case EAXVOCALMORPHER_WAVEFORM: - call.set_value<Exception>(props.ulWaveform); + call.set_value<Exception>(props.mVocalMorpher.ulWaveform); break; case EAXVOCALMORPHER_RATE: - call.set_value<Exception>(props.flRate); + call.set_value<Exception>(props.mVocalMorpher.flRate); break; default: @@ -485,7 +485,7 @@ void EaxVocalMorpherEffect::get(const EaxCall& call, const Props& props) } } -void EaxVocalMorpherEffect::set(const EaxCall& call, Props& props) +void EaxVocalMorpherEffect::set(const EaxCall& call, Props4& props) { switch(call.get_property_id()) { @@ -493,31 +493,31 @@ void EaxVocalMorpherEffect::set(const EaxCall& call, Props& props) break; case EAXVOCALMORPHER_ALLPARAMETERS: - defer<AllValidator>(call, props); + defer<AllValidator>(call, props.mVocalMorpher); break; case EAXVOCALMORPHER_PHONEMEA: - defer<PhonemeAValidator>(call, props.ulPhonemeA); + defer<PhonemeAValidator>(call, props.mVocalMorpher.ulPhonemeA); break; case EAXVOCALMORPHER_PHONEMEACOARSETUNING: - defer<PhonemeACoarseTuningValidator>(call, props.lPhonemeACoarseTuning); + defer<PhonemeACoarseTuningValidator>(call, props.mVocalMorpher.lPhonemeACoarseTuning); break; case EAXVOCALMORPHER_PHONEMEB: - defer<PhonemeBValidator>(call, props.ulPhonemeB); + defer<PhonemeBValidator>(call, props.mVocalMorpher.ulPhonemeB); break; case EAXVOCALMORPHER_PHONEMEBCOARSETUNING: - defer<PhonemeBCoarseTuningValidator>(call, props.lPhonemeBCoarseTuning); + defer<PhonemeBCoarseTuningValidator>(call, props.mVocalMorpher.lPhonemeBCoarseTuning); break; case EAXVOCALMORPHER_WAVEFORM: - defer<WaveformValidator>(call, props.ulWaveform); + defer<WaveformValidator>(call, props.mVocalMorpher.ulWaveform); break; case EAXVOCALMORPHER_RATE: - defer<RateValidator>(call, props.flRate); + defer<RateValidator>(call, props.mVocalMorpher.flRate); break; default: @@ -525,41 +525,41 @@ void EaxVocalMorpherEffect::set(const EaxCall& call, Props& props) } } -bool EaxVocalMorpherEffect::commit_props(const Props& props) +bool EaxVocalMorpherEffect::commit_props(const Props4& props) { auto is_dirty = false; - if (props_.ulPhonemeA != props.ulPhonemeA) + if (props_.mVocalMorpher.ulPhonemeA != props.mVocalMorpher.ulPhonemeA) { is_dirty = true; set_efx_phoneme_a(); } - if (props_.lPhonemeACoarseTuning != props.lPhonemeACoarseTuning) + if (props_.mVocalMorpher.lPhonemeACoarseTuning != props.mVocalMorpher.lPhonemeACoarseTuning) { is_dirty = true; set_efx_phoneme_a_coarse_tuning(); } - if (props_.ulPhonemeB != props.ulPhonemeB) + if (props_.mVocalMorpher.ulPhonemeB != props.mVocalMorpher.ulPhonemeB) { is_dirty = true; set_efx_phoneme_b(); } - if (props_.lPhonemeBCoarseTuning != props.lPhonemeBCoarseTuning) + if (props_.mVocalMorpher.lPhonemeBCoarseTuning != props.mVocalMorpher.lPhonemeBCoarseTuning) { is_dirty = true; set_efx_phoneme_b_coarse_tuning(); } - if (props_.ulWaveform != props.ulWaveform) + if (props_.mVocalMorpher.ulWaveform != props.mVocalMorpher.ulWaveform) { is_dirty = true; set_efx_waveform(); } - if (props_.flRate != props.flRate) + if (props_.mVocalMorpher.flRate != props.mVocalMorpher.flRate) { is_dirty = true; set_efx_rate(); |