From 4a7fd91857a95dd9ba7c838384671b2a83e46e7d Mon Sep 17 00:00:00 2001 From: Chloe Marcec Date: Thu, 11 Feb 2021 18:46:20 +1100 Subject: audren: Implement I3dl2Reverb Most notable fix is the voices in Fire Emblem Three Houses --- src/audio_core/effect_context.h | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'src/audio_core/effect_context.h') diff --git a/src/audio_core/effect_context.h b/src/audio_core/effect_context.h index c5e0b398c..5e0655dd7 100644 --- a/src/audio_core/effect_context.h +++ b/src/audio_core/effect_context.h @@ -8,6 +8,7 @@ #include #include #include "audio_core/common.h" +#include "audio_core/delay_line.h" #include "common/common_funcs.h" #include "common/common_types.h" #include "common/swap.h" @@ -194,6 +195,8 @@ public: [[nodiscard]] bool IsEnabled() const; [[nodiscard]] s32 GetMixID() const; [[nodiscard]] s32 GetProcessingOrder() const; + [[nodiscard]] std::vector& GetWorkBuffer(); + [[nodiscard]] const std::vector& GetWorkBuffer() const; protected: UsageState usage{UsageState::Invalid}; @@ -201,6 +204,7 @@ protected: s32 mix_id{}; s32 processing_order{}; bool enabled = false; + std::vector work_buffer{}; }; template @@ -212,7 +216,7 @@ public: return internal_params; } - const I3dl2ReverbParams& GetParams() const { + const T& GetParams() const { return internal_params; } @@ -229,6 +233,27 @@ public: void UpdateForCommandGeneration() override; }; +struct I3dl2ReverbState { + f32 lowpass_0{}; + f32 lowpass_1{}; + f32 lowpass_2{}; + + DelayLineBase early_delay_line{}; + std::array early_tap_steps{}; + f32 early_gain{}; + f32 late_gain{}; + + u32 early_to_late_taps{}; + std::array fdn_delay_line{}; + std::array decay_delay_line0{}; + std::array decay_delay_line1{}; + f32 last_reverb_echo{}; + DelayLineBase center_delay_line{}; + std::array, 3> lpf_coefficients{}; + std::array shelf_filter{}; + f32 dry_gain{}; +}; + class EffectI3dl2Reverb : public EffectGeneric { public: explicit EffectI3dl2Reverb(); @@ -237,8 +262,12 @@ public: void Update(EffectInfo::InParams& in_params) override; void UpdateForCommandGeneration() override; + I3dl2ReverbState& GetState(); + const I3dl2ReverbState& GetState() const; + private: bool skipped = false; + I3dl2ReverbState state{}; }; class EffectBiquadFilter : public EffectGeneric { -- cgit v1.2.3