diff options
author | bunnei <bunneidev@gmail.com> | 2021-02-15 05:09:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-15 05:09:15 +0100 |
commit | 8378b8a61feb971fc4b8af8468938e4691c2cfb7 (patch) | |
tree | 6df36c0a553a72ad4ec5dca2a5134b44d0f31849 /src/audio_core/delay_line.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 yuzu-8378b8a61feb971fc4b8af8468938e4691c2cfb7.tar.gz yuzu-8378b8a61feb971fc4b8af8468938e4691c2cfb7.tar.bz2 yuzu-8378b8a61feb971fc4b8af8468938e4691c2cfb7.tar.lz yuzu-8378b8a61feb971fc4b8af8468938e4691c2cfb7.tar.xz yuzu-8378b8a61feb971fc4b8af8468938e4691c2cfb7.tar.zst yuzu-8378b8a61feb971fc4b8af8468938e4691c2cfb7.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..cafddd432 --- /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 |