[audio_core] fix OOB copy when silencing channel on shutdown (#3969)

when shutting down the emulator will silence any remaining audio from the output buffer
however this is for some reason stored in an array instead of being a simple memset
additionally, said array can be small enough (`frame_size_bytes > silence.size()`) to cause a funky noise to play at the end

Signed-off-by: lizzie <lizzie@eden-emu.dev>

Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3969
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Reviewed-by: crueter <crueter@eden-emu.dev>
This commit is contained in:
lizzie 2026-05-31 02:38:26 +02:00 committed by crueter
parent e94ac63a5e
commit 23bb909bc9
No known key found for this signature in database
GPG key ID: 425ACD2D4830EBC6

View file

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
@ -177,10 +177,8 @@ void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::siz
queued_buffers.store(0);
release_cv.notify_one();
}
static constexpr std::array<s16, 6> silence{};
for (size_t i = 0; i < num_frames; i++)
std::memcpy(&output_buffer[i * frame_size], silence.data(), frame_size_bytes);
std::memset(&output_buffer[i * frame_size], 0, frame_size_bytes);
return;
}