mirror of
https://git.eden-emu.dev/archive/citron
synced 2026-03-31 16:38:33 -04:00
audio_core: Fix reverb effect causing extreme noise on Windows
Fixed multiple bugs in reverb processing: - Early gains for stereo channels not being assigned (missing *=) - Incorrect TapOut pointer arithmetic (extra +1 offset) - Uninitialized input pointer causing crashes - Missing state initialization check - SetDelay not called during parameter updates Co-authored-by: MaranBr <maranbr@outlook.com> Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
@@ -69,6 +70,7 @@ public:
|
||||
buffer.resize(delay_time + 1, 0);
|
||||
buffer_end = &buffer[delay_time];
|
||||
output = &buffer[0];
|
||||
input = &buffer[0];
|
||||
decay = decay_rate;
|
||||
sample_count_max = delay_time;
|
||||
SetDelay(delay_time);
|
||||
@@ -79,7 +81,6 @@ public:
|
||||
return;
|
||||
}
|
||||
sample_count = delay_time;
|
||||
input = &buffer[0];
|
||||
}
|
||||
|
||||
Common::FixedPoint<50, 14> Tick(const Common::FixedPoint<50, 14> sample) {
|
||||
@@ -107,10 +108,13 @@ public:
|
||||
}
|
||||
|
||||
Common::FixedPoint<50, 14> TapOut(const s32 index) const {
|
||||
auto out{input - (index + 1)};
|
||||
const Common::FixedPoint<50, 14>* out{input - index};
|
||||
if (out < buffer.data()) {
|
||||
out += sample_count;
|
||||
}
|
||||
if (out >= buffer_end) {
|
||||
out = buffer.data() + ((out - buffer.data()) % (sample_count_max + 1));
|
||||
}
|
||||
return *out;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user