2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

address issues

This commit is contained in:
Chloe Marcec 2021-02-11 19:17:50 +11:00 committed by bunnei
parent 4a7fd91857
commit d28b942458
3 changed files with 25 additions and 22 deletions

View file

@ -2,6 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
#include <cmath>
#include <numbers>
#include "audio_core/algorithm/interpolate.h"
#include "audio_core/command_generator.h"
@ -127,7 +128,7 @@ constexpr std::array<std::size_t, 20> REVERB_TAP_INDEX_6CH{4, 0, 0, 1, 1, 1, 1,
1, 1, 1, 0, 0, 0, 0, 3, 3, 3};
template <std::size_t CHANNEL_COUNT>
void ApplyReverbGeneric(const I3dl2ReverbParams& info, I3dl2ReverbState& state,
void ApplyReverbGeneric(I3dl2ReverbState& state,
const std::array<const s32*, AudioCommon::MAX_CHANNEL_COUNT>& input,
const std::array<s32*, AudioCommon::MAX_CHANNEL_COUNT>& output,
s32 sample_count) {
@ -567,16 +568,16 @@ void CommandGenerator::GenerateI3dl2ReverbEffectCommand(s32 mix_buffer_offset, E
if (enabled) {
switch (channel_count) {
case 1:
ApplyReverbGeneric<1>(params, state, input, output, worker_params.sample_count);
ApplyReverbGeneric<1>(state, input, output, worker_params.sample_count);
break;
case 2:
ApplyReverbGeneric<2>(params, state, input, output, worker_params.sample_count);
ApplyReverbGeneric<2>(state, input, output, worker_params.sample_count);
break;
case 4:
ApplyReverbGeneric<4>(params, state, input, output, worker_params.sample_count);
ApplyReverbGeneric<4>(state, input, output, worker_params.sample_count);
break;
case 6:
ApplyReverbGeneric<6>(params, state, input, output, worker_params.sample_count);
ApplyReverbGeneric<6>(state, input, output, worker_params.sample_count);
break;
}
} else {
@ -794,8 +795,8 @@ void CommandGenerator::UpdateI3dl2Reverb(I3dl2ReverbParams& info, I3dl2ReverbSta
state.lowpass_1 = 0.0f;
} else {
const auto a = 1.0f - hf_gain;
const auto b =
2.0f * (1.0f - hf_gain * CosD(256.0f * info.hf_reference / info.sample_rate));
const auto b = 2.0f * (1.0f - hf_gain * CosD(256.0f * info.hf_reference /
static_cast<f32>(info.sample_rate)));
const auto c = std::sqrt(b * b - 4.0f * a * a);
state.lowpass_1 = (b - c) / (2.0f * a);
@ -815,10 +816,11 @@ void CommandGenerator::UpdateI3dl2Reverb(I3dl2ReverbParams& info, I3dl2ReverbSta
state.decay_delay_line0[i].GetDelay() +
state.decay_delay_line1[i].GetDelay();
float a = (-60.0f * delay_sample_counts) / (info.decay_time * info.sample_rate);
float a = (-60.0f * static_cast<f32>(delay_sample_counts)) /
(info.decay_time * static_cast<f32>(info.sample_rate));
float b = a / info.hf_decay_ratio;
float c = CosD(128.0f * 0.5f * info.hf_reference / info.sample_rate) /
SinD(128.0f * 0.5f * info.hf_reference / info.sample_rate);
float c = CosD(128.0f * 0.5f * info.hf_reference / static_cast<f32>(info.sample_rate)) /
SinD(128.0f * 0.5f * info.hf_reference / static_cast<f32>(info.sample_rate));
float d = Pow10((b - a) / 40.0f);
float e = Pow10((b + a) / 40.0f) * 0.7071f;

View file

@ -1,15 +1,16 @@
#include <cstring>
#include "audio_core/delay_line.h"
namespace AudioCore {
DelayLineBase::DelayLineBase() = default;
DelayLineBase::~DelayLineBase() = default;
void DelayLineBase::Initialize(s32 _max_delay, float* src_buffer) {
void DelayLineBase::Initialize(s32 max_delay_, float* src_buffer) {
buffer = src_buffer;
buffer_end = buffer + _max_delay;
max_delay = _max_delay;
buffer_end = buffer + max_delay_;
max_delay = max_delay_;
output = buffer;
SetDelay(_max_delay);
SetDelay(max_delay_);
Clear();
}
@ -30,7 +31,7 @@ s32 DelayLineBase::GetMaxDelay() const {
}
f32 DelayLineBase::TapOut(s32 last_sample) {
float* ptr = input - (last_sample + 1);
const float* ptr = input - (last_sample + 1);
if (ptr < buffer) {
ptr += (max_delay + 1);
}
@ -81,13 +82,13 @@ void DelayLineBase::Reset() {
DelayLineAllPass::DelayLineAllPass() = default;
DelayLineAllPass::~DelayLineAllPass() = default;
void DelayLineAllPass::Initialize(u32 delay, float _coeffcient, f32* src_buffer) {
DelayLineBase::Initialize(delay, src_buffer);
SetCoefficient(_coeffcient);
void DelayLineAllPass::Initialize(u32 delay_, float coeffcient_, f32* src_buffer) {
DelayLineBase::Initialize(delay_, src_buffer);
SetCoefficient(coeffcient_);
}
void DelayLineAllPass::SetCoefficient(float _coeffcient) {
coefficient = _coeffcient;
void DelayLineAllPass::SetCoefficient(float coeffcient_) {
coefficient = coeffcient_;
}
f32 DelayLineAllPass::Tick(f32 sample) {

View file

@ -35,8 +35,8 @@ public:
DelayLineAllPass();
~DelayLineAllPass();
void Initialize(u32 delay, float _coeffcient, f32* src_buffer);
void SetCoefficient(float _coeffcient);
void Initialize(u32 delay, float coeffcient_, f32* src_buffer);
void SetCoefficient(float coeffcient_);
f32 Tick(f32 sample);
void Reset();