diff options
| author | Takoroka <137927095+Takoroka@users.noreply.github.com> | 2026-10-27 22:28:10 -0400 |
|---|---|---|
| committer | Takoroka <137927095+Takoroka@users.noreply.github.com> | 2026-10-27 22:28:10 -0400 |
| commit | 81eaf7ccbf07bfc73553d8e752a256aa3719bcb9 (patch) | |
| tree | f29f826c747c092d29b33d25cfe26e0b1d576929 /src/audio_core | |
| parent | 51207c73c889dbdc4a586a5da23314f6d33e4eb9 (diff) | |
Switch 2: back GPU-only regions, pace presents, interleaved split methods
- gpu 214 creates GPU-only memory the graphics server backs itself (title 4
renders everything into six 300 MB regions at 0x81_0000_0000). Back each
with application-pool pages mapped into the alias code region and map that
for the GPU. This is what made title 4's frames appear.
- vi2 229 waits (bounded) for the presented frame's GPU fence: the reply
reports every buffer free, so without this the game laps Eden's GPU thread
and rewrites command memory it has not read yet.
- Split methods: keep several parked methods keyed by resume address (NVN
interleaves command buffers) and drop them when the submission ends.
- hid 214 (per-frame vibration send) answered quietly.
- Debug aids: EDEN_NX2_WINDOW_TRACE / EDEN_NX2_RT_TRACE (render targets,
clears, textures), EDEN_NX2_AUDIO_LEVEL (output peak), EDEN_NX2_PB_DUMP
(command list for offline replay), parsed-entry change check.
Diffstat (limited to 'src/audio_core')
| -rw-r--r-- | src/audio_core/sink/sink_stream.cpp | 15 | ||||
| -rw-r--r-- | src/audio_core/sink/sink_stream.h | 3 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/audio_core/sink/sink_stream.cpp b/src/audio_core/sink/sink_stream.cpp index c70020e9da..9dfd3bf747 100644 --- a/src/audio_core/sink/sink_stream.cpp +++ b/src/audio_core/sink/sink_stream.cpp @@ -4,8 +4,10 @@ // SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include <algorithm> #include <array> #include <atomic> +#include <cstdlib> #include <memory> #include <span> #include <vector> @@ -213,6 +215,19 @@ void SinkStream::ProcessAudioOutAndRender(std::span<s16> output_buffer, std::siz std::memcpy(last_frame.data(), &output_buffer[(frames_written - 1) * frame_size], frame_size_bytes); + // EDEN_NX2_AUDIO_LEVEL: log the output peak about every two seconds (is a game audible?). + if (static const bool meter = std::getenv("EDEN_NX2_AUDIO_LEVEL") != nullptr; meter) { + for (size_t i = 0; i < num_frames * frame_size; ++i) { + level_peak = std::max<s32>(level_peak, std::abs(static_cast<s32>(output_buffer[i]))); + } + level_frames += num_frames; + if (level_frames >= TargetSampleRate * 2) { + LOG_INFO(Audio, "Audio output peak over {} frames: {} of 32767", level_frames, level_peak); + level_frames = 0; + level_peak = 0; + } + } + { std::scoped_lock lk{sample_count_lock}; last_sample_count_update_time = system.CoreTiming().GetGlobalTimeNs(); diff --git a/src/audio_core/sink/sink_stream.h b/src/audio_core/sink/sink_stream.h index acb7537dda..280b7747ec 100644 --- a/src/audio_core/sink/sink_stream.h +++ b/src/audio_core/sink/sink_stream.h @@ -245,6 +245,9 @@ private: SinkBuffer playing_buffer{}; /// The last played (or received) frame of audio, used when the callback underruns std::array<s16, MaxChannels> last_frame{}; + /// EDEN_NX2_AUDIO_LEVEL meter state. + s32 level_peak{}; + u64 level_frames{}; /// Number of buffers waiting to be played std::atomic<u32> queued_buffers{}; /// The ring size for audio out buffers (usually 4, rarely 2 or 8) |
