This repository has been archived on 2024-03-23. You can view files and clone it, but cannot push or open issues or pull requests.
2021-12-05 21:18:53 +00:00
|
|
|
// Copyright 2021 yuzu Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2021-02-11 07:46:20 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "common/common_types.h"
|
|
|
|
|
|
|
|
namespace AudioCore {
|
|
|
|
|
|
|
|
class DelayLineBase {
|
|
|
|
public:
|
|
|
|
DelayLineBase();
|
|
|
|
~DelayLineBase();
|
|
|
|
|
2021-02-11 08:44:26 +00:00
|
|
|
void Initialize(s32 max_delay_, float* src_buffer);
|
2021-02-11 07:46:20 +00:00
|
|
|
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();
|
|
|
|
|
2021-02-11 08:17:50 +00:00
|
|
|
void Initialize(u32 delay, float coeffcient_, f32* src_buffer);
|
|
|
|
void SetCoefficient(float coeffcient_);
|
2021-02-11 07:46:20 +00:00
|
|
|
f32 Tick(f32 sample);
|
|
|
|
void Reset();
|
|
|
|
|
|
|
|
private:
|
|
|
|
float coefficient{};
|
|
|
|
};
|
|
|
|
} // namespace AudioCore
|