diff options
author | Chloe Marcec <dmarcecguzman@gmail.com> | 2021-02-11 08:46:20 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2021-02-13 03:48:10 +0100 |
commit | 4a7fd91857a95dd9ba7c838384671b2a83e46e7d (patch) | |
tree | 77dc77e963c2ce5e386d747b76ba19bec89a92b6 /src/audio_core/delay_line.h | |
parent | Merge pull request #5877 from ameerj/res-limit-usage (diff) | |
download | yuzu-4a7fd91857a95dd9ba7c838384671b2a83e46e7d.tar yuzu-4a7fd91857a95dd9ba7c838384671b2a83e46e7d.tar.gz yuzu-4a7fd91857a95dd9ba7c838384671b2a83e46e7d.tar.bz2 yuzu-4a7fd91857a95dd9ba7c838384671b2a83e46e7d.tar.lz yuzu-4a7fd91857a95dd9ba7c838384671b2a83e46e7d.tar.xz yuzu-4a7fd91857a95dd9ba7c838384671b2a83e46e7d.tar.zst yuzu-4a7fd91857a95dd9ba7c838384671b2a83e46e7d.zip |
Diffstat (limited to 'src/audio_core/delay_line.h')
-rw-r--r-- | src/audio_core/delay_line.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/audio_core/delay_line.h b/src/audio_core/delay_line.h new file mode 100644 index 000000000..b6a6e0b12 --- /dev/null +++ b/src/audio_core/delay_line.h @@ -0,0 +1,46 @@ +#pragma once + +#include "common/common_types.h" + +namespace AudioCore { + +class DelayLineBase { +public: + DelayLineBase(); + ~DelayLineBase(); + + void Initialize(s32 _max_delay, float* src_buffer); + void SetDelay(s32 new_delay); + s32 GetDelay() const; + s32 GetMaxDelay() const; + f32 TapOut(s32 last_sample); + f32 Tick(f32 sample); + float* GetInput(); + const float* GetInput() const; + f32 GetOutputSample() const; + void Clear(); + void Reset(); + +protected: + float* buffer{nullptr}; + float* buffer_end{nullptr}; + s32 max_delay{}; + float* input{nullptr}; + float* output{nullptr}; + s32 delay{}; +}; + +class DelayLineAllPass final : public DelayLineBase { +public: + DelayLineAllPass(); + ~DelayLineAllPass(); + + void Initialize(u32 delay, float _coeffcient, f32* src_buffer); + void SetCoefficient(float _coeffcient); + f32 Tick(f32 sample); + void Reset(); + +private: + float coefficient{}; +}; +} // namespace AudioCore |