diff options
| author | 2021-02-14 20:09:15 -0800 | |
|---|---|---|
| committer | 2021-02-14 20:09:15 -0800 | |
| commit | 8378b8a61feb971fc4b8af8468938e4691c2cfb7 (patch) | |
| tree | 6df36c0a553a72ad4ec5dca2a5134b44d0f31849 /src/audio_core/effect_context.h | |
| parent | Merge pull request #5920 from bunnei/am-ldn-fix (diff) | |
| parent | revert to std::sin and std::cos (diff) | |
| download | yuzu-8378b8a61feb971fc4b8af8468938e4691c2cfb7.tar.gz yuzu-8378b8a61feb971fc4b8af8468938e4691c2cfb7.tar.xz yuzu-8378b8a61feb971fc4b8af8468938e4691c2cfb7.zip | |
Merge pull request #5909 from ogniK5377/I3dl2Reverb
audren: Implement I3dl2Reverb
Diffstat (limited to 'src/audio_core/effect_context.h')
| -rw-r--r-- | src/audio_core/effect_context.h | 31 |
1 files changed, 30 insertions, 1 deletions
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 @@ | |||
| 8 | #include <memory> | 8 | #include <memory> |
| 9 | #include <vector> | 9 | #include <vector> |
| 10 | #include "audio_core/common.h" | 10 | #include "audio_core/common.h" |
| 11 | #include "audio_core/delay_line.h" | ||
| 11 | #include "common/common_funcs.h" | 12 | #include "common/common_funcs.h" |
| 12 | #include "common/common_types.h" | 13 | #include "common/common_types.h" |
| 13 | #include "common/swap.h" | 14 | #include "common/swap.h" |
| @@ -194,6 +195,8 @@ public: | |||
| 194 | [[nodiscard]] bool IsEnabled() const; | 195 | [[nodiscard]] bool IsEnabled() const; |
| 195 | [[nodiscard]] s32 GetMixID() const; | 196 | [[nodiscard]] s32 GetMixID() const; |
| 196 | [[nodiscard]] s32 GetProcessingOrder() const; | 197 | [[nodiscard]] s32 GetProcessingOrder() const; |
| 198 | [[nodiscard]] std::vector<u8>& GetWorkBuffer(); | ||
| 199 | [[nodiscard]] const std::vector<u8>& GetWorkBuffer() const; | ||
| 197 | 200 | ||
| 198 | protected: | 201 | protected: |
| 199 | UsageState usage{UsageState::Invalid}; | 202 | UsageState usage{UsageState::Invalid}; |
| @@ -201,6 +204,7 @@ protected: | |||
| 201 | s32 mix_id{}; | 204 | s32 mix_id{}; |
| 202 | s32 processing_order{}; | 205 | s32 processing_order{}; |
| 203 | bool enabled = false; | 206 | bool enabled = false; |
| 207 | std::vector<u8> work_buffer{}; | ||
| 204 | }; | 208 | }; |
| 205 | 209 | ||
| 206 | template <typename T> | 210 | template <typename T> |
| @@ -212,7 +216,7 @@ public: | |||
| 212 | return internal_params; | 216 | return internal_params; |
| 213 | } | 217 | } |
| 214 | 218 | ||
| 215 | const I3dl2ReverbParams& GetParams() const { | 219 | const T& GetParams() const { |
| 216 | return internal_params; | 220 | return internal_params; |
| 217 | } | 221 | } |
| 218 | 222 | ||
| @@ -229,6 +233,27 @@ public: | |||
| 229 | void UpdateForCommandGeneration() override; | 233 | void UpdateForCommandGeneration() override; |
| 230 | }; | 234 | }; |
| 231 | 235 | ||
| 236 | struct I3dl2ReverbState { | ||
| 237 | f32 lowpass_0{}; | ||
| 238 | f32 lowpass_1{}; | ||
| 239 | f32 lowpass_2{}; | ||
| 240 | |||
| 241 | DelayLineBase early_delay_line{}; | ||
| 242 | std::array<u32, AudioCommon::I3DL2REVERB_TAPS> early_tap_steps{}; | ||
| 243 | f32 early_gain{}; | ||
| 244 | f32 late_gain{}; | ||
| 245 | |||
| 246 | u32 early_to_late_taps{}; | ||
| 247 | std::array<DelayLineBase, AudioCommon::I3DL2REVERB_DELAY_LINE_COUNT> fdn_delay_line{}; | ||
| 248 | std::array<DelayLineAllPass, AudioCommon::I3DL2REVERB_DELAY_LINE_COUNT> decay_delay_line0{}; | ||
| 249 | std::array<DelayLineAllPass, AudioCommon::I3DL2REVERB_DELAY_LINE_COUNT> decay_delay_line1{}; | ||
| 250 | f32 last_reverb_echo{}; | ||
| 251 | DelayLineBase center_delay_line{}; | ||
| 252 | std::array<std::array<f32, AudioCommon::I3DL2REVERB_DELAY_LINE_COUNT>, 3> lpf_coefficients{}; | ||
| 253 | std::array<f32, AudioCommon::I3DL2REVERB_DELAY_LINE_COUNT> shelf_filter{}; | ||
| 254 | f32 dry_gain{}; | ||
| 255 | }; | ||
| 256 | |||
| 232 | class EffectI3dl2Reverb : public EffectGeneric<I3dl2ReverbParams> { | 257 | class EffectI3dl2Reverb : public EffectGeneric<I3dl2ReverbParams> { |
| 233 | public: | 258 | public: |
| 234 | explicit EffectI3dl2Reverb(); | 259 | explicit EffectI3dl2Reverb(); |
| @@ -237,8 +262,12 @@ public: | |||
| 237 | void Update(EffectInfo::InParams& in_params) override; | 262 | void Update(EffectInfo::InParams& in_params) override; |
| 238 | void UpdateForCommandGeneration() override; | 263 | void UpdateForCommandGeneration() override; |
| 239 | 264 | ||
| 265 | I3dl2ReverbState& GetState(); | ||
| 266 | const I3dl2ReverbState& GetState() const; | ||
| 267 | |||
| 240 | private: | 268 | private: |
| 241 | bool skipped = false; | 269 | bool skipped = false; |
| 270 | I3dl2ReverbState state{}; | ||
| 242 | }; | 271 | }; |
| 243 | 272 | ||
| 244 | class EffectBiquadFilter : public EffectGeneric<BiquadFilterParams> { | 273 | class EffectBiquadFilter : public EffectGeneric<BiquadFilterParams> { |