diff options
Diffstat (limited to 'src')
218 files changed, 1793 insertions, 1727 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a9f68a8f2..d7f68618c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt | |||
| @@ -24,7 +24,7 @@ if (MSVC) | |||
| 24 | # Ensure that projects build with Unicode support. | 24 | # Ensure that projects build with Unicode support. |
| 25 | add_definitions(-DUNICODE -D_UNICODE) | 25 | add_definitions(-DUNICODE -D_UNICODE) |
| 26 | 26 | ||
| 27 | # /W3 - Level 3 warnings | 27 | # /W4 - Level 4 warnings |
| 28 | # /MP - Multi-threaded compilation | 28 | # /MP - Multi-threaded compilation |
| 29 | # /Zi - Output debugging information | 29 | # /Zi - Output debugging information |
| 30 | # /Zm - Specifies the precompiled header memory allocation limit | 30 | # /Zm - Specifies the precompiled header memory allocation limit |
| @@ -61,7 +61,7 @@ if (MSVC) | |||
| 61 | /external:W0 # Sets the default warning level to 0 for external headers, effectively turning off warnings for external headers | 61 | /external:W0 # Sets the default warning level to 0 for external headers, effectively turning off warnings for external headers |
| 62 | 62 | ||
| 63 | # Warnings | 63 | # Warnings |
| 64 | /W3 | 64 | /W4 |
| 65 | /WX | 65 | /WX |
| 66 | 66 | ||
| 67 | /we4062 # Enumerator 'identifier' in a switch of enum 'enumeration' is not handled | 67 | /we4062 # Enumerator 'identifier' in a switch of enum 'enumeration' is not handled |
| @@ -84,12 +84,17 @@ if (MSVC) | |||
| 84 | 84 | ||
| 85 | /wd4100 # 'identifier': unreferenced formal parameter | 85 | /wd4100 # 'identifier': unreferenced formal parameter |
| 86 | /wd4324 # 'struct_name': structure was padded due to __declspec(align()) | 86 | /wd4324 # 'struct_name': structure was padded due to __declspec(align()) |
| 87 | /wd4201 # nonstandard extension used : nameless struct/union | ||
| 88 | /wd4702 # unreachable code (when used with LTO) | ||
| 87 | ) | 89 | ) |
| 88 | 90 | ||
| 89 | if (USE_CCACHE OR YUZU_USE_PRECOMPILED_HEADERS) | 91 | if (USE_CCACHE OR YUZU_USE_PRECOMPILED_HEADERS) |
| 90 | # when caching, we need to use /Z7 to downgrade debug info to use an older but more cacheable format | 92 | # when caching, we need to use /Z7 to downgrade debug info to use an older but more cacheable format |
| 91 | # Precompiled headers are deleted if not using /Z7. See https://github.com/nanoant/CMakePCHCompiler/issues/21 | 93 | # Precompiled headers are deleted if not using /Z7. See https://github.com/nanoant/CMakePCHCompiler/issues/21 |
| 92 | add_compile_options(/Z7) | 94 | add_compile_options(/Z7) |
| 95 | # Avoid D9025 warning | ||
| 96 | string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") | ||
| 97 | string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") | ||
| 93 | else() | 98 | else() |
| 94 | add_compile_options(/Zi) | 99 | add_compile_options(/Zi) |
| 95 | endif() | 100 | endif() |
diff --git a/src/audio_core/CMakeLists.txt b/src/audio_core/CMakeLists.txt index e7b595459..67dfe0290 100644 --- a/src/audio_core/CMakeLists.txt +++ b/src/audio_core/CMakeLists.txt | |||
| @@ -2,6 +2,14 @@ | |||
| 2 | # SPDX-License-Identifier: GPL-2.0-or-later | 2 | # SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | add_library(audio_core STATIC | 4 | add_library(audio_core STATIC |
| 5 | adsp/adsp.cpp | ||
| 6 | adsp/adsp.h | ||
| 7 | adsp/mailbox.h | ||
| 8 | adsp/apps/audio_renderer/audio_renderer.cpp | ||
| 9 | adsp/apps/audio_renderer/audio_renderer.h | ||
| 10 | adsp/apps/audio_renderer/command_buffer.h | ||
| 11 | adsp/apps/audio_renderer/command_list_processor.cpp | ||
| 12 | adsp/apps/audio_renderer/command_list_processor.h | ||
| 5 | audio_core.cpp | 13 | audio_core.cpp |
| 6 | audio_core.h | 14 | audio_core.h |
| 7 | audio_event.h | 15 | audio_event.h |
| @@ -32,13 +40,6 @@ add_library(audio_core STATIC | |||
| 32 | out/audio_out_system.cpp | 40 | out/audio_out_system.cpp |
| 33 | out/audio_out_system.h | 41 | out/audio_out_system.h |
| 34 | precompiled_headers.h | 42 | precompiled_headers.h |
| 35 | renderer/adsp/adsp.cpp | ||
| 36 | renderer/adsp/adsp.h | ||
| 37 | renderer/adsp/audio_renderer.cpp | ||
| 38 | renderer/adsp/audio_renderer.h | ||
| 39 | renderer/adsp/command_buffer.h | ||
| 40 | renderer/adsp/command_list_processor.cpp | ||
| 41 | renderer/adsp/command_list_processor.h | ||
| 42 | renderer/audio_device.cpp | 43 | renderer/audio_device.cpp |
| 43 | renderer/audio_device.h | 44 | renderer/audio_device.h |
| 44 | renderer/audio_renderer.h | 45 | renderer/audio_renderer.h |
diff --git a/src/audio_core/adsp/adsp.cpp b/src/audio_core/adsp/adsp.cpp new file mode 100644 index 000000000..0580990f5 --- /dev/null +++ b/src/audio_core/adsp/adsp.cpp | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #include "audio_core/adsp/adsp.h" | ||
| 5 | #include "core/core.h" | ||
| 6 | |||
| 7 | namespace AudioCore::ADSP { | ||
| 8 | |||
| 9 | ADSP::ADSP(Core::System& system, Sink::Sink& sink) { | ||
| 10 | audio_renderer = | ||
| 11 | std::make_unique<AudioRenderer::AudioRenderer>(system, system.ApplicationMemory(), sink); | ||
| 12 | } | ||
| 13 | |||
| 14 | AudioRenderer::AudioRenderer& ADSP::AudioRenderer() { | ||
| 15 | return *audio_renderer.get(); | ||
| 16 | } | ||
| 17 | |||
| 18 | } // namespace AudioCore::ADSP | ||
diff --git a/src/audio_core/adsp/adsp.h b/src/audio_core/adsp/adsp.h new file mode 100644 index 000000000..bd5bcc63b --- /dev/null +++ b/src/audio_core/adsp/adsp.h | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include "audio_core/adsp/apps/audio_renderer/audio_renderer.h" | ||
| 7 | #include "common/common_types.h" | ||
| 8 | |||
| 9 | namespace Core { | ||
| 10 | class System; | ||
| 11 | } // namespace Core | ||
| 12 | |||
| 13 | namespace AudioCore { | ||
| 14 | namespace Sink { | ||
| 15 | class Sink; | ||
| 16 | } | ||
| 17 | |||
| 18 | namespace ADSP { | ||
| 19 | |||
| 20 | /** | ||
| 21 | * Represents the ADSP embedded within the audio sysmodule. | ||
| 22 | * This is a 32-bit Linux4Tegra kernel from nVidia, which is launched with the sysmodule on boot. | ||
| 23 | * | ||
| 24 | * The kernel will run the apps you write for it, Nintendo have the following: | ||
| 25 | * | ||
| 26 | * Gmix - Responsible for mixing final audio and sending it out to hardware. This is last place all | ||
| 27 | * audio samples end up, and we skip it entirely, since we have very different backends and | ||
| 28 | * mixing is implicitly handled by the OS (but also due to lack of research/simplicity). | ||
| 29 | * | ||
| 30 | * AudioRenderer - Receives command lists generated by the audio render | ||
| 31 | * system on the host, processes them, and sends the samples to Gmix. | ||
| 32 | * | ||
| 33 | * OpusDecoder - Contains libopus, and decodes Opus audio packets into raw pcm data. | ||
| 34 | * | ||
| 35 | * Communication between the host and ADSP is done through mailboxes, and mapping of shared memory. | ||
| 36 | */ | ||
| 37 | class ADSP { | ||
| 38 | public: | ||
| 39 | explicit ADSP(Core::System& system, Sink::Sink& sink); | ||
| 40 | ~ADSP() = default; | ||
| 41 | |||
| 42 | AudioRenderer::AudioRenderer& AudioRenderer(); | ||
| 43 | |||
| 44 | private: | ||
| 45 | /// AudioRenderer app | ||
| 46 | std::unique_ptr<AudioRenderer::AudioRenderer> audio_renderer{}; | ||
| 47 | }; | ||
| 48 | |||
| 49 | } // namespace ADSP | ||
| 50 | } // namespace AudioCore | ||
diff --git a/src/audio_core/adsp/apps/audio_renderer/audio_renderer.cpp b/src/audio_core/adsp/apps/audio_renderer/audio_renderer.cpp new file mode 100644 index 000000000..2e549bc6f --- /dev/null +++ b/src/audio_core/adsp/apps/audio_renderer/audio_renderer.cpp | |||
| @@ -0,0 +1,220 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #include <array> | ||
| 5 | #include <chrono> | ||
| 6 | |||
| 7 | #include "audio_core/adsp/apps/audio_renderer/audio_renderer.h" | ||
| 8 | #include "audio_core/audio_core.h" | ||
| 9 | #include "audio_core/common/common.h" | ||
| 10 | #include "audio_core/sink/sink.h" | ||
| 11 | #include "common/logging/log.h" | ||
| 12 | #include "common/microprofile.h" | ||
| 13 | #include "common/thread.h" | ||
| 14 | #include "core/core.h" | ||
| 15 | #include "core/core_timing.h" | ||
| 16 | |||
| 17 | MICROPROFILE_DEFINE(Audio_Renderer, "Audio", "DSP", MP_RGB(60, 19, 97)); | ||
| 18 | |||
| 19 | namespace AudioCore::ADSP::AudioRenderer { | ||
| 20 | |||
| 21 | AudioRenderer::AudioRenderer(Core::System& system_, Core::Memory::Memory& memory_, | ||
| 22 | Sink::Sink& sink_) | ||
| 23 | : system{system_}, memory{memory_}, sink{sink_} {} | ||
| 24 | |||
| 25 | AudioRenderer::~AudioRenderer() { | ||
| 26 | Stop(); | ||
| 27 | } | ||
| 28 | |||
| 29 | void AudioRenderer::Start() { | ||
| 30 | CreateSinkStreams(); | ||
| 31 | |||
| 32 | mailbox.Initialize(AppMailboxId::AudioRenderer); | ||
| 33 | |||
| 34 | main_thread = std::jthread([this](std::stop_token stop_token) { Main(stop_token); }); | ||
| 35 | |||
| 36 | mailbox.Send(Direction::DSP, {Message::InitializeOK, {}}); | ||
| 37 | if (mailbox.Receive(Direction::Host).msg != Message::InitializeOK) { | ||
| 38 | LOG_ERROR(Service_Audio, "Host Audio Renderer -- Failed to receive shutdown " | ||
| 39 | "message response from ADSP!"); | ||
| 40 | return; | ||
| 41 | } | ||
| 42 | running = true; | ||
| 43 | } | ||
| 44 | |||
| 45 | void AudioRenderer::Stop() { | ||
| 46 | if (!running) { | ||
| 47 | return; | ||
| 48 | } | ||
| 49 | |||
| 50 | mailbox.Send(Direction::DSP, {Message::Shutdown, {}}); | ||
| 51 | if (mailbox.Receive(Direction::Host).msg != Message::Shutdown) { | ||
| 52 | LOG_ERROR(Service_Audio, "Host Audio Renderer -- Failed to receive shutdown " | ||
| 53 | "message response from ADSP!"); | ||
| 54 | } | ||
| 55 | main_thread.request_stop(); | ||
| 56 | main_thread.join(); | ||
| 57 | |||
| 58 | for (auto& stream : streams) { | ||
| 59 | if (stream) { | ||
| 60 | stream->Stop(); | ||
| 61 | sink.CloseStream(stream); | ||
| 62 | stream = nullptr; | ||
| 63 | } | ||
| 64 | } | ||
| 65 | running = false; | ||
| 66 | } | ||
| 67 | |||
| 68 | void AudioRenderer::Signal() { | ||
| 69 | signalled_tick = system.CoreTiming().GetGlobalTimeNs().count(); | ||
| 70 | Send(Direction::DSP, {Message::Render, {}}); | ||
| 71 | } | ||
| 72 | |||
| 73 | void AudioRenderer::Wait() { | ||
| 74 | auto received = Receive(Direction::Host); | ||
| 75 | if (received.msg != Message::RenderResponse) { | ||
| 76 | LOG_ERROR(Service_Audio, | ||
| 77 | "Did not receive the expected render response from the AudioRenderer! Expected " | ||
| 78 | "{}, got {}", | ||
| 79 | Message::RenderResponse, received.msg); | ||
| 80 | } | ||
| 81 | } | ||
| 82 | |||
| 83 | void AudioRenderer::Send(Direction dir, MailboxMessage message) { | ||
| 84 | mailbox.Send(dir, std::move(message)); | ||
| 85 | } | ||
| 86 | |||
| 87 | MailboxMessage AudioRenderer::Receive(Direction dir, bool block) { | ||
| 88 | return mailbox.Receive(dir, block); | ||
| 89 | } | ||
| 90 | |||
| 91 | void AudioRenderer::SetCommandBuffer(s32 session_id, CpuAddr buffer, u64 size, u64 time_limit, | ||
| 92 | u64 applet_resource_user_id, bool reset) noexcept { | ||
| 93 | command_buffers[session_id].buffer = buffer; | ||
| 94 | command_buffers[session_id].size = size; | ||
| 95 | command_buffers[session_id].time_limit = time_limit; | ||
| 96 | command_buffers[session_id].applet_resource_user_id = applet_resource_user_id; | ||
| 97 | command_buffers[session_id].reset_buffer = reset; | ||
| 98 | } | ||
| 99 | |||
| 100 | u32 AudioRenderer::GetRemainCommandCount(s32 session_id) const noexcept { | ||
| 101 | return command_buffers[session_id].remaining_command_count; | ||
| 102 | } | ||
| 103 | |||
| 104 | void AudioRenderer::ClearRemainCommandCount(s32 session_id) noexcept { | ||
| 105 | command_buffers[session_id].remaining_command_count = 0; | ||
| 106 | } | ||
| 107 | |||
| 108 | u64 AudioRenderer::GetRenderingStartTick(s32 session_id) const noexcept { | ||
| 109 | return (1000 * command_buffers[session_id].render_time_taken_us) + signalled_tick; | ||
| 110 | } | ||
| 111 | |||
| 112 | void AudioRenderer::CreateSinkStreams() { | ||
| 113 | u32 channels{sink.GetDeviceChannels()}; | ||
| 114 | for (u32 i = 0; i < MaxRendererSessions; i++) { | ||
| 115 | std::string name{fmt::format("ADSP_RenderStream-{}", i)}; | ||
| 116 | streams[i] = | ||
| 117 | sink.AcquireSinkStream(system, channels, name, ::AudioCore::Sink::StreamType::Render); | ||
| 118 | streams[i]->SetRingSize(4); | ||
| 119 | } | ||
| 120 | } | ||
| 121 | |||
| 122 | void AudioRenderer::Main(std::stop_token stop_token) { | ||
| 123 | static constexpr char name[]{"AudioRenderer"}; | ||
| 124 | MicroProfileOnThreadCreate(name); | ||
| 125 | Common::SetCurrentThreadName(name); | ||
| 126 | Common::SetCurrentThreadPriority(Common::ThreadPriority::High); | ||
| 127 | |||
| 128 | // TODO: Create buffer map/unmap thread + mailbox | ||
| 129 | // TODO: Create gMix devices, initialize them here | ||
| 130 | |||
| 131 | if (mailbox.Receive(Direction::DSP).msg != Message::InitializeOK) { | ||
| 132 | LOG_ERROR(Service_Audio, | ||
| 133 | "ADSP Audio Renderer -- Failed to receive initialize message from host!"); | ||
| 134 | return; | ||
| 135 | } | ||
| 136 | |||
| 137 | mailbox.Send(Direction::Host, {Message::InitializeOK, {}}); | ||
| 138 | |||
| 139 | // 0.12 seconds (2,304,000 / 19,200,000) | ||
| 140 | constexpr u64 max_process_time{2'304'000ULL}; | ||
| 141 | |||
| 142 | while (!stop_token.stop_requested()) { | ||
| 143 | auto received{mailbox.Receive(Direction::DSP)}; | ||
| 144 | switch (received.msg) { | ||
| 145 | case Message::Shutdown: | ||
| 146 | mailbox.Send(Direction::Host, {Message::Shutdown, {}}); | ||
| 147 | return; | ||
| 148 | |||
| 149 | case Message::Render: { | ||
| 150 | if (system.IsShuttingDown()) [[unlikely]] { | ||
| 151 | std::this_thread::sleep_for(std::chrono::milliseconds(5)); | ||
| 152 | mailbox.Send(Direction::Host, {Message::RenderResponse, {}}); | ||
| 153 | continue; | ||
| 154 | } | ||
| 155 | std::array<bool, MaxRendererSessions> buffers_reset{}; | ||
| 156 | std::array<u64, MaxRendererSessions> render_times_taken{}; | ||
| 157 | const auto start_time{system.CoreTiming().GetGlobalTimeUs().count()}; | ||
| 158 | |||
| 159 | for (u32 index = 0; index < MaxRendererSessions; index++) { | ||
| 160 | auto& command_buffer{command_buffers[index]}; | ||
| 161 | auto& command_list_processor{command_list_processors[index]}; | ||
| 162 | |||
| 163 | // Check this buffer is valid, as it may not be used. | ||
| 164 | if (command_buffer.buffer != 0) { | ||
| 165 | // If there are no remaining commands (from the previous list), | ||
| 166 | // this is a new command list, initialize it. | ||
| 167 | if (command_buffer.remaining_command_count == 0) { | ||
| 168 | command_list_processor.Initialize(system, command_buffer.buffer, | ||
| 169 | command_buffer.size, streams[index]); | ||
| 170 | } | ||
| 171 | |||
| 172 | if (command_buffer.reset_buffer && !buffers_reset[index]) { | ||
| 173 | streams[index]->ClearQueue(); | ||
| 174 | buffers_reset[index] = true; | ||
| 175 | } | ||
| 176 | |||
| 177 | u64 max_time{max_process_time}; | ||
| 178 | if (index == 1 && command_buffer.applet_resource_user_id == | ||
| 179 | command_buffers[0].applet_resource_user_id) { | ||
| 180 | max_time = max_process_time - render_times_taken[0]; | ||
| 181 | if (render_times_taken[0] > max_process_time) { | ||
| 182 | max_time = 0; | ||
| 183 | } | ||
| 184 | } | ||
| 185 | |||
| 186 | max_time = std::min(command_buffer.time_limit, max_time); | ||
| 187 | command_list_processor.SetProcessTimeMax(max_time); | ||
| 188 | |||
| 189 | if (index == 0) { | ||
| 190 | streams[index]->WaitFreeSpace(stop_token); | ||
| 191 | } | ||
| 192 | |||
| 193 | // Process the command list | ||
| 194 | { | ||
| 195 | MICROPROFILE_SCOPE(Audio_Renderer); | ||
| 196 | render_times_taken[index] = | ||
| 197 | command_list_processor.Process(index) - start_time; | ||
| 198 | } | ||
| 199 | |||
| 200 | const auto end_time{system.CoreTiming().GetGlobalTimeUs().count()}; | ||
| 201 | |||
| 202 | command_buffer.remaining_command_count = | ||
| 203 | command_list_processor.GetRemainingCommandCount(); | ||
| 204 | command_buffer.render_time_taken_us = end_time - start_time; | ||
| 205 | } | ||
| 206 | } | ||
| 207 | |||
| 208 | mailbox.Send(Direction::Host, {Message::RenderResponse, {}}); | ||
| 209 | } break; | ||
| 210 | |||
| 211 | default: | ||
| 212 | LOG_WARNING(Service_Audio, | ||
| 213 | "ADSP AudioRenderer received an invalid message, msg={:02X}!", | ||
| 214 | received.msg); | ||
| 215 | break; | ||
| 216 | } | ||
| 217 | } | ||
| 218 | } | ||
| 219 | |||
| 220 | } // namespace AudioCore::ADSP::AudioRenderer | ||
diff --git a/src/audio_core/adsp/apps/audio_renderer/audio_renderer.h b/src/audio_core/adsp/apps/audio_renderer/audio_renderer.h new file mode 100644 index 000000000..3f5b7dca2 --- /dev/null +++ b/src/audio_core/adsp/apps/audio_renderer/audio_renderer.h | |||
| @@ -0,0 +1,116 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include <array> | ||
| 7 | #include <memory> | ||
| 8 | #include <thread> | ||
| 9 | |||
| 10 | #include "audio_core/adsp/apps/audio_renderer/command_buffer.h" | ||
| 11 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" | ||
| 12 | #include "audio_core/adsp/mailbox.h" | ||
| 13 | #include "common/common_types.h" | ||
| 14 | #include "common/polyfill_thread.h" | ||
| 15 | #include "common/reader_writer_queue.h" | ||
| 16 | #include "common/thread.h" | ||
| 17 | |||
| 18 | namespace Core { | ||
| 19 | class System; | ||
| 20 | namespace Timing { | ||
| 21 | struct EventType; | ||
| 22 | } | ||
| 23 | namespace Memory { | ||
| 24 | class Memory; | ||
| 25 | } | ||
| 26 | class System; | ||
| 27 | } // namespace Core | ||
| 28 | |||
| 29 | namespace AudioCore { | ||
| 30 | namespace Sink { | ||
| 31 | class Sink; | ||
| 32 | } | ||
| 33 | |||
| 34 | namespace ADSP::AudioRenderer { | ||
| 35 | |||
| 36 | enum Message : u32 { | ||
| 37 | Invalid = 0x00, | ||
| 38 | MapUnmap_Map = 0x01, | ||
| 39 | MapUnmap_MapResponse = 0x02, | ||
| 40 | MapUnmap_Unmap = 0x03, | ||
| 41 | MapUnmap_UnmapResponse = 0x04, | ||
| 42 | MapUnmap_InvalidateCache = 0x05, | ||
| 43 | MapUnmap_InvalidateCacheResponse = 0x06, | ||
| 44 | MapUnmap_Shutdown = 0x07, | ||
| 45 | MapUnmap_ShutdownResponse = 0x08, | ||
| 46 | InitializeOK = 0x16, | ||
| 47 | RenderResponse = 0x20, | ||
| 48 | Render = 0x2A, | ||
| 49 | Shutdown = 0x34, | ||
| 50 | }; | ||
| 51 | |||
| 52 | /** | ||
| 53 | * The AudioRenderer application running on the ADSP. | ||
| 54 | */ | ||
| 55 | class AudioRenderer { | ||
| 56 | public: | ||
| 57 | explicit AudioRenderer(Core::System& system, Core::Memory::Memory& memory, Sink::Sink& sink); | ||
| 58 | ~AudioRenderer(); | ||
| 59 | |||
| 60 | /** | ||
| 61 | * Start the AudioRenderer. | ||
| 62 | * | ||
| 63 | * @param mailbox The mailbox to use for this session. | ||
| 64 | */ | ||
| 65 | void Start(); | ||
| 66 | |||
| 67 | /** | ||
| 68 | * Stop the AudioRenderer. | ||
| 69 | */ | ||
| 70 | void Stop(); | ||
| 71 | |||
| 72 | void Signal(); | ||
| 73 | void Wait(); | ||
| 74 | |||
| 75 | void Send(Direction dir, MailboxMessage message); | ||
| 76 | MailboxMessage Receive(Direction dir, bool block = true); | ||
| 77 | |||
| 78 | void SetCommandBuffer(s32 session_id, CpuAddr buffer, u64 size, u64 time_limit, | ||
| 79 | u64 applet_resource_user_id, bool reset) noexcept; | ||
| 80 | u32 GetRemainCommandCount(s32 session_id) const noexcept; | ||
| 81 | void ClearRemainCommandCount(s32 session_id) noexcept; | ||
| 82 | u64 GetRenderingStartTick(s32 session_id) const noexcept; | ||
| 83 | |||
| 84 | private: | ||
| 85 | /** | ||
| 86 | * Main AudioRenderer thread, responsible for processing the command lists. | ||
| 87 | */ | ||
| 88 | void Main(std::stop_token stop_token); | ||
| 89 | |||
| 90 | /** | ||
| 91 | * Creates the streams which will receive the processed samples. | ||
| 92 | */ | ||
| 93 | void CreateSinkStreams(); | ||
| 94 | |||
| 95 | /// Core system | ||
| 96 | Core::System& system; | ||
| 97 | /// Memory | ||
| 98 | Core::Memory::Memory& memory; | ||
| 99 | /// The output sink the AudioRenderer will use | ||
| 100 | Sink::Sink& sink; | ||
| 101 | /// The active mailbox | ||
| 102 | Mailbox mailbox; | ||
| 103 | /// Main thread | ||
| 104 | std::jthread main_thread{}; | ||
| 105 | /// The current state | ||
| 106 | std::atomic<bool> running{}; | ||
| 107 | std::array<CommandBuffer, MaxRendererSessions> command_buffers{}; | ||
| 108 | /// The command lists to process | ||
| 109 | std::array<CommandListProcessor, MaxRendererSessions> command_list_processors{}; | ||
| 110 | /// The streams which will receive the processed samples | ||
| 111 | std::array<Sink::SinkStream*, MaxRendererSessions> streams{}; | ||
| 112 | u64 signalled_tick{0}; | ||
| 113 | }; | ||
| 114 | |||
| 115 | } // namespace ADSP::AudioRenderer | ||
| 116 | } // namespace AudioCore | ||
diff --git a/src/audio_core/adsp/apps/audio_renderer/command_buffer.h b/src/audio_core/adsp/apps/audio_renderer/command_buffer.h new file mode 100644 index 000000000..3fd1b09dc --- /dev/null +++ b/src/audio_core/adsp/apps/audio_renderer/command_buffer.h | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include "audio_core/common/common.h" | ||
| 7 | #include "common/common_types.h" | ||
| 8 | |||
| 9 | namespace AudioCore::ADSP::AudioRenderer { | ||
| 10 | |||
| 11 | struct CommandBuffer { | ||
| 12 | // Set by the host | ||
| 13 | CpuAddr buffer{}; | ||
| 14 | u64 size{}; | ||
| 15 | u64 time_limit{}; | ||
| 16 | u64 applet_resource_user_id{}; | ||
| 17 | bool reset_buffer{}; | ||
| 18 | // Set by the DSP | ||
| 19 | u32 remaining_command_count{}; | ||
| 20 | u64 render_time_taken_us{}; | ||
| 21 | }; | ||
| 22 | |||
| 23 | } // namespace AudioCore::ADSP::AudioRenderer | ||
diff --git a/src/audio_core/renderer/adsp/command_list_processor.cpp b/src/audio_core/adsp/apps/audio_renderer/command_list_processor.cpp index 3a0f1ae38..24e4d0496 100644 --- a/src/audio_core/renderer/adsp/command_list_processor.cpp +++ b/src/audio_core/adsp/apps/audio_renderer/command_list_processor.cpp | |||
| @@ -1,9 +1,9 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include <string> | 4 | #include <string> |
| 5 | 5 | ||
| 6 | #include "audio_core/renderer/adsp/command_list_processor.h" | 6 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" |
| 7 | #include "audio_core/renderer/command/command_list_header.h" | 7 | #include "audio_core/renderer/command/command_list_header.h" |
| 8 | #include "audio_core/renderer/command/commands.h" | 8 | #include "audio_core/renderer/command/commands.h" |
| 9 | #include "common/settings.h" | 9 | #include "common/settings.h" |
| @@ -11,15 +11,15 @@ | |||
| 11 | #include "core/core_timing.h" | 11 | #include "core/core_timing.h" |
| 12 | #include "core/memory.h" | 12 | #include "core/memory.h" |
| 13 | 13 | ||
| 14 | namespace AudioCore::AudioRenderer::ADSP { | 14 | namespace AudioCore::ADSP::AudioRenderer { |
| 15 | 15 | ||
| 16 | void CommandListProcessor::Initialize(Core::System& system_, CpuAddr buffer, u64 size, | 16 | void CommandListProcessor::Initialize(Core::System& system_, CpuAddr buffer, u64 size, |
| 17 | Sink::SinkStream* stream_) { | 17 | Sink::SinkStream* stream_) { |
| 18 | system = &system_; | 18 | system = &system_; |
| 19 | memory = &system->ApplicationMemory(); | 19 | memory = &system->ApplicationMemory(); |
| 20 | stream = stream_; | 20 | stream = stream_; |
| 21 | header = reinterpret_cast<CommandListHeader*>(buffer); | 21 | header = reinterpret_cast<Renderer::CommandListHeader*>(buffer); |
| 22 | commands = reinterpret_cast<u8*>(buffer + sizeof(CommandListHeader)); | 22 | commands = reinterpret_cast<u8*>(buffer + sizeof(Renderer::CommandListHeader)); |
| 23 | commands_buffer_size = size; | 23 | commands_buffer_size = size; |
| 24 | command_count = header->command_count; | 24 | command_count = header->command_count; |
| 25 | sample_count = header->sample_count; | 25 | sample_count = header->sample_count; |
| @@ -37,17 +37,12 @@ u32 CommandListProcessor::GetRemainingCommandCount() const { | |||
| 37 | return command_count - processed_command_count; | 37 | return command_count - processed_command_count; |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | void CommandListProcessor::SetBuffer(const CpuAddr buffer, const u64 size) { | ||
| 41 | commands = reinterpret_cast<u8*>(buffer + sizeof(CommandListHeader)); | ||
| 42 | commands_buffer_size = size; | ||
| 43 | } | ||
| 44 | |||
| 45 | Sink::SinkStream* CommandListProcessor::GetOutputSinkStream() const { | 40 | Sink::SinkStream* CommandListProcessor::GetOutputSinkStream() const { |
| 46 | return stream; | 41 | return stream; |
| 47 | } | 42 | } |
| 48 | 43 | ||
| 49 | u64 CommandListProcessor::Process(u32 session_id) { | 44 | u64 CommandListProcessor::Process(u32 session_id) { |
| 50 | const auto start_time_{system->CoreTiming().GetClockTicks()}; | 45 | const auto start_time_{system->CoreTiming().GetGlobalTimeUs().count()}; |
| 51 | const auto command_base{CpuAddr(commands)}; | 46 | const auto command_base{CpuAddr(commands)}; |
| 52 | 47 | ||
| 53 | if (processed_command_count > 0) { | 48 | if (processed_command_count > 0) { |
| @@ -60,12 +55,12 @@ u64 CommandListProcessor::Process(u32 session_id) { | |||
| 60 | std::string dump{fmt::format("\nSession {}\n", session_id)}; | 55 | std::string dump{fmt::format("\nSession {}\n", session_id)}; |
| 61 | 56 | ||
| 62 | for (u32 index = 0; index < command_count; index++) { | 57 | for (u32 index = 0; index < command_count; index++) { |
| 63 | auto& command{*reinterpret_cast<ICommand*>(commands)}; | 58 | auto& command{*reinterpret_cast<Renderer::ICommand*>(commands)}; |
| 64 | 59 | ||
| 65 | if (command.magic != 0xCAFEBABE) { | 60 | if (command.magic != 0xCAFEBABE) { |
| 66 | LOG_ERROR(Service_Audio, "Command has invalid magic! Expected 0xCAFEBABE, got {:08X}", | 61 | LOG_ERROR(Service_Audio, "Command has invalid magic! Expected 0xCAFEBABE, got {:08X}", |
| 67 | command.magic); | 62 | command.magic); |
| 68 | return system->CoreTiming().GetClockTicks() - start_time_; | 63 | return system->CoreTiming().GetGlobalTimeUs().count() - start_time_; |
| 69 | } | 64 | } |
| 70 | 65 | ||
| 71 | auto current_offset{CpuAddr(commands) - command_base}; | 66 | auto current_offset{CpuAddr(commands) - command_base}; |
| @@ -74,8 +69,8 @@ u64 CommandListProcessor::Process(u32 session_id) { | |||
| 74 | LOG_ERROR(Service_Audio, | 69 | LOG_ERROR(Service_Audio, |
| 75 | "Command exceeded command buffer, buffer size {:08X}, command ends at {:08X}", | 70 | "Command exceeded command buffer, buffer size {:08X}, command ends at {:08X}", |
| 76 | commands_buffer_size, | 71 | commands_buffer_size, |
| 77 | CpuAddr(commands) + command.size - sizeof(CommandListHeader)); | 72 | CpuAddr(commands) + command.size - sizeof(Renderer::CommandListHeader)); |
| 78 | return system->CoreTiming().GetClockTicks() - start_time_; | 73 | return system->CoreTiming().GetGlobalTimeUs().count() - start_time_; |
| 79 | } | 74 | } |
| 80 | 75 | ||
| 81 | if (Settings::values.dump_audio_commands) { | 76 | if (Settings::values.dump_audio_commands) { |
| @@ -101,8 +96,8 @@ u64 CommandListProcessor::Process(u32 session_id) { | |||
| 101 | last_dump = dump; | 96 | last_dump = dump; |
| 102 | } | 97 | } |
| 103 | 98 | ||
| 104 | end_time = system->CoreTiming().GetClockTicks(); | 99 | end_time = system->CoreTiming().GetGlobalTimeUs().count(); |
| 105 | return end_time - start_time_; | 100 | return end_time - start_time_; |
| 106 | } | 101 | } |
| 107 | 102 | ||
| 108 | } // namespace AudioCore::AudioRenderer::ADSP | 103 | } // namespace AudioCore::ADSP::AudioRenderer |
diff --git a/src/audio_core/renderer/adsp/command_list_processor.h b/src/audio_core/adsp/apps/audio_renderer/command_list_processor.h index d78269e1d..4e5fb793e 100644 --- a/src/audio_core/renderer/adsp/command_list_processor.h +++ b/src/audio_core/adsp/apps/audio_renderer/command_list_processor.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| @@ -6,6 +6,7 @@ | |||
| 6 | #include <span> | 6 | #include <span> |
| 7 | 7 | ||
| 8 | #include "audio_core/common/common.h" | 8 | #include "audio_core/common/common.h" |
| 9 | #include "audio_core/renderer/command/command_list_header.h" | ||
| 9 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 10 | 11 | ||
| 11 | namespace Core { | 12 | namespace Core { |
| @@ -20,10 +21,11 @@ namespace Sink { | |||
| 20 | class SinkStream; | 21 | class SinkStream; |
| 21 | } | 22 | } |
| 22 | 23 | ||
| 23 | namespace AudioRenderer { | 24 | namespace Renderer { |
| 24 | struct CommandListHeader; | 25 | struct CommandListHeader; |
| 26 | } | ||
| 25 | 27 | ||
| 26 | namespace ADSP { | 28 | namespace ADSP::AudioRenderer { |
| 27 | 29 | ||
| 28 | /** | 30 | /** |
| 29 | * A processor for command lists given to the AudioRenderer. | 31 | * A processor for command lists given to the AudioRenderer. |
| @@ -55,14 +57,6 @@ public: | |||
| 55 | u32 GetRemainingCommandCount() const; | 57 | u32 GetRemainingCommandCount() const; |
| 56 | 58 | ||
| 57 | /** | 59 | /** |
| 58 | * Set the command buffer. | ||
| 59 | * | ||
| 60 | * @param buffer - The buffer to use. | ||
| 61 | * @param size - The size of the buffer. | ||
| 62 | */ | ||
| 63 | void SetBuffer(CpuAddr buffer, u64 size); | ||
| 64 | |||
| 65 | /** | ||
| 66 | * Get the stream for this command list. | 60 | * Get the stream for this command list. |
| 67 | * | 61 | * |
| 68 | * @return The stream associated with this command list. | 62 | * @return The stream associated with this command list. |
| @@ -85,7 +79,7 @@ public: | |||
| 85 | /// Stream for the processed samples | 79 | /// Stream for the processed samples |
| 86 | Sink::SinkStream* stream{}; | 80 | Sink::SinkStream* stream{}; |
| 87 | /// Header info for this command list | 81 | /// Header info for this command list |
| 88 | CommandListHeader* header{}; | 82 | Renderer::CommandListHeader* header{}; |
| 89 | /// The command buffer | 83 | /// The command buffer |
| 90 | u8* commands{}; | 84 | u8* commands{}; |
| 91 | /// The command buffer size | 85 | /// The command buffer size |
| @@ -114,6 +108,5 @@ public: | |||
| 114 | std::string last_dump{}; | 108 | std::string last_dump{}; |
| 115 | }; | 109 | }; |
| 116 | 110 | ||
| 117 | } // namespace ADSP | 111 | } // namespace ADSP::AudioRenderer |
| 118 | } // namespace AudioRenderer | ||
| 119 | } // namespace AudioCore | 112 | } // namespace AudioCore |
diff --git a/src/audio_core/adsp/mailbox.h b/src/audio_core/adsp/mailbox.h new file mode 100644 index 000000000..c31b73717 --- /dev/null +++ b/src/audio_core/adsp/mailbox.h | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include "common/bounded_threadsafe_queue.h" | ||
| 7 | #include "common/common_types.h" | ||
| 8 | |||
| 9 | namespace AudioCore::ADSP { | ||
| 10 | |||
| 11 | enum class AppMailboxId : u32 { | ||
| 12 | Invalid = 0, | ||
| 13 | AudioRenderer = 50, | ||
| 14 | AudioRendererMemoryMapUnmap = 51, | ||
| 15 | }; | ||
| 16 | |||
| 17 | enum class Direction : u32 { | ||
| 18 | Host, | ||
| 19 | DSP, | ||
| 20 | }; | ||
| 21 | |||
| 22 | struct MailboxMessage { | ||
| 23 | u32 msg; | ||
| 24 | std::span<u8> data; | ||
| 25 | }; | ||
| 26 | |||
| 27 | class Mailbox { | ||
| 28 | public: | ||
| 29 | void Initialize(AppMailboxId id_) { | ||
| 30 | Reset(); | ||
| 31 | id = id_; | ||
| 32 | } | ||
| 33 | |||
| 34 | AppMailboxId Id() const noexcept { | ||
| 35 | return id; | ||
| 36 | } | ||
| 37 | |||
| 38 | void Send(Direction dir, MailboxMessage&& message) { | ||
| 39 | auto& queue = dir == Direction::Host ? host_queue : adsp_queue; | ||
| 40 | queue.EmplaceWait(std::move(message)); | ||
| 41 | } | ||
| 42 | |||
| 43 | MailboxMessage Receive(Direction dir, bool block = true) { | ||
| 44 | auto& queue = dir == Direction::Host ? host_queue : adsp_queue; | ||
| 45 | MailboxMessage t; | ||
| 46 | if (block) { | ||
| 47 | queue.PopWait(t); | ||
| 48 | } else { | ||
| 49 | queue.TryPop(t); | ||
| 50 | } | ||
| 51 | return t; | ||
| 52 | } | ||
| 53 | |||
| 54 | void Reset() { | ||
| 55 | id = AppMailboxId::Invalid; | ||
| 56 | MailboxMessage t; | ||
| 57 | while (host_queue.TryPop(t)) { | ||
| 58 | } | ||
| 59 | while (adsp_queue.TryPop(t)) { | ||
| 60 | } | ||
| 61 | } | ||
| 62 | |||
| 63 | private: | ||
| 64 | AppMailboxId id{0}; | ||
| 65 | Common::SPSCQueue<MailboxMessage> host_queue; | ||
| 66 | Common::SPSCQueue<MailboxMessage> adsp_queue; | ||
| 67 | }; | ||
| 68 | |||
| 69 | } // namespace AudioCore::ADSP | ||
diff --git a/src/audio_core/audio_core.cpp b/src/audio_core/audio_core.cpp index 703ef4494..fcaab2b32 100644 --- a/src/audio_core/audio_core.cpp +++ b/src/audio_core/audio_core.cpp | |||
| @@ -11,7 +11,7 @@ namespace AudioCore { | |||
| 11 | AudioCore::AudioCore(Core::System& system) : audio_manager{std::make_unique<AudioManager>()} { | 11 | AudioCore::AudioCore(Core::System& system) : audio_manager{std::make_unique<AudioManager>()} { |
| 12 | CreateSinks(); | 12 | CreateSinks(); |
| 13 | // Must be created after the sinks | 13 | // Must be created after the sinks |
| 14 | adsp = std::make_unique<AudioRenderer::ADSP::ADSP>(system, *output_sink); | 14 | adsp = std::make_unique<ADSP::ADSP>(system, *output_sink); |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | AudioCore ::~AudioCore() { | 17 | AudioCore ::~AudioCore() { |
| @@ -43,7 +43,7 @@ Sink::Sink& AudioCore::GetInputSink() { | |||
| 43 | return *input_sink; | 43 | return *input_sink; |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | AudioRenderer::ADSP::ADSP& AudioCore::GetADSP() { | 46 | ADSP::ADSP& AudioCore::ADSP() { |
| 47 | return *adsp; | 47 | return *adsp; |
| 48 | } | 48 | } |
| 49 | 49 | ||
diff --git a/src/audio_core/audio_core.h b/src/audio_core/audio_core.h index ea047773e..e4e27fc66 100644 --- a/src/audio_core/audio_core.h +++ b/src/audio_core/audio_core.h | |||
| @@ -5,8 +5,8 @@ | |||
| 5 | 5 | ||
| 6 | #include <memory> | 6 | #include <memory> |
| 7 | 7 | ||
| 8 | #include "audio_core/adsp/adsp.h" | ||
| 8 | #include "audio_core/audio_manager.h" | 9 | #include "audio_core/audio_manager.h" |
| 9 | #include "audio_core/renderer/adsp/adsp.h" | ||
| 10 | #include "audio_core/sink/sink.h" | 10 | #include "audio_core/sink/sink.h" |
| 11 | 11 | ||
| 12 | namespace Core { | 12 | namespace Core { |
| @@ -55,7 +55,7 @@ public: | |||
| 55 | * | 55 | * |
| 56 | * @return Ref to the ADSP. | 56 | * @return Ref to the ADSP. |
| 57 | */ | 57 | */ |
| 58 | AudioRenderer::ADSP::ADSP& GetADSP(); | 58 | ADSP::ADSP& ADSP(); |
| 59 | 59 | ||
| 60 | private: | 60 | private: |
| 61 | /** | 61 | /** |
| @@ -70,7 +70,7 @@ private: | |||
| 70 | /// Sink used for audio input | 70 | /// Sink used for audio input |
| 71 | std::unique_ptr<Sink::Sink> input_sink; | 71 | std::unique_ptr<Sink::Sink> input_sink; |
| 72 | /// The ADSP in the sysmodule | 72 | /// The ADSP in the sysmodule |
| 73 | std::unique_ptr<AudioRenderer::ADSP::ADSP> adsp; | 73 | std::unique_ptr<ADSP::ADSP> adsp; |
| 74 | }; | 74 | }; |
| 75 | 75 | ||
| 76 | } // namespace AudioCore | 76 | } // namespace AudioCore |
diff --git a/src/audio_core/audio_event.cpp b/src/audio_core/audio_event.cpp index d15568e1f..c23ef0990 100644 --- a/src/audio_core/audio_event.cpp +++ b/src/audio_core/audio_event.cpp | |||
| @@ -20,7 +20,6 @@ size_t Event::GetManagerIndex(const Type type) const { | |||
| 20 | default: | 20 | default: |
| 21 | UNREACHABLE(); | 21 | UNREACHABLE(); |
| 22 | } | 22 | } |
| 23 | return 3; | ||
| 24 | } | 23 | } |
| 25 | 24 | ||
| 26 | void Event::SetAudioEvent(const Type type, const bool signalled) { | 25 | void Event::SetAudioEvent(const Type type, const bool signalled) { |
diff --git a/src/audio_core/audio_in_manager.cpp b/src/audio_core/audio_in_manager.cpp index 3dfb613cb..a3667524f 100644 --- a/src/audio_core/audio_in_manager.cpp +++ b/src/audio_core/audio_in_manager.cpp | |||
| @@ -73,7 +73,7 @@ void Manager::BufferReleaseAndRegister() { | |||
| 73 | } | 73 | } |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | u32 Manager::GetDeviceNames(std::vector<AudioRenderer::AudioDevice::AudioDeviceName>& names, | 76 | u32 Manager::GetDeviceNames(std::vector<Renderer::AudioDevice::AudioDeviceName>& names, |
| 77 | [[maybe_unused]] const u32 max_count, | 77 | [[maybe_unused]] const u32 max_count, |
| 78 | [[maybe_unused]] const bool filter) { | 78 | [[maybe_unused]] const bool filter) { |
| 79 | std::scoped_lock l{mutex}; | 79 | std::scoped_lock l{mutex}; |
diff --git a/src/audio_core/audio_in_manager.h b/src/audio_core/audio_in_manager.h index 8a519df99..5c4614cd1 100644 --- a/src/audio_core/audio_in_manager.h +++ b/src/audio_core/audio_in_manager.h | |||
| @@ -65,8 +65,8 @@ public: | |||
| 65 | * | 65 | * |
| 66 | * @return Number of names written. | 66 | * @return Number of names written. |
| 67 | */ | 67 | */ |
| 68 | u32 GetDeviceNames(std::vector<AudioRenderer::AudioDevice::AudioDeviceName>& names, | 68 | u32 GetDeviceNames(std::vector<Renderer::AudioDevice::AudioDeviceName>& names, u32 max_count, |
| 69 | u32 max_count, bool filter); | 69 | bool filter); |
| 70 | 70 | ||
| 71 | /// Core system | 71 | /// Core system |
| 72 | Core::System& system; | 72 | Core::System& system; |
diff --git a/src/audio_core/audio_out_manager.cpp b/src/audio_core/audio_out_manager.cpp index f22821360..316ea7c81 100644 --- a/src/audio_core/audio_out_manager.cpp +++ b/src/audio_core/audio_out_manager.cpp | |||
| @@ -73,7 +73,7 @@ void Manager::BufferReleaseAndRegister() { | |||
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | u32 Manager::GetAudioOutDeviceNames( | 75 | u32 Manager::GetAudioOutDeviceNames( |
| 76 | std::vector<AudioRenderer::AudioDevice::AudioDeviceName>& names) const { | 76 | std::vector<Renderer::AudioDevice::AudioDeviceName>& names) const { |
| 77 | names.emplace_back("DeviceOut"); | 77 | names.emplace_back("DeviceOut"); |
| 78 | return 1; | 78 | return 1; |
| 79 | } | 79 | } |
diff --git a/src/audio_core/audio_out_manager.h b/src/audio_core/audio_out_manager.h index 1e05ec5ed..c3e445d5d 100644 --- a/src/audio_core/audio_out_manager.h +++ b/src/audio_core/audio_out_manager.h | |||
| @@ -61,8 +61,7 @@ public: | |||
| 61 | * @param names - Output container to write names to. | 61 | * @param names - Output container to write names to. |
| 62 | * @return Number of names written. | 62 | * @return Number of names written. |
| 63 | */ | 63 | */ |
| 64 | u32 GetAudioOutDeviceNames( | 64 | u32 GetAudioOutDeviceNames(std::vector<Renderer::AudioDevice::AudioDeviceName>& names) const; |
| 65 | std::vector<AudioRenderer::AudioDevice::AudioDeviceName>& names) const; | ||
| 66 | 65 | ||
| 67 | /// Core system | 66 | /// Core system |
| 68 | Core::System& system; | 67 | Core::System& system; |
diff --git a/src/audio_core/audio_render_manager.cpp b/src/audio_core/audio_render_manager.cpp index 320715727..3c53e3afd 100644 --- a/src/audio_core/audio_render_manager.cpp +++ b/src/audio_core/audio_render_manager.cpp | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include "audio_core/common/feature_support.h" | 6 | #include "audio_core/common/feature_support.h" |
| 7 | #include "core/core.h" | 7 | #include "core/core.h" |
| 8 | 8 | ||
| 9 | namespace AudioCore::AudioRenderer { | 9 | namespace AudioCore::Renderer { |
| 10 | 10 | ||
| 11 | Manager::Manager(Core::System& system_) | 11 | Manager::Manager(Core::System& system_) |
| 12 | : system{system_}, system_manager{std::make_unique<SystemManager>(system)} { | 12 | : system{system_}, system_manager{std::make_unique<SystemManager>(system)} { |
| @@ -67,4 +67,4 @@ bool Manager::RemoveSystem(System& system_) { | |||
| 67 | return system_manager->Remove(system_); | 67 | return system_manager->Remove(system_); |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | } // namespace AudioCore::AudioRenderer | 70 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/audio_render_manager.h b/src/audio_core/audio_render_manager.h index fffa5944d..45537b270 100644 --- a/src/audio_core/audio_render_manager.h +++ b/src/audio_core/audio_render_manager.h | |||
| @@ -20,7 +20,7 @@ class System; | |||
| 20 | namespace AudioCore { | 20 | namespace AudioCore { |
| 21 | struct AudioRendererParameterInternal; | 21 | struct AudioRendererParameterInternal; |
| 22 | 22 | ||
| 23 | namespace AudioRenderer { | 23 | namespace Renderer { |
| 24 | /** | 24 | /** |
| 25 | * Wrapper for the audio system manager, handles service calls. | 25 | * Wrapper for the audio system manager, handles service calls. |
| 26 | */ | 26 | */ |
| @@ -101,5 +101,5 @@ private: | |||
| 101 | std::unique_ptr<SystemManager> system_manager{}; | 101 | std::unique_ptr<SystemManager> system_manager{}; |
| 102 | }; | 102 | }; |
| 103 | 103 | ||
| 104 | } // namespace AudioRenderer | 104 | } // namespace Renderer |
| 105 | } // namespace AudioCore | 105 | } // namespace AudioCore |
diff --git a/src/audio_core/common/audio_renderer_parameter.h b/src/audio_core/common/audio_renderer_parameter.h index 8c7892bcf..6c4e9fdc6 100644 --- a/src/audio_core/common/audio_renderer_parameter.h +++ b/src/audio_core/common/audio_renderer_parameter.h | |||
| @@ -51,10 +51,10 @@ struct AudioRendererSystemContext { | |||
| 51 | s32 session_id; | 51 | s32 session_id; |
| 52 | s8 channels; | 52 | s8 channels; |
| 53 | s16 mix_buffer_count; | 53 | s16 mix_buffer_count; |
| 54 | AudioRenderer::BehaviorInfo* behavior; | 54 | Renderer::BehaviorInfo* behavior; |
| 55 | std::span<s32> depop_buffer; | 55 | std::span<s32> depop_buffer; |
| 56 | AudioRenderer::UpsamplerManager* upsampler_manager; | 56 | Renderer::UpsamplerManager* upsampler_manager; |
| 57 | AudioRenderer::MemoryPoolInfo* memory_pool_info; | 57 | Renderer::MemoryPoolInfo* memory_pool_info; |
| 58 | }; | 58 | }; |
| 59 | 59 | ||
| 60 | } // namespace AudioCore | 60 | } // namespace AudioCore |
diff --git a/src/audio_core/renderer/adsp/adsp.cpp b/src/audio_core/renderer/adsp/adsp.cpp deleted file mode 100644 index b1db31e93..000000000 --- a/src/audio_core/renderer/adsp/adsp.cpp +++ /dev/null | |||
| @@ -1,117 +0,0 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #include "audio_core/renderer/adsp/adsp.h" | ||
| 5 | #include "audio_core/renderer/adsp/command_buffer.h" | ||
| 6 | #include "audio_core/sink/sink.h" | ||
| 7 | #include "common/logging/log.h" | ||
| 8 | #include "core/core.h" | ||
| 9 | #include "core/core_timing.h" | ||
| 10 | #include "core/memory.h" | ||
| 11 | |||
| 12 | namespace AudioCore::AudioRenderer::ADSP { | ||
| 13 | |||
| 14 | ADSP::ADSP(Core::System& system_, Sink::Sink& sink_) | ||
| 15 | : system{system_}, memory{system.ApplicationMemory()}, sink{sink_} {} | ||
| 16 | |||
| 17 | ADSP::~ADSP() { | ||
| 18 | ClearCommandBuffers(); | ||
| 19 | } | ||
| 20 | |||
| 21 | State ADSP::GetState() const { | ||
| 22 | if (running) { | ||
| 23 | return State::Started; | ||
| 24 | } | ||
| 25 | return State::Stopped; | ||
| 26 | } | ||
| 27 | |||
| 28 | AudioRenderer_Mailbox* ADSP::GetRenderMailbox() { | ||
| 29 | return &render_mailbox; | ||
| 30 | } | ||
| 31 | |||
| 32 | void ADSP::ClearRemainCount(const u32 session_id) { | ||
| 33 | render_mailbox.ClearRemainCount(session_id); | ||
| 34 | } | ||
| 35 | |||
| 36 | u64 ADSP::GetSignalledTick() const { | ||
| 37 | return render_mailbox.GetSignalledTick(); | ||
| 38 | } | ||
| 39 | |||
| 40 | u64 ADSP::GetTimeTaken() const { | ||
| 41 | return render_mailbox.GetRenderTimeTaken(); | ||
| 42 | } | ||
| 43 | |||
| 44 | u64 ADSP::GetRenderTimeTaken(const u32 session_id) { | ||
| 45 | return render_mailbox.GetCommandBuffer(session_id).render_time_taken; | ||
| 46 | } | ||
| 47 | |||
| 48 | u32 ADSP::GetRemainCommandCount(const u32 session_id) const { | ||
| 49 | return render_mailbox.GetRemainCommandCount(session_id); | ||
| 50 | } | ||
| 51 | |||
| 52 | void ADSP::SendCommandBuffer(const u32 session_id, const CommandBuffer& command_buffer) { | ||
| 53 | render_mailbox.SetCommandBuffer(session_id, command_buffer); | ||
| 54 | } | ||
| 55 | |||
| 56 | u64 ADSP::GetRenderingStartTick(const u32 session_id) { | ||
| 57 | return render_mailbox.GetSignalledTick() + | ||
| 58 | render_mailbox.GetCommandBuffer(session_id).render_time_taken; | ||
| 59 | } | ||
| 60 | |||
| 61 | bool ADSP::Start() { | ||
| 62 | if (running) { | ||
| 63 | return running; | ||
| 64 | } | ||
| 65 | |||
| 66 | running = true; | ||
| 67 | systems_active++; | ||
| 68 | audio_renderer = std::make_unique<AudioRenderer>(system); | ||
| 69 | audio_renderer->Start(&render_mailbox); | ||
| 70 | render_mailbox.HostSendMessage(RenderMessage::AudioRenderer_InitializeOK); | ||
| 71 | if (render_mailbox.HostWaitMessage() != RenderMessage::AudioRenderer_InitializeOK) { | ||
| 72 | LOG_ERROR( | ||
| 73 | Service_Audio, | ||
| 74 | "Host Audio Renderer -- Failed to receive initialize message response from ADSP!"); | ||
| 75 | } | ||
| 76 | return running; | ||
| 77 | } | ||
| 78 | |||
| 79 | void ADSP::Stop() { | ||
| 80 | systems_active--; | ||
| 81 | if (running && systems_active == 0) { | ||
| 82 | { | ||
| 83 | std::scoped_lock l{mailbox_lock}; | ||
| 84 | render_mailbox.HostSendMessage(RenderMessage::AudioRenderer_Shutdown); | ||
| 85 | if (render_mailbox.HostWaitMessage() != RenderMessage::AudioRenderer_Shutdown) { | ||
| 86 | LOG_ERROR(Service_Audio, "Host Audio Renderer -- Failed to receive shutdown " | ||
| 87 | "message response from ADSP!"); | ||
| 88 | } | ||
| 89 | } | ||
| 90 | audio_renderer->Stop(); | ||
| 91 | running = false; | ||
| 92 | } | ||
| 93 | } | ||
| 94 | |||
| 95 | void ADSP::Signal() { | ||
| 96 | const auto signalled_tick{system.CoreTiming().GetClockTicks()}; | ||
| 97 | render_mailbox.SetSignalledTick(signalled_tick); | ||
| 98 | render_mailbox.HostSendMessage(RenderMessage::AudioRenderer_Render); | ||
| 99 | } | ||
| 100 | |||
| 101 | void ADSP::Wait() { | ||
| 102 | std::scoped_lock l{mailbox_lock}; | ||
| 103 | auto response{render_mailbox.HostWaitMessage()}; | ||
| 104 | if (response != RenderMessage::AudioRenderer_RenderResponse) { | ||
| 105 | LOG_ERROR(Service_Audio, "Invalid ADSP response message, expected 0x{:02X}, got 0x{:02X}", | ||
| 106 | static_cast<u32>(RenderMessage::AudioRenderer_RenderResponse), | ||
| 107 | static_cast<u32>(response)); | ||
| 108 | } | ||
| 109 | |||
| 110 | ClearCommandBuffers(); | ||
| 111 | } | ||
| 112 | |||
| 113 | void ADSP::ClearCommandBuffers() { | ||
| 114 | render_mailbox.ClearCommandBuffers(); | ||
| 115 | } | ||
| 116 | |||
| 117 | } // namespace AudioCore::AudioRenderer::ADSP | ||
diff --git a/src/audio_core/renderer/adsp/adsp.h b/src/audio_core/renderer/adsp/adsp.h deleted file mode 100644 index f7a2f25e4..000000000 --- a/src/audio_core/renderer/adsp/adsp.h +++ /dev/null | |||
| @@ -1,171 +0,0 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include <memory> | ||
| 7 | #include <mutex> | ||
| 8 | |||
| 9 | #include "audio_core/renderer/adsp/audio_renderer.h" | ||
| 10 | #include "common/common_types.h" | ||
| 11 | |||
| 12 | namespace Core { | ||
| 13 | namespace Memory { | ||
| 14 | class Memory; | ||
| 15 | } | ||
| 16 | class System; | ||
| 17 | } // namespace Core | ||
| 18 | |||
| 19 | namespace AudioCore { | ||
| 20 | namespace Sink { | ||
| 21 | class Sink; | ||
| 22 | } | ||
| 23 | |||
| 24 | namespace AudioRenderer::ADSP { | ||
| 25 | struct CommandBuffer; | ||
| 26 | |||
| 27 | enum class State { | ||
| 28 | Started, | ||
| 29 | Stopped, | ||
| 30 | }; | ||
| 31 | |||
| 32 | /** | ||
| 33 | * Represents the ADSP embedded within the audio sysmodule. | ||
| 34 | * This is a 32-bit Linux4Tegra kernel from nVidia, which is launched with the sysmodule on boot. | ||
| 35 | * | ||
| 36 | * The kernel will run apps you program for it, Nintendo have the following: | ||
| 37 | * | ||
| 38 | * Gmix - Responsible for mixing final audio and sending it out to hardware. This is last place all | ||
| 39 | * audio samples end up, and we skip it entirely, since we have very different backends and | ||
| 40 | * mixing is implicitly handled by the OS (but also due to lack of research/simplicity). | ||
| 41 | * | ||
| 42 | * AudioRenderer - Receives command lists generated by the audio render | ||
| 43 | * system, processes them, and sends the samples to Gmix. | ||
| 44 | * | ||
| 45 | * OpusDecoder - Contains libopus, and controls processing Opus audio and sends it to Gmix. | ||
| 46 | * Not much research done here, TODO if needed. | ||
| 47 | * | ||
| 48 | * We only implement the AudioRenderer for now. | ||
| 49 | * | ||
| 50 | * Communication for the apps is done through mailboxes, and some shared memory. | ||
| 51 | */ | ||
| 52 | class ADSP { | ||
| 53 | public: | ||
| 54 | explicit ADSP(Core::System& system, Sink::Sink& sink); | ||
| 55 | ~ADSP(); | ||
| 56 | |||
| 57 | /** | ||
| 58 | * Start the ADSP. | ||
| 59 | * | ||
| 60 | * @return True if started or already running, otherwise false. | ||
| 61 | */ | ||
| 62 | bool Start(); | ||
| 63 | |||
| 64 | /** | ||
| 65 | * Stop the ADSP. | ||
| 66 | */ | ||
| 67 | void Stop(); | ||
| 68 | |||
| 69 | /** | ||
| 70 | * Get the ADSP's state. | ||
| 71 | * | ||
| 72 | * @return Started or Stopped. | ||
| 73 | */ | ||
| 74 | State GetState() const; | ||
| 75 | |||
| 76 | /** | ||
| 77 | * Get the AudioRenderer mailbox to communicate with it. | ||
| 78 | * | ||
| 79 | * @return The AudioRenderer mailbox. | ||
| 80 | */ | ||
| 81 | AudioRenderer_Mailbox* GetRenderMailbox(); | ||
| 82 | |||
| 83 | /** | ||
| 84 | * Get the tick the ADSP was signalled. | ||
| 85 | * | ||
| 86 | * @return The tick the ADSP was signalled. | ||
| 87 | */ | ||
| 88 | u64 GetSignalledTick() const; | ||
| 89 | |||
| 90 | /** | ||
| 91 | * Get the total time it took for the ADSP to run the last command lists (both command lists). | ||
| 92 | * | ||
| 93 | * @return The tick the ADSP was signalled. | ||
| 94 | */ | ||
| 95 | u64 GetTimeTaken() const; | ||
| 96 | |||
| 97 | /** | ||
| 98 | * Get the last time a given command list took to run. | ||
| 99 | * | ||
| 100 | * @param session_id - The session id to check (0 or 1). | ||
| 101 | * @return The time it took. | ||
| 102 | */ | ||
| 103 | u64 GetRenderTimeTaken(u32 session_id); | ||
| 104 | |||
| 105 | /** | ||
| 106 | * Clear the remaining command count for a given session. | ||
| 107 | * | ||
| 108 | * @param session_id - The session id to check (0 or 1). | ||
| 109 | */ | ||
| 110 | void ClearRemainCount(u32 session_id); | ||
| 111 | |||
| 112 | /** | ||
| 113 | * Get the remaining number of commands left to process for a command list. | ||
| 114 | * | ||
| 115 | * @param session_id - The session id to check (0 or 1). | ||
| 116 | * @return The number of commands remaining. | ||
| 117 | */ | ||
| 118 | u32 GetRemainCommandCount(u32 session_id) const; | ||
| 119 | |||
| 120 | /** | ||
| 121 | * Get the last tick a command list started processing. | ||
| 122 | * | ||
| 123 | * @param session_id - The session id to check (0 or 1). | ||
| 124 | * @return The last tick the given command list started. | ||
| 125 | */ | ||
| 126 | u64 GetRenderingStartTick(u32 session_id); | ||
| 127 | |||
| 128 | /** | ||
| 129 | * Set a command buffer to be processed. | ||
| 130 | * | ||
| 131 | * @param session_id - The session id to check (0 or 1). | ||
| 132 | * @param command_buffer - The command buffer to process. | ||
| 133 | */ | ||
| 134 | void SendCommandBuffer(u32 session_id, const CommandBuffer& command_buffer); | ||
| 135 | |||
| 136 | /** | ||
| 137 | * Clear the command buffers (does not clear the time taken or the remaining command count) | ||
| 138 | */ | ||
| 139 | void ClearCommandBuffers(); | ||
| 140 | |||
| 141 | /** | ||
| 142 | * Signal the AudioRenderer to begin processing. | ||
| 143 | */ | ||
| 144 | void Signal(); | ||
| 145 | |||
| 146 | /** | ||
| 147 | * Wait for the AudioRenderer to finish processing. | ||
| 148 | */ | ||
| 149 | void Wait(); | ||
| 150 | |||
| 151 | private: | ||
| 152 | /// Core system | ||
| 153 | Core::System& system; | ||
| 154 | /// Core memory | ||
| 155 | Core::Memory::Memory& memory; | ||
| 156 | /// Number of systems active, used to prevent accidental shutdowns | ||
| 157 | u8 systems_active{0}; | ||
| 158 | /// ADSP running state | ||
| 159 | std::atomic<bool> running{false}; | ||
| 160 | /// Output sink used by the ADSP | ||
| 161 | Sink::Sink& sink; | ||
| 162 | /// AudioRenderer app | ||
| 163 | std::unique_ptr<AudioRenderer> audio_renderer{}; | ||
| 164 | /// Communication for the AudioRenderer | ||
| 165 | AudioRenderer_Mailbox render_mailbox{}; | ||
| 166 | /// Mailbox lock ffor the render mailbox | ||
| 167 | std::mutex mailbox_lock; | ||
| 168 | }; | ||
| 169 | |||
| 170 | } // namespace AudioRenderer::ADSP | ||
| 171 | } // namespace AudioCore | ||
diff --git a/src/audio_core/renderer/adsp/audio_renderer.cpp b/src/audio_core/renderer/adsp/audio_renderer.cpp deleted file mode 100644 index 9ca716b60..000000000 --- a/src/audio_core/renderer/adsp/audio_renderer.cpp +++ /dev/null | |||
| @@ -1,225 +0,0 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #include <array> | ||
| 5 | #include <chrono> | ||
| 6 | |||
| 7 | #include "audio_core/audio_core.h" | ||
| 8 | #include "audio_core/common/common.h" | ||
| 9 | #include "audio_core/renderer/adsp/audio_renderer.h" | ||
| 10 | #include "audio_core/sink/sink.h" | ||
| 11 | #include "common/logging/log.h" | ||
| 12 | #include "common/microprofile.h" | ||
| 13 | #include "common/thread.h" | ||
| 14 | #include "core/core.h" | ||
| 15 | #include "core/core_timing.h" | ||
| 16 | |||
| 17 | MICROPROFILE_DEFINE(Audio_Renderer, "Audio", "DSP", MP_RGB(60, 19, 97)); | ||
| 18 | |||
| 19 | namespace AudioCore::AudioRenderer::ADSP { | ||
| 20 | |||
| 21 | void AudioRenderer_Mailbox::HostSendMessage(RenderMessage message_) { | ||
| 22 | adsp_messages.enqueue(message_); | ||
| 23 | adsp_event.Set(); | ||
| 24 | } | ||
| 25 | |||
| 26 | RenderMessage AudioRenderer_Mailbox::HostWaitMessage() { | ||
| 27 | host_event.Wait(); | ||
| 28 | RenderMessage msg{RenderMessage::Invalid}; | ||
| 29 | if (!host_messages.try_dequeue(msg)) { | ||
| 30 | LOG_ERROR(Service_Audio, "Failed to dequeue host message!"); | ||
| 31 | } | ||
| 32 | return msg; | ||
| 33 | } | ||
| 34 | |||
| 35 | void AudioRenderer_Mailbox::ADSPSendMessage(const RenderMessage message_) { | ||
| 36 | host_messages.enqueue(message_); | ||
| 37 | host_event.Set(); | ||
| 38 | } | ||
| 39 | |||
| 40 | RenderMessage AudioRenderer_Mailbox::ADSPWaitMessage() { | ||
| 41 | adsp_event.Wait(); | ||
| 42 | RenderMessage msg{RenderMessage::Invalid}; | ||
| 43 | if (!adsp_messages.try_dequeue(msg)) { | ||
| 44 | LOG_ERROR(Service_Audio, "Failed to dequeue ADSP message!"); | ||
| 45 | } | ||
| 46 | return msg; | ||
| 47 | } | ||
| 48 | |||
| 49 | CommandBuffer& AudioRenderer_Mailbox::GetCommandBuffer(const u32 session_id) { | ||
| 50 | return command_buffers[session_id]; | ||
| 51 | } | ||
| 52 | |||
| 53 | void AudioRenderer_Mailbox::SetCommandBuffer(const u32 session_id, const CommandBuffer& buffer) { | ||
| 54 | command_buffers[session_id] = buffer; | ||
| 55 | } | ||
| 56 | |||
| 57 | u64 AudioRenderer_Mailbox::GetRenderTimeTaken() const { | ||
| 58 | return command_buffers[0].render_time_taken + command_buffers[1].render_time_taken; | ||
| 59 | } | ||
| 60 | |||
| 61 | u64 AudioRenderer_Mailbox::GetSignalledTick() const { | ||
| 62 | return signalled_tick; | ||
| 63 | } | ||
| 64 | |||
| 65 | void AudioRenderer_Mailbox::SetSignalledTick(const u64 tick) { | ||
| 66 | signalled_tick = tick; | ||
| 67 | } | ||
| 68 | |||
| 69 | void AudioRenderer_Mailbox::ClearRemainCount(const u32 session_id) { | ||
| 70 | command_buffers[session_id].remaining_command_count = 0; | ||
| 71 | } | ||
| 72 | |||
| 73 | u32 AudioRenderer_Mailbox::GetRemainCommandCount(const u32 session_id) const { | ||
| 74 | return command_buffers[session_id].remaining_command_count; | ||
| 75 | } | ||
| 76 | |||
| 77 | void AudioRenderer_Mailbox::ClearCommandBuffers() { | ||
| 78 | command_buffers[0].buffer = 0; | ||
| 79 | command_buffers[0].size = 0; | ||
| 80 | command_buffers[0].reset_buffers = false; | ||
| 81 | command_buffers[1].buffer = 0; | ||
| 82 | command_buffers[1].size = 0; | ||
| 83 | command_buffers[1].reset_buffers = false; | ||
| 84 | } | ||
| 85 | |||
| 86 | AudioRenderer::AudioRenderer(Core::System& system_) | ||
| 87 | : system{system_}, sink{system.AudioCore().GetOutputSink()} { | ||
| 88 | CreateSinkStreams(); | ||
| 89 | } | ||
| 90 | |||
| 91 | AudioRenderer::~AudioRenderer() { | ||
| 92 | Stop(); | ||
| 93 | for (auto& stream : streams) { | ||
| 94 | if (stream) { | ||
| 95 | sink.CloseStream(stream); | ||
| 96 | } | ||
| 97 | stream = nullptr; | ||
| 98 | } | ||
| 99 | } | ||
| 100 | |||
| 101 | void AudioRenderer::Start(AudioRenderer_Mailbox* mailbox_) { | ||
| 102 | if (running) { | ||
| 103 | return; | ||
| 104 | } | ||
| 105 | |||
| 106 | mailbox = mailbox_; | ||
| 107 | thread = std::jthread([this](std::stop_token stop_token) { ThreadFunc(stop_token); }); | ||
| 108 | running = true; | ||
| 109 | } | ||
| 110 | |||
| 111 | void AudioRenderer::Stop() { | ||
| 112 | if (!running) { | ||
| 113 | return; | ||
| 114 | } | ||
| 115 | |||
| 116 | for (auto& stream : streams) { | ||
| 117 | stream->Stop(); | ||
| 118 | } | ||
| 119 | thread.join(); | ||
| 120 | running = false; | ||
| 121 | } | ||
| 122 | |||
| 123 | void AudioRenderer::CreateSinkStreams() { | ||
| 124 | u32 channels{sink.GetDeviceChannels()}; | ||
| 125 | for (u32 i = 0; i < MaxRendererSessions; i++) { | ||
| 126 | std::string name{fmt::format("ADSP_RenderStream-{}", i)}; | ||
| 127 | streams[i] = | ||
| 128 | sink.AcquireSinkStream(system, channels, name, ::AudioCore::Sink::StreamType::Render); | ||
| 129 | streams[i]->SetRingSize(4); | ||
| 130 | } | ||
| 131 | } | ||
| 132 | |||
| 133 | void AudioRenderer::ThreadFunc(std::stop_token stop_token) { | ||
| 134 | static constexpr char name[]{"AudioRenderer"}; | ||
| 135 | MicroProfileOnThreadCreate(name); | ||
| 136 | Common::SetCurrentThreadName(name); | ||
| 137 | Common::SetCurrentThreadPriority(Common::ThreadPriority::High); | ||
| 138 | if (mailbox->ADSPWaitMessage() != RenderMessage::AudioRenderer_InitializeOK) { | ||
| 139 | LOG_ERROR(Service_Audio, | ||
| 140 | "ADSP Audio Renderer -- Failed to receive initialize message from host!"); | ||
| 141 | return; | ||
| 142 | } | ||
| 143 | |||
| 144 | mailbox->ADSPSendMessage(RenderMessage::AudioRenderer_InitializeOK); | ||
| 145 | |||
| 146 | // 0.12 seconds (2304000 / 19200000) | ||
| 147 | constexpr u64 max_process_time{2'304'000ULL}; | ||
| 148 | |||
| 149 | while (!stop_token.stop_requested()) { | ||
| 150 | auto message{mailbox->ADSPWaitMessage()}; | ||
| 151 | switch (message) { | ||
| 152 | case RenderMessage::AudioRenderer_Shutdown: | ||
| 153 | mailbox->ADSPSendMessage(RenderMessage::AudioRenderer_Shutdown); | ||
| 154 | return; | ||
| 155 | |||
| 156 | case RenderMessage::AudioRenderer_Render: { | ||
| 157 | if (system.IsShuttingDown()) [[unlikely]] { | ||
| 158 | std::this_thread::sleep_for(std::chrono::milliseconds(5)); | ||
| 159 | mailbox->ADSPSendMessage(RenderMessage::AudioRenderer_RenderResponse); | ||
| 160 | continue; | ||
| 161 | } | ||
| 162 | std::array<bool, MaxRendererSessions> buffers_reset{}; | ||
| 163 | std::array<u64, MaxRendererSessions> render_times_taken{}; | ||
| 164 | const auto start_time{system.CoreTiming().GetClockTicks()}; | ||
| 165 | |||
| 166 | for (u32 index = 0; index < 2; index++) { | ||
| 167 | auto& command_buffer{mailbox->GetCommandBuffer(index)}; | ||
| 168 | auto& command_list_processor{command_list_processors[index]}; | ||
| 169 | |||
| 170 | // Check this buffer is valid, as it may not be used. | ||
| 171 | if (command_buffer.buffer != 0) { | ||
| 172 | // If there are no remaining commands (from the previous list), | ||
| 173 | // this is a new command list, initialize it. | ||
| 174 | if (command_buffer.remaining_command_count == 0) { | ||
| 175 | command_list_processor.Initialize(system, command_buffer.buffer, | ||
| 176 | command_buffer.size, streams[index]); | ||
| 177 | } | ||
| 178 | |||
| 179 | if (command_buffer.reset_buffers && !buffers_reset[index]) { | ||
| 180 | streams[index]->ClearQueue(); | ||
| 181 | buffers_reset[index] = true; | ||
| 182 | } | ||
| 183 | |||
| 184 | u64 max_time{max_process_time}; | ||
| 185 | if (index == 1 && command_buffer.applet_resource_user_id == | ||
| 186 | mailbox->GetCommandBuffer(0).applet_resource_user_id) { | ||
| 187 | max_time = max_process_time - render_times_taken[0]; | ||
| 188 | if (render_times_taken[0] > max_process_time) { | ||
| 189 | max_time = 0; | ||
| 190 | } | ||
| 191 | } | ||
| 192 | |||
| 193 | max_time = std::min(command_buffer.time_limit, max_time); | ||
| 194 | command_list_processor.SetProcessTimeMax(max_time); | ||
| 195 | |||
| 196 | streams[index]->WaitFreeSpace(stop_token); | ||
| 197 | |||
| 198 | // Process the command list | ||
| 199 | { | ||
| 200 | MICROPROFILE_SCOPE(Audio_Renderer); | ||
| 201 | render_times_taken[index] = | ||
| 202 | command_list_processor.Process(index) - start_time; | ||
| 203 | } | ||
| 204 | |||
| 205 | const auto end_time{system.CoreTiming().GetClockTicks()}; | ||
| 206 | |||
| 207 | command_buffer.remaining_command_count = | ||
| 208 | command_list_processor.GetRemainingCommandCount(); | ||
| 209 | command_buffer.render_time_taken = end_time - start_time; | ||
| 210 | } | ||
| 211 | } | ||
| 212 | |||
| 213 | mailbox->ADSPSendMessage(RenderMessage::AudioRenderer_RenderResponse); | ||
| 214 | } break; | ||
| 215 | |||
| 216 | default: | ||
| 217 | LOG_WARNING(Service_Audio, | ||
| 218 | "ADSP AudioRenderer received an invalid message, msg={:02X}!", | ||
| 219 | static_cast<u32>(message)); | ||
| 220 | break; | ||
| 221 | } | ||
| 222 | } | ||
| 223 | } | ||
| 224 | |||
| 225 | } // namespace AudioCore::AudioRenderer::ADSP | ||
diff --git a/src/audio_core/renderer/adsp/audio_renderer.h b/src/audio_core/renderer/adsp/audio_renderer.h deleted file mode 100644 index 88e558183..000000000 --- a/src/audio_core/renderer/adsp/audio_renderer.h +++ /dev/null | |||
| @@ -1,204 +0,0 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include <array> | ||
| 7 | #include <memory> | ||
| 8 | #include <thread> | ||
| 9 | |||
| 10 | #include "audio_core/renderer/adsp/command_buffer.h" | ||
| 11 | #include "audio_core/renderer/adsp/command_list_processor.h" | ||
| 12 | #include "common/common_types.h" | ||
| 13 | #include "common/polyfill_thread.h" | ||
| 14 | #include "common/reader_writer_queue.h" | ||
| 15 | #include "common/thread.h" | ||
| 16 | |||
| 17 | namespace Core { | ||
| 18 | namespace Timing { | ||
| 19 | struct EventType; | ||
| 20 | } | ||
| 21 | class System; | ||
| 22 | } // namespace Core | ||
| 23 | |||
| 24 | namespace AudioCore { | ||
| 25 | namespace Sink { | ||
| 26 | class Sink; | ||
| 27 | } | ||
| 28 | |||
| 29 | namespace AudioRenderer::ADSP { | ||
| 30 | |||
| 31 | enum class RenderMessage { | ||
| 32 | /* 0x00 */ Invalid, | ||
| 33 | /* 0x01 */ AudioRenderer_MapUnmap_Map, | ||
| 34 | /* 0x02 */ AudioRenderer_MapUnmap_MapResponse, | ||
| 35 | /* 0x03 */ AudioRenderer_MapUnmap_Unmap, | ||
| 36 | /* 0x04 */ AudioRenderer_MapUnmap_UnmapResponse, | ||
| 37 | /* 0x05 */ AudioRenderer_MapUnmap_InvalidateCache, | ||
| 38 | /* 0x06 */ AudioRenderer_MapUnmap_InvalidateCacheResponse, | ||
| 39 | /* 0x07 */ AudioRenderer_MapUnmap_Shutdown, | ||
| 40 | /* 0x08 */ AudioRenderer_MapUnmap_ShutdownResponse, | ||
| 41 | /* 0x16 */ AudioRenderer_InitializeOK = 0x16, | ||
| 42 | /* 0x20 */ AudioRenderer_RenderResponse = 0x20, | ||
| 43 | /* 0x2A */ AudioRenderer_Render = 0x2A, | ||
| 44 | /* 0x34 */ AudioRenderer_Shutdown = 0x34, | ||
| 45 | }; | ||
| 46 | |||
| 47 | /** | ||
| 48 | * A mailbox for the AudioRenderer, allowing communication between the host and the AudioRenderer | ||
| 49 | * running on the ADSP. | ||
| 50 | */ | ||
| 51 | class AudioRenderer_Mailbox { | ||
| 52 | public: | ||
| 53 | /** | ||
| 54 | * Send a message from the host to the AudioRenderer. | ||
| 55 | * | ||
| 56 | * @param message - The message to send to the AudioRenderer. | ||
| 57 | */ | ||
| 58 | void HostSendMessage(RenderMessage message); | ||
| 59 | |||
| 60 | /** | ||
| 61 | * Host wait for a message from the AudioRenderer. | ||
| 62 | * | ||
| 63 | * @return The message returned from the AudioRenderer. | ||
| 64 | */ | ||
| 65 | RenderMessage HostWaitMessage(); | ||
| 66 | |||
| 67 | /** | ||
| 68 | * Send a message from the AudioRenderer to the host. | ||
| 69 | * | ||
| 70 | * @param message - The message to send to the host. | ||
| 71 | */ | ||
| 72 | void ADSPSendMessage(RenderMessage message); | ||
| 73 | |||
| 74 | /** | ||
| 75 | * AudioRenderer wait for a message from the host. | ||
| 76 | * | ||
| 77 | * @return The message returned from the AudioRenderer. | ||
| 78 | */ | ||
| 79 | RenderMessage ADSPWaitMessage(); | ||
| 80 | |||
| 81 | /** | ||
| 82 | * Get the command buffer with the given session id (0 or 1). | ||
| 83 | * | ||
| 84 | * @param session_id - The session id to get (0 or 1). | ||
| 85 | * @return The command buffer. | ||
| 86 | */ | ||
| 87 | CommandBuffer& GetCommandBuffer(u32 session_id); | ||
| 88 | |||
| 89 | /** | ||
| 90 | * Set the command buffer with the given session id (0 or 1). | ||
| 91 | * | ||
| 92 | * @param session_id - The session id to get (0 or 1). | ||
| 93 | * @param buffer - The command buffer to set. | ||
| 94 | */ | ||
| 95 | void SetCommandBuffer(u32 session_id, const CommandBuffer& buffer); | ||
| 96 | |||
| 97 | /** | ||
| 98 | * Get the total render time taken for the last command lists sent. | ||
| 99 | * | ||
| 100 | * @return Total render time taken for the last command lists. | ||
| 101 | */ | ||
| 102 | u64 GetRenderTimeTaken() const; | ||
| 103 | |||
| 104 | /** | ||
| 105 | * Get the tick the AudioRenderer was signalled. | ||
| 106 | * | ||
| 107 | * @return The tick the AudioRenderer was signalled. | ||
| 108 | */ | ||
| 109 | u64 GetSignalledTick() const; | ||
| 110 | |||
| 111 | /** | ||
| 112 | * Set the tick the AudioRenderer was signalled. | ||
| 113 | * | ||
| 114 | * @param tick - The tick the AudioRenderer was signalled. | ||
| 115 | */ | ||
| 116 | void SetSignalledTick(u64 tick); | ||
| 117 | |||
| 118 | /** | ||
| 119 | * Clear the remaining command count. | ||
| 120 | * | ||
| 121 | * @param session_id - Index for which command list to clear (0 or 1). | ||
| 122 | */ | ||
| 123 | void ClearRemainCount(u32 session_id); | ||
| 124 | |||
| 125 | /** | ||
| 126 | * Get the remaining command count for a given command list. | ||
| 127 | * | ||
| 128 | * @param session_id - Index for which command list to clear (0 or 1). | ||
| 129 | * @return The remaining command count. | ||
| 130 | */ | ||
| 131 | u32 GetRemainCommandCount(u32 session_id) const; | ||
| 132 | |||
| 133 | /** | ||
| 134 | * Clear the command buffers (does not clear the time taken or the remaining command count). | ||
| 135 | */ | ||
| 136 | void ClearCommandBuffers(); | ||
| 137 | |||
| 138 | private: | ||
| 139 | /// Host signalling event | ||
| 140 | Common::Event host_event{}; | ||
| 141 | /// AudioRenderer signalling event | ||
| 142 | Common::Event adsp_event{}; | ||
| 143 | /// Host message queue | ||
| 144 | |||
| 145 | Common::ReaderWriterQueue<RenderMessage> host_messages{}; | ||
| 146 | /// AudioRenderer message queue | ||
| 147 | |||
| 148 | Common::ReaderWriterQueue<RenderMessage> adsp_messages{}; | ||
| 149 | /// Command buffers | ||
| 150 | |||
| 151 | std::array<CommandBuffer, MaxRendererSessions> command_buffers{}; | ||
| 152 | /// Tick the AudioRnederer was signalled | ||
| 153 | u64 signalled_tick{}; | ||
| 154 | }; | ||
| 155 | |||
| 156 | /** | ||
| 157 | * The AudioRenderer application running on the ADSP. | ||
| 158 | */ | ||
| 159 | class AudioRenderer { | ||
| 160 | public: | ||
| 161 | explicit AudioRenderer(Core::System& system); | ||
| 162 | ~AudioRenderer(); | ||
| 163 | |||
| 164 | /** | ||
| 165 | * Start the AudioRenderer. | ||
| 166 | * | ||
| 167 | * @param mailbox The mailbox to use for this session. | ||
| 168 | */ | ||
| 169 | void Start(AudioRenderer_Mailbox* mailbox); | ||
| 170 | |||
| 171 | /** | ||
| 172 | * Stop the AudioRenderer. | ||
| 173 | */ | ||
| 174 | void Stop(); | ||
| 175 | |||
| 176 | private: | ||
| 177 | /** | ||
| 178 | * Main AudioRenderer thread, responsible for processing the command lists. | ||
| 179 | */ | ||
| 180 | void ThreadFunc(std::stop_token stop_token); | ||
| 181 | |||
| 182 | /** | ||
| 183 | * Creates the streams which will receive the processed samples. | ||
| 184 | */ | ||
| 185 | void CreateSinkStreams(); | ||
| 186 | |||
| 187 | /// Core system | ||
| 188 | Core::System& system; | ||
| 189 | /// Main thread | ||
| 190 | std::jthread thread{}; | ||
| 191 | /// The current state | ||
| 192 | std::atomic<bool> running{}; | ||
| 193 | /// The active mailbox | ||
| 194 | AudioRenderer_Mailbox* mailbox{}; | ||
| 195 | /// The command lists to process | ||
| 196 | std::array<CommandListProcessor, MaxRendererSessions> command_list_processors{}; | ||
| 197 | /// The output sink the AudioRenderer will use | ||
| 198 | Sink::Sink& sink; | ||
| 199 | /// The streams which will receive the processed samples | ||
| 200 | std::array<Sink::SinkStream*, MaxRendererSessions> streams; | ||
| 201 | }; | ||
| 202 | |||
| 203 | } // namespace AudioRenderer::ADSP | ||
| 204 | } // namespace AudioCore | ||
diff --git a/src/audio_core/renderer/adsp/command_buffer.h b/src/audio_core/renderer/adsp/command_buffer.h deleted file mode 100644 index 880b279d8..000000000 --- a/src/audio_core/renderer/adsp/command_buffer.h +++ /dev/null | |||
| @@ -1,21 +0,0 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include "audio_core/common/common.h" | ||
| 7 | #include "common/common_types.h" | ||
| 8 | |||
| 9 | namespace AudioCore::AudioRenderer::ADSP { | ||
| 10 | |||
| 11 | struct CommandBuffer { | ||
| 12 | CpuAddr buffer; | ||
| 13 | u64 size; | ||
| 14 | u64 time_limit; | ||
| 15 | u32 remaining_command_count; | ||
| 16 | bool reset_buffers; | ||
| 17 | u64 applet_resource_user_id; | ||
| 18 | u64 render_time_taken; | ||
| 19 | }; | ||
| 20 | |||
| 21 | } // namespace AudioCore::AudioRenderer::ADSP | ||
diff --git a/src/audio_core/renderer/audio_device.cpp b/src/audio_core/renderer/audio_device.cpp index 0d9d8f6ce..2d9bf82bb 100644 --- a/src/audio_core/renderer/audio_device.cpp +++ b/src/audio_core/renderer/audio_device.cpp | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | #include "audio_core/sink/sink.h" | 10 | #include "audio_core/sink/sink.h" |
| 11 | #include "core/core.h" | 11 | #include "core/core.h" |
| 12 | 12 | ||
| 13 | namespace AudioCore::AudioRenderer { | 13 | namespace AudioCore::Renderer { |
| 14 | 14 | ||
| 15 | constexpr std::array usb_device_names{ | 15 | constexpr std::array usb_device_names{ |
| 16 | AudioDevice::AudioDeviceName{"AudioStereoJackOutput"}, | 16 | AudioDevice::AudioDeviceName{"AudioStereoJackOutput"}, |
| @@ -71,4 +71,4 @@ f32 AudioDevice::GetDeviceVolume([[maybe_unused]] std::string_view name) const { | |||
| 71 | return output_sink.GetDeviceVolume(); | 71 | return output_sink.GetDeviceVolume(); |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | } // namespace AudioCore::AudioRenderer | 74 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/audio_device.h b/src/audio_core/renderer/audio_device.h index dd6be70ee..ca4040add 100644 --- a/src/audio_core/renderer/audio_device.h +++ b/src/audio_core/renderer/audio_device.h | |||
| @@ -16,7 +16,7 @@ namespace Sink { | |||
| 16 | class Sink; | 16 | class Sink; |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | namespace AudioRenderer { | 19 | namespace Renderer { |
| 20 | /** | 20 | /** |
| 21 | * An interface to an output audio device available to the Switch. | 21 | * An interface to an output audio device available to the Switch. |
| 22 | */ | 22 | */ |
| @@ -76,5 +76,5 @@ private: | |||
| 76 | const u32 user_revision; | 76 | const u32 user_revision; |
| 77 | }; | 77 | }; |
| 78 | 78 | ||
| 79 | } // namespace AudioRenderer | 79 | } // namespace Renderer |
| 80 | } // namespace AudioCore | 80 | } // namespace AudioCore |
diff --git a/src/audio_core/renderer/audio_renderer.cpp b/src/audio_core/renderer/audio_renderer.cpp index a8257eb2e..09efe9be9 100644 --- a/src/audio_core/renderer/audio_renderer.cpp +++ b/src/audio_core/renderer/audio_renderer.cpp | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include "core/hle/kernel/k_transfer_memory.h" | 9 | #include "core/hle/kernel/k_transfer_memory.h" |
| 10 | #include "core/hle/service/audio/errors.h" | 10 | #include "core/hle/service/audio/errors.h" |
| 11 | 11 | ||
| 12 | namespace AudioCore::AudioRenderer { | 12 | namespace AudioCore::Renderer { |
| 13 | 13 | ||
| 14 | Renderer::Renderer(Core::System& system_, Manager& manager_, Kernel::KEvent* rendered_event) | 14 | Renderer::Renderer(Core::System& system_, Manager& manager_, Kernel::KEvent* rendered_event) |
| 15 | : core{system_}, manager{manager_}, system{system_, rendered_event} {} | 15 | : core{system_}, manager{manager_}, system{system_, rendered_event} {} |
| @@ -64,4 +64,4 @@ Result Renderer::RequestUpdate(std::span<const u8> input, std::span<u8> performa | |||
| 64 | return system.Update(input, performance, output); | 64 | return system.Update(input, performance, output); |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | } // namespace AudioCore::AudioRenderer | 67 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/audio_renderer.h b/src/audio_core/renderer/audio_renderer.h index 90c6f9727..24650278b 100644 --- a/src/audio_core/renderer/audio_renderer.h +++ b/src/audio_core/renderer/audio_renderer.h | |||
| @@ -19,7 +19,7 @@ class KTransferMemory; | |||
| 19 | namespace AudioCore { | 19 | namespace AudioCore { |
| 20 | struct AudioRendererParameterInternal; | 20 | struct AudioRendererParameterInternal; |
| 21 | 21 | ||
| 22 | namespace AudioRenderer { | 22 | namespace Renderer { |
| 23 | class Manager; | 23 | class Manager; |
| 24 | 24 | ||
| 25 | /** | 25 | /** |
| @@ -31,7 +31,7 @@ public: | |||
| 31 | 31 | ||
| 32 | /** | 32 | /** |
| 33 | * Initialize the renderer. | 33 | * Initialize the renderer. |
| 34 | * Registers the system with the AudioRenderer::Manager, allocates workbuffers and initializes | 34 | * Registers the system with the Renderer::Manager, allocates workbuffers and initializes |
| 35 | * everything to a default state. | 35 | * everything to a default state. |
| 36 | * | 36 | * |
| 37 | * @param params - Input parameters to initialize the system with. | 37 | * @param params - Input parameters to initialize the system with. |
| @@ -93,5 +93,5 @@ private: | |||
| 93 | System system; | 93 | System system; |
| 94 | }; | 94 | }; |
| 95 | 95 | ||
| 96 | } // namespace AudioRenderer | 96 | } // namespace Renderer |
| 97 | } // namespace AudioCore | 97 | } // namespace AudioCore |
diff --git a/src/audio_core/renderer/behavior/behavior_info.cpp b/src/audio_core/renderer/behavior/behavior_info.cpp index 3d2a91312..058539042 100644 --- a/src/audio_core/renderer/behavior/behavior_info.cpp +++ b/src/audio_core/renderer/behavior/behavior_info.cpp | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | #include "audio_core/common/feature_support.h" | 4 | #include "audio_core/common/feature_support.h" |
| 5 | #include "audio_core/renderer/behavior/behavior_info.h" | 5 | #include "audio_core/renderer/behavior/behavior_info.h" |
| 6 | 6 | ||
| 7 | namespace AudioCore::AudioRenderer { | 7 | namespace AudioCore::Renderer { |
| 8 | 8 | ||
| 9 | BehaviorInfo::BehaviorInfo() : process_revision{CurrentRevision} {} | 9 | BehaviorInfo::BehaviorInfo() : process_revision{CurrentRevision} {} |
| 10 | 10 | ||
| @@ -190,4 +190,4 @@ bool BehaviorInfo::IsI3dl2ReverbChannelMappingChanged() const { | |||
| 190 | return CheckFeatureSupported(SupportTags::I3dl2ReverbChannelMappingChange, user_revision); | 190 | return CheckFeatureSupported(SupportTags::I3dl2ReverbChannelMappingChange, user_revision); |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | } // namespace AudioCore::AudioRenderer | 193 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/behavior/behavior_info.h b/src/audio_core/renderer/behavior/behavior_info.h index b52340229..a4958857a 100644 --- a/src/audio_core/renderer/behavior/behavior_info.h +++ b/src/audio_core/renderer/behavior/behavior_info.h | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | #include "core/hle/service/audio/errors.h" | 11 | #include "core/hle/service/audio/errors.h" |
| 12 | 12 | ||
| 13 | namespace AudioCore::AudioRenderer { | 13 | namespace AudioCore::Renderer { |
| 14 | /** | 14 | /** |
| 15 | * Holds host and user revisions, checks whether render features can be enabled, and reports errors. | 15 | * Holds host and user revisions, checks whether render features can be enabled, and reports errors. |
| 16 | */ | 16 | */ |
| @@ -264,7 +264,7 @@ public: | |||
| 264 | /** | 264 | /** |
| 265 | * Check if skipping voice pitch and sample rate conversion is supported. | 265 | * Check if skipping voice pitch and sample rate conversion is supported. |
| 266 | * This speeds up the data source commands by skipping resampling if unwanted. | 266 | * This speeds up the data source commands by skipping resampling if unwanted. |
| 267 | * See AudioCore::AudioRenderer::DecodeFromWaveBuffers | 267 | * See AudioCore::Renderer::DecodeFromWaveBuffers |
| 268 | * | 268 | * |
| 269 | * @return True if supported, otherwise false. | 269 | * @return True if supported, otherwise false. |
| 270 | */ | 270 | */ |
| @@ -273,7 +273,7 @@ public: | |||
| 273 | /** | 273 | /** |
| 274 | * Check if resetting played sample count at loop points is supported. | 274 | * Check if resetting played sample count at loop points is supported. |
| 275 | * This resets the number of samples played in a voice state when a loop point is reached. | 275 | * This resets the number of samples played in a voice state when a loop point is reached. |
| 276 | * See AudioCore::AudioRenderer::DecodeFromWaveBuffers | 276 | * See AudioCore::Renderer::DecodeFromWaveBuffers |
| 277 | * | 277 | * |
| 278 | * @return True if supported, otherwise false. | 278 | * @return True if supported, otherwise false. |
| 279 | */ | 279 | */ |
| @@ -373,4 +373,4 @@ public: | |||
| 373 | u32 error_count{}; | 373 | u32 error_count{}; |
| 374 | }; | 374 | }; |
| 375 | 375 | ||
| 376 | } // namespace AudioCore::AudioRenderer | 376 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/behavior/info_updater.cpp b/src/audio_core/renderer/behavior/info_updater.cpp index e312eb166..667711e17 100644 --- a/src/audio_core/renderer/behavior/info_updater.cpp +++ b/src/audio_core/renderer/behavior/info_updater.cpp | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | #include "audio_core/renderer/splitter/splitter_context.h" | 15 | #include "audio_core/renderer/splitter/splitter_context.h" |
| 16 | #include "audio_core/renderer/voice/voice_context.h" | 16 | #include "audio_core/renderer/voice/voice_context.h" |
| 17 | 17 | ||
| 18 | namespace AudioCore::AudioRenderer { | 18 | namespace AudioCore::Renderer { |
| 19 | 19 | ||
| 20 | InfoUpdater::InfoUpdater(std::span<const u8> input_, std::span<u8> output_, | 20 | InfoUpdater::InfoUpdater(std::span<const u8> input_, std::span<u8> output_, |
| 21 | const u32 process_handle_, BehaviorInfo& behaviour_) | 21 | const u32 process_handle_, BehaviorInfo& behaviour_) |
| @@ -536,4 +536,4 @@ Result InfoUpdater::CheckConsumedSize() { | |||
| 536 | return ResultSuccess; | 536 | return ResultSuccess; |
| 537 | } | 537 | } |
| 538 | 538 | ||
| 539 | } // namespace AudioCore::AudioRenderer | 539 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/behavior/info_updater.h b/src/audio_core/renderer/behavior/info_updater.h index c817d8d8d..fb4b7d25a 100644 --- a/src/audio_core/renderer/behavior/info_updater.h +++ b/src/audio_core/renderer/behavior/info_updater.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | #include "core/hle/service/audio/errors.h" | 9 | #include "core/hle/service/audio/errors.h" |
| 10 | 10 | ||
| 11 | namespace AudioCore::AudioRenderer { | 11 | namespace AudioCore::Renderer { |
| 12 | class BehaviorInfo; | 12 | class BehaviorInfo; |
| 13 | class VoiceContext; | 13 | class VoiceContext; |
| 14 | class MixContext; | 14 | class MixContext; |
| @@ -202,4 +202,4 @@ private: | |||
| 202 | BehaviorInfo& behaviour; | 202 | BehaviorInfo& behaviour; |
| 203 | }; | 203 | }; |
| 204 | 204 | ||
| 205 | } // namespace AudioCore::AudioRenderer | 205 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/command_buffer.cpp b/src/audio_core/renderer/command/command_buffer.cpp index 0bd418306..67d43e69a 100644 --- a/src/audio_core/renderer/command/command_buffer.cpp +++ b/src/audio_core/renderer/command/command_buffer.cpp | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | #include "audio_core/renderer/voice/voice_info.h" | 16 | #include "audio_core/renderer/voice/voice_info.h" |
| 17 | #include "audio_core/renderer/voice/voice_state.h" | 17 | #include "audio_core/renderer/voice/voice_state.h" |
| 18 | 18 | ||
| 19 | namespace AudioCore::AudioRenderer { | 19 | namespace AudioCore::Renderer { |
| 20 | 20 | ||
| 21 | template <typename T, CommandId Id> | 21 | template <typename T, CommandId Id> |
| 22 | T& CommandBuffer::GenerateStart(const s32 node_id) { | 22 | T& CommandBuffer::GenerateStart(const s32 node_id) { |
| @@ -713,4 +713,4 @@ void CommandBuffer::GenerateCompressorCommand(s16 buffer_offset, EffectInfoBase& | |||
| 713 | GenerateEnd<CompressorCommand>(cmd); | 713 | GenerateEnd<CompressorCommand>(cmd); |
| 714 | } | 714 | } |
| 715 | 715 | ||
| 716 | } // namespace AudioCore::AudioRenderer | 716 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/command_buffer.h b/src/audio_core/renderer/command/command_buffer.h index 162170846..12e8c2c81 100644 --- a/src/audio_core/renderer/command/command_buffer.h +++ b/src/audio_core/renderer/command/command_buffer.h | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | #include "audio_core/renderer/performance/performance_manager.h" | 10 | #include "audio_core/renderer/performance/performance_manager.h" |
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | 12 | ||
| 13 | namespace AudioCore::AudioRenderer { | 13 | namespace AudioCore::Renderer { |
| 14 | struct UpsamplerInfo; | 14 | struct UpsamplerInfo; |
| 15 | struct VoiceState; | 15 | struct VoiceState; |
| 16 | class EffectInfoBase; | 16 | class EffectInfoBase; |
| @@ -465,4 +465,4 @@ private: | |||
| 465 | void GenerateEnd(T& cmd); | 465 | void GenerateEnd(T& cmd); |
| 466 | }; | 466 | }; |
| 467 | 467 | ||
| 468 | } // namespace AudioCore::AudioRenderer | 468 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/command_generator.cpp b/src/audio_core/renderer/command/command_generator.cpp index fba84c7bd..ccb186209 100644 --- a/src/audio_core/renderer/command/command_generator.cpp +++ b/src/audio_core/renderer/command/command_generator.cpp | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | #include "audio_core/renderer/voice/voice_context.h" | 21 | #include "audio_core/renderer/voice/voice_context.h" |
| 22 | #include "common/alignment.h" | 22 | #include "common/alignment.h" |
| 23 | 23 | ||
| 24 | namespace AudioCore::AudioRenderer { | 24 | namespace AudioCore::Renderer { |
| 25 | 25 | ||
| 26 | CommandGenerator::CommandGenerator(CommandBuffer& command_buffer_, | 26 | CommandGenerator::CommandGenerator(CommandBuffer& command_buffer_, |
| 27 | const CommandListHeader& command_list_header_, | 27 | const CommandListHeader& command_list_header_, |
| @@ -793,4 +793,4 @@ void CommandGenerator::GeneratePerformanceCommand( | |||
| 793 | command_buffer.GeneratePerformanceCommand(node_id, state, entry_addresses); | 793 | command_buffer.GeneratePerformanceCommand(node_id, state, entry_addresses); |
| 794 | } | 794 | } |
| 795 | 795 | ||
| 796 | } // namespace AudioCore::AudioRenderer | 796 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/command_generator.h b/src/audio_core/renderer/command/command_generator.h index b3cd7b408..38ee2a64e 100644 --- a/src/audio_core/renderer/command/command_generator.h +++ b/src/audio_core/renderer/command/command_generator.h | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | namespace AudioCore { | 12 | namespace AudioCore { |
| 13 | struct AudioRendererSystemContext; | 13 | struct AudioRendererSystemContext; |
| 14 | 14 | ||
| 15 | namespace AudioRenderer { | 15 | namespace Renderer { |
| 16 | class CommandBuffer; | 16 | class CommandBuffer; |
| 17 | struct CommandListHeader; | 17 | struct CommandListHeader; |
| 18 | class VoiceContext; | 18 | class VoiceContext; |
| @@ -345,5 +345,5 @@ private: | |||
| 345 | PerformanceManager* performance_manager; | 345 | PerformanceManager* performance_manager; |
| 346 | }; | 346 | }; |
| 347 | 347 | ||
| 348 | } // namespace AudioRenderer | 348 | } // namespace Renderer |
| 349 | } // namespace AudioCore | 349 | } // namespace AudioCore |
diff --git a/src/audio_core/renderer/command/command_list_header.h b/src/audio_core/renderer/command/command_list_header.h index 988530b1f..de9ee070b 100644 --- a/src/audio_core/renderer/command/command_list_header.h +++ b/src/audio_core/renderer/command/command_list_header.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #include "audio_core/common/common.h" | 8 | #include "audio_core/common/common.h" |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | 10 | ||
| 11 | namespace AudioCore::AudioRenderer { | 11 | namespace AudioCore::Renderer { |
| 12 | 12 | ||
| 13 | struct CommandListHeader { | 13 | struct CommandListHeader { |
| 14 | u64 buffer_size; | 14 | u64 buffer_size; |
| @@ -19,4 +19,4 @@ struct CommandListHeader { | |||
| 19 | u32 sample_rate; | 19 | u32 sample_rate; |
| 20 | }; | 20 | }; |
| 21 | 21 | ||
| 22 | } // namespace AudioCore::AudioRenderer | 22 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/command_processing_time_estimator.cpp b/src/audio_core/renderer/command/command_processing_time_estimator.cpp index 3091f587a..a48a016b1 100644 --- a/src/audio_core/renderer/command/command_processing_time_estimator.cpp +++ b/src/audio_core/renderer/command/command_processing_time_estimator.cpp | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/command/command_processing_time_estimator.h" | 4 | #include "audio_core/renderer/command/command_processing_time_estimator.h" |
| 5 | 5 | ||
| 6 | namespace AudioCore::AudioRenderer { | 6 | namespace AudioCore::Renderer { |
| 7 | 7 | ||
| 8 | u32 CommandProcessingTimeEstimatorVersion1::Estimate( | 8 | u32 CommandProcessingTimeEstimatorVersion1::Estimate( |
| 9 | const PcmInt16DataSourceVersion1Command& command) const { | 9 | const PcmInt16DataSourceVersion1Command& command) const { |
| @@ -3617,4 +3617,4 @@ u32 CommandProcessingTimeEstimatorVersion5::Estimate(const CompressorCommand& co | |||
| 3617 | } | 3617 | } |
| 3618 | } | 3618 | } |
| 3619 | 3619 | ||
| 3620 | } // namespace AudioCore::AudioRenderer | 3620 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/command_processing_time_estimator.h b/src/audio_core/renderer/command/command_processing_time_estimator.h index 452217196..1c76e4ba4 100644 --- a/src/audio_core/renderer/command/command_processing_time_estimator.h +++ b/src/audio_core/renderer/command/command_processing_time_estimator.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include "audio_core/renderer/command/commands.h" | 6 | #include "audio_core/renderer/command/commands.h" |
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | 8 | ||
| 9 | namespace AudioCore::AudioRenderer { | 9 | namespace AudioCore::Renderer { |
| 10 | /** | 10 | /** |
| 11 | * Estimate the processing time required for all commands. | 11 | * Estimate the processing time required for all commands. |
| 12 | */ | 12 | */ |
| @@ -251,4 +251,4 @@ private: | |||
| 251 | u32 buffer_count{}; | 251 | u32 buffer_count{}; |
| 252 | }; | 252 | }; |
| 253 | 253 | ||
| 254 | } // namespace AudioCore::AudioRenderer | 254 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/data_source/adpcm.cpp b/src/audio_core/renderer/command/data_source/adpcm.cpp index e66ed2990..e7f82d3b3 100644 --- a/src/audio_core/renderer/command/data_source/adpcm.cpp +++ b/src/audio_core/renderer/command/data_source/adpcm.cpp | |||
| @@ -3,23 +3,29 @@ | |||
| 3 | 3 | ||
| 4 | #include <span> | 4 | #include <span> |
| 5 | 5 | ||
| 6 | #include "audio_core/renderer/adsp/command_list_processor.h" | 6 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" |
| 7 | #include "audio_core/renderer/command/data_source/adpcm.h" | 7 | #include "audio_core/renderer/command/data_source/adpcm.h" |
| 8 | #include "audio_core/renderer/command/data_source/decode.h" | 8 | #include "audio_core/renderer/command/data_source/decode.h" |
| 9 | 9 | ||
| 10 | namespace AudioCore::AudioRenderer { | 10 | namespace AudioCore::Renderer { |
| 11 | 11 | ||
| 12 | void AdpcmDataSourceVersion1Command::Dump(const ADSP::CommandListProcessor& processor, | 12 | void AdpcmDataSourceVersion1Command::Dump(const AudioRenderer::CommandListProcessor& processor, |
| 13 | std::string& string) { | 13 | std::string& string) { |
| 14 | string += fmt::format("AdpcmDataSourceVersion1Command\n\toutput_index {:02X} source sample " | 14 | string += fmt::format("AdpcmDataSourceVersion1Command\n\toutput_index {:02X} source sample " |
| 15 | "rate {} target sample rate {} src quality {}\n", | 15 | "rate {} target sample rate {} src quality {}\n", |
| 16 | output_index, sample_rate, processor.target_sample_rate, src_quality); | 16 | output_index, sample_rate, processor.target_sample_rate, src_quality); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | void AdpcmDataSourceVersion1Command::Process(const ADSP::CommandListProcessor& processor) { | 19 | void AdpcmDataSourceVersion1Command::Process(const AudioRenderer::CommandListProcessor& processor) { |
| 20 | auto out_buffer{processor.mix_buffers.subspan(output_index * processor.sample_count, | 20 | auto out_buffer{processor.mix_buffers.subspan(output_index * processor.sample_count, |
| 21 | processor.sample_count)}; | 21 | processor.sample_count)}; |
| 22 | 22 | ||
| 23 | for (auto& wave_buffer : wave_buffers) { | ||
| 24 | wave_buffer.loop_start_offset = wave_buffer.start_offset; | ||
| 25 | wave_buffer.loop_end_offset = wave_buffer.end_offset; | ||
| 26 | wave_buffer.loop_count = wave_buffer.loop ? -1 : 0; | ||
| 27 | } | ||
| 28 | |||
| 23 | DecodeFromWaveBuffersArgs args{ | 29 | DecodeFromWaveBuffersArgs args{ |
| 24 | .sample_format{SampleFormat::Adpcm}, | 30 | .sample_format{SampleFormat::Adpcm}, |
| 25 | .output{out_buffer}, | 31 | .output{out_buffer}, |
| @@ -41,18 +47,18 @@ void AdpcmDataSourceVersion1Command::Process(const ADSP::CommandListProcessor& p | |||
| 41 | DecodeFromWaveBuffers(*processor.memory, args); | 47 | DecodeFromWaveBuffers(*processor.memory, args); |
| 42 | } | 48 | } |
| 43 | 49 | ||
| 44 | bool AdpcmDataSourceVersion1Command::Verify(const ADSP::CommandListProcessor& processor) { | 50 | bool AdpcmDataSourceVersion1Command::Verify(const AudioRenderer::CommandListProcessor& processor) { |
| 45 | return true; | 51 | return true; |
| 46 | } | 52 | } |
| 47 | 53 | ||
| 48 | void AdpcmDataSourceVersion2Command::Dump(const ADSP::CommandListProcessor& processor, | 54 | void AdpcmDataSourceVersion2Command::Dump(const AudioRenderer::CommandListProcessor& processor, |
| 49 | std::string& string) { | 55 | std::string& string) { |
| 50 | string += fmt::format("AdpcmDataSourceVersion2Command\n\toutput_index {:02X} source sample " | 56 | string += fmt::format("AdpcmDataSourceVersion2Command\n\toutput_index {:02X} source sample " |
| 51 | "rate {} target sample rate {} src quality {}\n", | 57 | "rate {} target sample rate {} src quality {}\n", |
| 52 | output_index, sample_rate, processor.target_sample_rate, src_quality); | 58 | output_index, sample_rate, processor.target_sample_rate, src_quality); |
| 53 | } | 59 | } |
| 54 | 60 | ||
| 55 | void AdpcmDataSourceVersion2Command::Process(const ADSP::CommandListProcessor& processor) { | 61 | void AdpcmDataSourceVersion2Command::Process(const AudioRenderer::CommandListProcessor& processor) { |
| 56 | auto out_buffer{processor.mix_buffers.subspan(output_index * processor.sample_count, | 62 | auto out_buffer{processor.mix_buffers.subspan(output_index * processor.sample_count, |
| 57 | processor.sample_count)}; | 63 | processor.sample_count)}; |
| 58 | 64 | ||
| @@ -77,8 +83,8 @@ void AdpcmDataSourceVersion2Command::Process(const ADSP::CommandListProcessor& p | |||
| 77 | DecodeFromWaveBuffers(*processor.memory, args); | 83 | DecodeFromWaveBuffers(*processor.memory, args); |
| 78 | } | 84 | } |
| 79 | 85 | ||
| 80 | bool AdpcmDataSourceVersion2Command::Verify(const ADSP::CommandListProcessor& processor) { | 86 | bool AdpcmDataSourceVersion2Command::Verify(const AudioRenderer::CommandListProcessor& processor) { |
| 81 | return true; | 87 | return true; |
| 82 | } | 88 | } |
| 83 | 89 | ||
| 84 | } // namespace AudioCore::AudioRenderer | 90 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/data_source/adpcm.h b/src/audio_core/renderer/command/data_source/adpcm.h index a9cf9cee4..487846f0c 100644 --- a/src/audio_core/renderer/command/data_source/adpcm.h +++ b/src/audio_core/renderer/command/data_source/adpcm.h | |||
| @@ -11,11 +11,12 @@ | |||
| 11 | #include "audio_core/renderer/command/icommand.h" | 11 | #include "audio_core/renderer/command/icommand.h" |
| 12 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 13 | 13 | ||
| 14 | namespace AudioCore::AudioRenderer { | 14 | namespace AudioCore::ADSP::AudioRenderer { |
| 15 | namespace ADSP { | ||
| 16 | class CommandListProcessor; | 15 | class CommandListProcessor; |
| 17 | } | 16 | } |
| 18 | 17 | ||
| 18 | namespace AudioCore::Renderer { | ||
| 19 | |||
| 19 | /** | 20 | /** |
| 20 | * AudioRenderer command to decode ADPCM-encoded version 1 wavebuffers | 21 | * AudioRenderer command to decode ADPCM-encoded version 1 wavebuffers |
| 21 | * into the output_index mix buffer. | 22 | * into the output_index mix buffer. |
| @@ -27,14 +28,14 @@ struct AdpcmDataSourceVersion1Command : ICommand { | |||
| 27 | * @param processor - The CommandListProcessor processing this command. | 28 | * @param processor - The CommandListProcessor processing this command. |
| 28 | * @param string - The string to print into. | 29 | * @param string - The string to print into. |
| 29 | */ | 30 | */ |
| 30 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 31 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 31 | 32 | ||
| 32 | /** | 33 | /** |
| 33 | * Process this command. | 34 | * Process this command. |
| 34 | * | 35 | * |
| 35 | * @param processor - The CommandListProcessor processing this command. | 36 | * @param processor - The CommandListProcessor processing this command. |
| 36 | */ | 37 | */ |
| 37 | void Process(const ADSP::CommandListProcessor& processor) override; | 38 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 38 | 39 | ||
| 39 | /** | 40 | /** |
| 40 | * Verify this command's data is valid. | 41 | * Verify this command's data is valid. |
| @@ -42,13 +43,13 @@ struct AdpcmDataSourceVersion1Command : ICommand { | |||
| 42 | * @param processor - The CommandListProcessor processing this command. | 43 | * @param processor - The CommandListProcessor processing this command. |
| 43 | * @return True if the command is valid, otherwise false. | 44 | * @return True if the command is valid, otherwise false. |
| 44 | */ | 45 | */ |
| 45 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 46 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 46 | 47 | ||
| 47 | /// Quality used for sample rate conversion | 48 | /// Quality used for sample rate conversion |
| 48 | SrcQuality src_quality; | 49 | SrcQuality src_quality; |
| 49 | /// Mix buffer index for decoded samples | 50 | /// Mix buffer index for decoded samples |
| 50 | s16 output_index; | 51 | s16 output_index; |
| 51 | /// Flags to control decoding (see AudioCore::AudioRenderer::VoiceInfo::Flags) | 52 | /// Flags to control decoding (see AudioCore::Renderer::VoiceInfo::Flags) |
| 52 | u16 flags; | 53 | u16 flags; |
| 53 | /// Wavebuffer sample rate | 54 | /// Wavebuffer sample rate |
| 54 | u32 sample_rate; | 55 | u32 sample_rate; |
| @@ -75,14 +76,14 @@ struct AdpcmDataSourceVersion2Command : ICommand { | |||
| 75 | * @param processor - The CommandListProcessor processing this command. | 76 | * @param processor - The CommandListProcessor processing this command. |
| 76 | * @param string - The string to print into. | 77 | * @param string - The string to print into. |
| 77 | */ | 78 | */ |
| 78 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 79 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 79 | 80 | ||
| 80 | /** | 81 | /** |
| 81 | * Process this command. | 82 | * Process this command. |
| 82 | * | 83 | * |
| 83 | * @param processor - The CommandListProcessor processing this command. | 84 | * @param processor - The CommandListProcessor processing this command. |
| 84 | */ | 85 | */ |
| 85 | void Process(const ADSP::CommandListProcessor& processor) override; | 86 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 86 | 87 | ||
| 87 | /** | 88 | /** |
| 88 | * Verify this command's data is valid. | 89 | * Verify this command's data is valid. |
| @@ -90,13 +91,13 @@ struct AdpcmDataSourceVersion2Command : ICommand { | |||
| 90 | * @param processor - The CommandListProcessor processing this command. | 91 | * @param processor - The CommandListProcessor processing this command. |
| 91 | * @return True if the command is valid, otherwise false. | 92 | * @return True if the command is valid, otherwise false. |
| 92 | */ | 93 | */ |
| 93 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 94 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 94 | 95 | ||
| 95 | /// Quality used for sample rate conversion | 96 | /// Quality used for sample rate conversion |
| 96 | SrcQuality src_quality; | 97 | SrcQuality src_quality; |
| 97 | /// Mix buffer index for decoded samples | 98 | /// Mix buffer index for decoded samples |
| 98 | s16 output_index; | 99 | s16 output_index; |
| 99 | /// Flags to control decoding (see AudioCore::AudioRenderer::VoiceInfo::Flags) | 100 | /// Flags to control decoding (see AudioCore::Renderer::VoiceInfo::Flags) |
| 100 | u16 flags; | 101 | u16 flags; |
| 101 | /// Wavebuffer sample rate | 102 | /// Wavebuffer sample rate |
| 102 | u32 sample_rate; | 103 | u32 sample_rate; |
| @@ -116,4 +117,4 @@ struct AdpcmDataSourceVersion2Command : ICommand { | |||
| 116 | u64 data_size; | 117 | u64 data_size; |
| 117 | }; | 118 | }; |
| 118 | 119 | ||
| 119 | } // namespace AudioCore::AudioRenderer | 120 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/data_source/decode.cpp b/src/audio_core/renderer/command/data_source/decode.cpp index 257aa866e..911dae3c1 100644 --- a/src/audio_core/renderer/command/data_source/decode.cpp +++ b/src/audio_core/renderer/command/data_source/decode.cpp | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | #include "common/scratch_buffer.h" | 11 | #include "common/scratch_buffer.h" |
| 12 | #include "core/memory.h" | 12 | #include "core/memory.h" |
| 13 | 13 | ||
| 14 | namespace AudioCore::AudioRenderer { | 14 | namespace AudioCore::Renderer { |
| 15 | 15 | ||
| 16 | constexpr u32 TempBufferSize = 0x3F00; | 16 | constexpr u32 TempBufferSize = 0x3F00; |
| 17 | constexpr std::array<u8, 3> PitchBySrcQuality = {4, 8, 4}; | 17 | constexpr std::array<u8, 3> PitchBySrcQuality = {4, 8, 4}; |
| @@ -123,11 +123,13 @@ static u32 DecodeAdpcm(Core::Memory::Memory& memory, std::span<s16> out_buffer, | |||
| 123 | return 0; | 123 | return 0; |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | auto samples_to_process{ | 126 | auto start_pos{req.start_offset + req.offset}; |
| 127 | std::min(req.end_offset - req.start_offset - req.offset, req.samples_to_read)}; | 127 | auto samples_to_process{std::min(req.end_offset - start_pos, req.samples_to_read)}; |
| 128 | if (samples_to_process == 0) { | ||
| 129 | return 0; | ||
| 130 | } | ||
| 128 | 131 | ||
| 129 | auto samples_to_read{samples_to_process}; | 132 | auto samples_to_read{samples_to_process}; |
| 130 | auto start_pos{req.start_offset + req.offset}; | ||
| 131 | auto samples_remaining_in_frame{start_pos % SamplesPerFrame}; | 133 | auto samples_remaining_in_frame{start_pos % SamplesPerFrame}; |
| 132 | auto position_in_frame{(start_pos / SamplesPerFrame) * NibblesPerFrame + | 134 | auto position_in_frame{(start_pos / SamplesPerFrame) * NibblesPerFrame + |
| 133 | samples_remaining_in_frame}; | 135 | samples_remaining_in_frame}; |
| @@ -225,13 +227,24 @@ static u32 DecodeAdpcm(Core::Memory::Memory& memory, std::span<s16> out_buffer, | |||
| 225 | * @param args - The wavebuffer data, and information for how to decode it. | 227 | * @param args - The wavebuffer data, and information for how to decode it. |
| 226 | */ | 228 | */ |
| 227 | void DecodeFromWaveBuffers(Core::Memory::Memory& memory, const DecodeFromWaveBuffersArgs& args) { | 229 | void DecodeFromWaveBuffers(Core::Memory::Memory& memory, const DecodeFromWaveBuffersArgs& args) { |
| 230 | static constexpr auto EndWaveBuffer = [](auto& voice_state, auto& wavebuffer, auto& index, | ||
| 231 | auto& played_samples, auto& consumed) -> void { | ||
| 232 | voice_state.wave_buffer_valid[index] = false; | ||
| 233 | voice_state.loop_count = 0; | ||
| 234 | |||
| 235 | if (wavebuffer.stream_ended) { | ||
| 236 | played_samples = 0; | ||
| 237 | } | ||
| 238 | |||
| 239 | index = (index + 1) % MaxWaveBuffers; | ||
| 240 | consumed++; | ||
| 241 | }; | ||
| 228 | auto& voice_state{*args.voice_state}; | 242 | auto& voice_state{*args.voice_state}; |
| 229 | auto remaining_sample_count{args.sample_count}; | 243 | auto remaining_sample_count{args.sample_count}; |
| 230 | auto fraction{voice_state.fraction}; | 244 | auto fraction{voice_state.fraction}; |
| 231 | 245 | ||
| 232 | const auto sample_rate_ratio{ | 246 | const auto sample_rate_ratio{Common::FixedPoint<49, 15>( |
| 233 | (Common::FixedPoint<49, 15>(args.source_sample_rate) / args.target_sample_rate) * | 247 | (f32)args.source_sample_rate / (f32)args.target_sample_rate * (f32)args.pitch)}; |
| 234 | args.pitch}; | ||
| 235 | const auto size_required{fraction + remaining_sample_count * sample_rate_ratio}; | 248 | const auto size_required{fraction + remaining_sample_count * sample_rate_ratio}; |
| 236 | 249 | ||
| 237 | if (size_required < 0) { | 250 | if (size_required < 0) { |
| @@ -298,22 +311,23 @@ void DecodeFromWaveBuffers(Core::Memory::Memory& memory, const DecodeFromWaveBuf | |||
| 298 | auto end_offset{wavebuffer.end_offset}; | 311 | auto end_offset{wavebuffer.end_offset}; |
| 299 | 312 | ||
| 300 | if (wavebuffer.loop && voice_state.loop_count > 0 && | 313 | if (wavebuffer.loop && voice_state.loop_count > 0 && |
| 301 | wavebuffer.loop_start_offset != 0 && wavebuffer.loop_end_offset != 0 && | ||
| 302 | wavebuffer.loop_start_offset <= wavebuffer.loop_end_offset) { | 314 | wavebuffer.loop_start_offset <= wavebuffer.loop_end_offset) { |
| 303 | start_offset = wavebuffer.loop_start_offset; | 315 | start_offset = wavebuffer.loop_start_offset; |
| 304 | end_offset = wavebuffer.loop_end_offset; | 316 | end_offset = wavebuffer.loop_end_offset; |
| 305 | } | 317 | } |
| 306 | 318 | ||
| 307 | DecodeArg decode_arg{.buffer{wavebuffer.buffer}, | 319 | DecodeArg decode_arg{ |
| 308 | .buffer_size{wavebuffer.buffer_size}, | 320 | .buffer{wavebuffer.buffer}, |
| 309 | .start_offset{start_offset}, | 321 | .buffer_size{wavebuffer.buffer_size}, |
| 310 | .end_offset{end_offset}, | 322 | .start_offset{start_offset}, |
| 311 | .channel_count{args.channel_count}, | 323 | .end_offset{end_offset}, |
| 312 | .coefficients{}, | 324 | .channel_count{args.channel_count}, |
| 313 | .adpcm_context{nullptr}, | 325 | .coefficients{}, |
| 314 | .target_channel{args.channel}, | 326 | .adpcm_context{nullptr}, |
| 315 | .offset{offset}, | 327 | .target_channel{args.channel}, |
| 316 | .samples_to_read{samples_to_read - samples_read}}; | 328 | .offset{offset}, |
| 329 | .samples_to_read{samples_to_read - samples_read}, | ||
| 330 | }; | ||
| 317 | 331 | ||
| 318 | s32 samples_decoded{0}; | 332 | s32 samples_decoded{0}; |
| 319 | 333 | ||
| @@ -350,42 +364,30 @@ void DecodeFromWaveBuffers(Core::Memory::Memory& memory, const DecodeFromWaveBuf | |||
| 350 | temp_buffer_pos += samples_decoded; | 364 | temp_buffer_pos += samples_decoded; |
| 351 | offset += samples_decoded; | 365 | offset += samples_decoded; |
| 352 | 366 | ||
| 353 | if (samples_decoded == 0 || offset >= end_offset - start_offset) { | 367 | if (samples_decoded && offset < end_offset - start_offset) { |
| 354 | offset = 0; | 368 | continue; |
| 355 | if (!wavebuffer.loop) { | 369 | } |
| 356 | voice_state.wave_buffer_valid[wavebuffer_index] = false; | 370 | |
| 357 | voice_state.loop_count = 0; | 371 | offset = 0; |
| 358 | 372 | if (wavebuffer.loop) { | |
| 359 | if (wavebuffer.stream_ended) { | 373 | voice_state.loop_count++; |
| 360 | played_sample_count = 0; | 374 | if (wavebuffer.loop_count >= 0 && |
| 361 | } | 375 | (voice_state.loop_count > wavebuffer.loop_count || samples_decoded == 0)) { |
| 362 | 376 | EndWaveBuffer(voice_state, wavebuffer, wavebuffer_index, played_sample_count, | |
| 363 | wavebuffer_index = (wavebuffer_index + 1) % MaxWaveBuffers; | 377 | wavebuffers_consumed); |
| 364 | wavebuffers_consumed++; | 378 | } |
| 365 | } else { | 379 | |
| 366 | voice_state.loop_count++; | 380 | if (samples_decoded == 0) { |
| 367 | if (wavebuffer.loop_count > 0 && | 381 | is_buffer_starved = true; |
| 368 | (voice_state.loop_count > wavebuffer.loop_count || samples_decoded == 0)) { | 382 | break; |
| 369 | voice_state.wave_buffer_valid[wavebuffer_index] = false; | 383 | } |
| 370 | voice_state.loop_count = 0; | 384 | |
| 371 | 385 | if (args.IsVoicePlayedSampleCountResetAtLoopPointSupported) { | |
| 372 | if (wavebuffer.stream_ended) { | 386 | played_sample_count = 0; |
| 373 | played_sample_count = 0; | ||
| 374 | } | ||
| 375 | |||
| 376 | wavebuffer_index = (wavebuffer_index + 1) % MaxWaveBuffers; | ||
| 377 | wavebuffers_consumed++; | ||
| 378 | } | ||
| 379 | |||
| 380 | if (samples_decoded == 0) { | ||
| 381 | is_buffer_starved = true; | ||
| 382 | break; | ||
| 383 | } | ||
| 384 | |||
| 385 | if (args.IsVoicePlayedSampleCountResetAtLoopPointSupported) { | ||
| 386 | played_sample_count = 0; | ||
| 387 | } | ||
| 388 | } | 387 | } |
| 388 | } else { | ||
| 389 | EndWaveBuffer(voice_state, wavebuffer, wavebuffer_index, played_sample_count, | ||
| 390 | wavebuffers_consumed); | ||
| 389 | } | 391 | } |
| 390 | } | 392 | } |
| 391 | 393 | ||
| @@ -423,4 +425,4 @@ void DecodeFromWaveBuffers(Core::Memory::Memory& memory, const DecodeFromWaveBuf | |||
| 423 | voice_state.fraction = fraction; | 425 | voice_state.fraction = fraction; |
| 424 | } | 426 | } |
| 425 | 427 | ||
| 426 | } // namespace AudioCore::AudioRenderer | 428 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/data_source/decode.h b/src/audio_core/renderer/command/data_source/decode.h index 4d63d6fa8..5f52f32f0 100644 --- a/src/audio_core/renderer/command/data_source/decode.h +++ b/src/audio_core/renderer/command/data_source/decode.h | |||
| @@ -15,7 +15,7 @@ namespace Core::Memory { | |||
| 15 | class Memory; | 15 | class Memory; |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | namespace AudioCore::AudioRenderer { | 18 | namespace AudioCore::Renderer { |
| 19 | 19 | ||
| 20 | struct DecodeFromWaveBuffersArgs { | 20 | struct DecodeFromWaveBuffersArgs { |
| 21 | SampleFormat sample_format; | 21 | SampleFormat sample_format; |
| @@ -56,4 +56,4 @@ struct DecodeArg { | |||
| 56 | */ | 56 | */ |
| 57 | void DecodeFromWaveBuffers(Core::Memory::Memory& memory, const DecodeFromWaveBuffersArgs& args); | 57 | void DecodeFromWaveBuffers(Core::Memory::Memory& memory, const DecodeFromWaveBuffersArgs& args); |
| 58 | 58 | ||
| 59 | } // namespace AudioCore::AudioRenderer | 59 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/data_source/pcm_float.cpp b/src/audio_core/renderer/command/data_source/pcm_float.cpp index be77fab69..d1f685656 100644 --- a/src/audio_core/renderer/command/data_source/pcm_float.cpp +++ b/src/audio_core/renderer/command/data_source/pcm_float.cpp | |||
| @@ -1,13 +1,13 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/adsp/command_list_processor.h" | 4 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" |
| 5 | #include "audio_core/renderer/command/data_source/decode.h" | 5 | #include "audio_core/renderer/command/data_source/decode.h" |
| 6 | #include "audio_core/renderer/command/data_source/pcm_float.h" | 6 | #include "audio_core/renderer/command/data_source/pcm_float.h" |
| 7 | 7 | ||
| 8 | namespace AudioCore::AudioRenderer { | 8 | namespace AudioCore::Renderer { |
| 9 | 9 | ||
| 10 | void PcmFloatDataSourceVersion1Command::Dump(const ADSP::CommandListProcessor& processor, | 10 | void PcmFloatDataSourceVersion1Command::Dump(const AudioRenderer::CommandListProcessor& processor, |
| 11 | std::string& string) { | 11 | std::string& string) { |
| 12 | string += | 12 | string += |
| 13 | fmt::format("PcmFloatDataSourceVersion1Command\n\toutput_index {:02X} channel {} " | 13 | fmt::format("PcmFloatDataSourceVersion1Command\n\toutput_index {:02X} channel {} " |
| @@ -16,10 +16,17 @@ void PcmFloatDataSourceVersion1Command::Dump(const ADSP::CommandListProcessor& p | |||
| 16 | processor.target_sample_rate, src_quality); | 16 | processor.target_sample_rate, src_quality); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | void PcmFloatDataSourceVersion1Command::Process(const ADSP::CommandListProcessor& processor) { | 19 | void PcmFloatDataSourceVersion1Command::Process( |
| 20 | const AudioRenderer::CommandListProcessor& processor) { | ||
| 20 | auto out_buffer = processor.mix_buffers.subspan(output_index * processor.sample_count, | 21 | auto out_buffer = processor.mix_buffers.subspan(output_index * processor.sample_count, |
| 21 | processor.sample_count); | 22 | processor.sample_count); |
| 22 | 23 | ||
| 24 | for (auto& wave_buffer : wave_buffers) { | ||
| 25 | wave_buffer.loop_start_offset = wave_buffer.start_offset; | ||
| 26 | wave_buffer.loop_end_offset = wave_buffer.end_offset; | ||
| 27 | wave_buffer.loop_count = wave_buffer.loop ? -1 : 0; | ||
| 28 | } | ||
| 29 | |||
| 23 | DecodeFromWaveBuffersArgs args{ | 30 | DecodeFromWaveBuffersArgs args{ |
| 24 | .sample_format{SampleFormat::PcmFloat}, | 31 | .sample_format{SampleFormat::PcmFloat}, |
| 25 | .output{out_buffer}, | 32 | .output{out_buffer}, |
| @@ -41,11 +48,12 @@ void PcmFloatDataSourceVersion1Command::Process(const ADSP::CommandListProcessor | |||
| 41 | DecodeFromWaveBuffers(*processor.memory, args); | 48 | DecodeFromWaveBuffers(*processor.memory, args); |
| 42 | } | 49 | } |
| 43 | 50 | ||
| 44 | bool PcmFloatDataSourceVersion1Command::Verify(const ADSP::CommandListProcessor& processor) { | 51 | bool PcmFloatDataSourceVersion1Command::Verify( |
| 52 | const AudioRenderer::CommandListProcessor& processor) { | ||
| 45 | return true; | 53 | return true; |
| 46 | } | 54 | } |
| 47 | 55 | ||
| 48 | void PcmFloatDataSourceVersion2Command::Dump(const ADSP::CommandListProcessor& processor, | 56 | void PcmFloatDataSourceVersion2Command::Dump(const AudioRenderer::CommandListProcessor& processor, |
| 49 | std::string& string) { | 57 | std::string& string) { |
| 50 | string += | 58 | string += |
| 51 | fmt::format("PcmFloatDataSourceVersion2Command\n\toutput_index {:02X} channel {} " | 59 | fmt::format("PcmFloatDataSourceVersion2Command\n\toutput_index {:02X} channel {} " |
| @@ -54,7 +62,8 @@ void PcmFloatDataSourceVersion2Command::Dump(const ADSP::CommandListProcessor& p | |||
| 54 | processor.target_sample_rate, src_quality); | 62 | processor.target_sample_rate, src_quality); |
| 55 | } | 63 | } |
| 56 | 64 | ||
| 57 | void PcmFloatDataSourceVersion2Command::Process(const ADSP::CommandListProcessor& processor) { | 65 | void PcmFloatDataSourceVersion2Command::Process( |
| 66 | const AudioRenderer::CommandListProcessor& processor) { | ||
| 58 | auto out_buffer = processor.mix_buffers.subspan(output_index * processor.sample_count, | 67 | auto out_buffer = processor.mix_buffers.subspan(output_index * processor.sample_count, |
| 59 | processor.sample_count); | 68 | processor.sample_count); |
| 60 | 69 | ||
| @@ -79,8 +88,9 @@ void PcmFloatDataSourceVersion2Command::Process(const ADSP::CommandListProcessor | |||
| 79 | DecodeFromWaveBuffers(*processor.memory, args); | 88 | DecodeFromWaveBuffers(*processor.memory, args); |
| 80 | } | 89 | } |
| 81 | 90 | ||
| 82 | bool PcmFloatDataSourceVersion2Command::Verify(const ADSP::CommandListProcessor& processor) { | 91 | bool PcmFloatDataSourceVersion2Command::Verify( |
| 92 | const AudioRenderer::CommandListProcessor& processor) { | ||
| 83 | return true; | 93 | return true; |
| 84 | } | 94 | } |
| 85 | 95 | ||
| 86 | } // namespace AudioCore::AudioRenderer | 96 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/data_source/pcm_float.h b/src/audio_core/renderer/command/data_source/pcm_float.h index e4af77c20..2c9d1877e 100644 --- a/src/audio_core/renderer/command/data_source/pcm_float.h +++ b/src/audio_core/renderer/command/data_source/pcm_float.h | |||
| @@ -9,11 +9,12 @@ | |||
| 9 | #include "audio_core/renderer/command/icommand.h" | 9 | #include "audio_core/renderer/command/icommand.h" |
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | 11 | ||
| 12 | namespace AudioCore::AudioRenderer { | 12 | namespace AudioCore::ADSP::AudioRenderer { |
| 13 | namespace ADSP { | ||
| 14 | class CommandListProcessor; | 13 | class CommandListProcessor; |
| 15 | } | 14 | } |
| 16 | 15 | ||
| 16 | namespace AudioCore::Renderer { | ||
| 17 | |||
| 17 | /** | 18 | /** |
| 18 | * AudioRenderer command to decode PCM float-encoded version 1 wavebuffers | 19 | * AudioRenderer command to decode PCM float-encoded version 1 wavebuffers |
| 19 | * into the output_index mix buffer. | 20 | * into the output_index mix buffer. |
| @@ -25,14 +26,14 @@ struct PcmFloatDataSourceVersion1Command : ICommand { | |||
| 25 | * @param processor - The CommandListProcessor processing this command. | 26 | * @param processor - The CommandListProcessor processing this command. |
| 26 | * @param string - The string to print into. | 27 | * @param string - The string to print into. |
| 27 | */ | 28 | */ |
| 28 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 29 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 29 | 30 | ||
| 30 | /** | 31 | /** |
| 31 | * Process this command. | 32 | * Process this command. |
| 32 | * | 33 | * |
| 33 | * @param processor - The CommandListProcessor processing this command. | 34 | * @param processor - The CommandListProcessor processing this command. |
| 34 | */ | 35 | */ |
| 35 | void Process(const ADSP::CommandListProcessor& processor) override; | 36 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 36 | 37 | ||
| 37 | /** | 38 | /** |
| 38 | * Verify this command's data is valid. | 39 | * Verify this command's data is valid. |
| @@ -40,13 +41,13 @@ struct PcmFloatDataSourceVersion1Command : ICommand { | |||
| 40 | * @param processor - The CommandListProcessor processing this command. | 41 | * @param processor - The CommandListProcessor processing this command. |
| 41 | * @return True if the command is valid, otherwise false. | 42 | * @return True if the command is valid, otherwise false. |
| 42 | */ | 43 | */ |
| 43 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 44 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 44 | 45 | ||
| 45 | /// Quality used for sample rate conversion | 46 | /// Quality used for sample rate conversion |
| 46 | SrcQuality src_quality; | 47 | SrcQuality src_quality; |
| 47 | /// Mix buffer index for decoded samples | 48 | /// Mix buffer index for decoded samples |
| 48 | s16 output_index; | 49 | s16 output_index; |
| 49 | /// Flags to control decoding (see AudioCore::AudioRenderer::VoiceInfo::Flags) | 50 | /// Flags to control decoding (see AudioCore::Renderer::VoiceInfo::Flags) |
| 50 | u16 flags; | 51 | u16 flags; |
| 51 | /// Wavebuffer sample rate | 52 | /// Wavebuffer sample rate |
| 52 | u32 sample_rate; | 53 | u32 sample_rate; |
| @@ -73,14 +74,14 @@ struct PcmFloatDataSourceVersion2Command : ICommand { | |||
| 73 | * @param processor - The CommandListProcessor processing this command. | 74 | * @param processor - The CommandListProcessor processing this command. |
| 74 | * @param string - The string to print into. | 75 | * @param string - The string to print into. |
| 75 | */ | 76 | */ |
| 76 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 77 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 77 | 78 | ||
| 78 | /** | 79 | /** |
| 79 | * Process this command. | 80 | * Process this command. |
| 80 | * | 81 | * |
| 81 | * @param processor - The CommandListProcessor processing this command. | 82 | * @param processor - The CommandListProcessor processing this command. |
| 82 | */ | 83 | */ |
| 83 | void Process(const ADSP::CommandListProcessor& processor) override; | 84 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 84 | 85 | ||
| 85 | /** | 86 | /** |
| 86 | * Verify this command's data is valid. | 87 | * Verify this command's data is valid. |
| @@ -88,13 +89,13 @@ struct PcmFloatDataSourceVersion2Command : ICommand { | |||
| 88 | * @param processor - The CommandListProcessor processing this command. | 89 | * @param processor - The CommandListProcessor processing this command. |
| 89 | * @return True if the command is valid, otherwise false. | 90 | * @return True if the command is valid, otherwise false. |
| 90 | */ | 91 | */ |
| 91 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 92 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 92 | 93 | ||
| 93 | /// Quality used for sample rate conversion | 94 | /// Quality used for sample rate conversion |
| 94 | SrcQuality src_quality; | 95 | SrcQuality src_quality; |
| 95 | /// Mix buffer index for decoded samples | 96 | /// Mix buffer index for decoded samples |
| 96 | s16 output_index; | 97 | s16 output_index; |
| 97 | /// Flags to control decoding (see AudioCore::AudioRenderer::VoiceInfo::Flags) | 98 | /// Flags to control decoding (see AudioCore::Renderer::VoiceInfo::Flags) |
| 98 | u16 flags; | 99 | u16 flags; |
| 99 | /// Wavebuffer sample rate | 100 | /// Wavebuffer sample rate |
| 100 | u32 sample_rate; | 101 | u32 sample_rate; |
| @@ -110,4 +111,4 @@ struct PcmFloatDataSourceVersion2Command : ICommand { | |||
| 110 | CpuAddr voice_state; | 111 | CpuAddr voice_state; |
| 111 | }; | 112 | }; |
| 112 | 113 | ||
| 113 | } // namespace AudioCore::AudioRenderer | 114 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/data_source/pcm_int16.cpp b/src/audio_core/renderer/command/data_source/pcm_int16.cpp index 7a27463e4..c89a5aaac 100644 --- a/src/audio_core/renderer/command/data_source/pcm_int16.cpp +++ b/src/audio_core/renderer/command/data_source/pcm_int16.cpp | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | 3 | ||
| 4 | #include <span> | 4 | #include <span> |
| 5 | 5 | ||
| 6 | #include "audio_core/renderer/adsp/command_list_processor.h" | 6 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" |
| 7 | #include "audio_core/renderer/command/data_source/decode.h" | 7 | #include "audio_core/renderer/command/data_source/decode.h" |
| 8 | #include "audio_core/renderer/command/data_source/pcm_int16.h" | 8 | #include "audio_core/renderer/command/data_source/pcm_int16.h" |
| 9 | 9 | ||
| 10 | namespace AudioCore::AudioRenderer { | 10 | namespace AudioCore::Renderer { |
| 11 | 11 | ||
| 12 | void PcmInt16DataSourceVersion1Command::Dump(const ADSP::CommandListProcessor& processor, | 12 | void PcmInt16DataSourceVersion1Command::Dump(const AudioRenderer::CommandListProcessor& processor, |
| 13 | std::string& string) { | 13 | std::string& string) { |
| 14 | string += | 14 | string += |
| 15 | fmt::format("PcmInt16DataSourceVersion1Command\n\toutput_index {:02X} channel {} " | 15 | fmt::format("PcmInt16DataSourceVersion1Command\n\toutput_index {:02X} channel {} " |
| @@ -18,10 +18,17 @@ void PcmInt16DataSourceVersion1Command::Dump(const ADSP::CommandListProcessor& p | |||
| 18 | processor.target_sample_rate, src_quality); | 18 | processor.target_sample_rate, src_quality); |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | void PcmInt16DataSourceVersion1Command::Process(const ADSP::CommandListProcessor& processor) { | 21 | void PcmInt16DataSourceVersion1Command::Process( |
| 22 | const AudioRenderer::CommandListProcessor& processor) { | ||
| 22 | auto out_buffer = processor.mix_buffers.subspan(output_index * processor.sample_count, | 23 | auto out_buffer = processor.mix_buffers.subspan(output_index * processor.sample_count, |
| 23 | processor.sample_count); | 24 | processor.sample_count); |
| 24 | 25 | ||
| 26 | for (auto& wave_buffer : wave_buffers) { | ||
| 27 | wave_buffer.loop_start_offset = wave_buffer.start_offset; | ||
| 28 | wave_buffer.loop_end_offset = wave_buffer.end_offset; | ||
| 29 | wave_buffer.loop_count = wave_buffer.loop ? -1 : 0; | ||
| 30 | } | ||
| 31 | |||
| 25 | DecodeFromWaveBuffersArgs args{ | 32 | DecodeFromWaveBuffersArgs args{ |
| 26 | .sample_format{SampleFormat::PcmInt16}, | 33 | .sample_format{SampleFormat::PcmInt16}, |
| 27 | .output{out_buffer}, | 34 | .output{out_buffer}, |
| @@ -43,11 +50,12 @@ void PcmInt16DataSourceVersion1Command::Process(const ADSP::CommandListProcessor | |||
| 43 | DecodeFromWaveBuffers(*processor.memory, args); | 50 | DecodeFromWaveBuffers(*processor.memory, args); |
| 44 | } | 51 | } |
| 45 | 52 | ||
| 46 | bool PcmInt16DataSourceVersion1Command::Verify(const ADSP::CommandListProcessor& processor) { | 53 | bool PcmInt16DataSourceVersion1Command::Verify( |
| 54 | const AudioRenderer::CommandListProcessor& processor) { | ||
| 47 | return true; | 55 | return true; |
| 48 | } | 56 | } |
| 49 | 57 | ||
| 50 | void PcmInt16DataSourceVersion2Command::Dump(const ADSP::CommandListProcessor& processor, | 58 | void PcmInt16DataSourceVersion2Command::Dump(const AudioRenderer::CommandListProcessor& processor, |
| 51 | std::string& string) { | 59 | std::string& string) { |
| 52 | string += | 60 | string += |
| 53 | fmt::format("PcmInt16DataSourceVersion2Command\n\toutput_index {:02X} channel {} " | 61 | fmt::format("PcmInt16DataSourceVersion2Command\n\toutput_index {:02X} channel {} " |
| @@ -56,7 +64,8 @@ void PcmInt16DataSourceVersion2Command::Dump(const ADSP::CommandListProcessor& p | |||
| 56 | processor.target_sample_rate, src_quality); | 64 | processor.target_sample_rate, src_quality); |
| 57 | } | 65 | } |
| 58 | 66 | ||
| 59 | void PcmInt16DataSourceVersion2Command::Process(const ADSP::CommandListProcessor& processor) { | 67 | void PcmInt16DataSourceVersion2Command::Process( |
| 68 | const AudioRenderer::CommandListProcessor& processor) { | ||
| 60 | auto out_buffer = processor.mix_buffers.subspan(output_index * processor.sample_count, | 69 | auto out_buffer = processor.mix_buffers.subspan(output_index * processor.sample_count, |
| 61 | processor.sample_count); | 70 | processor.sample_count); |
| 62 | DecodeFromWaveBuffersArgs args{ | 71 | DecodeFromWaveBuffersArgs args{ |
| @@ -80,8 +89,9 @@ void PcmInt16DataSourceVersion2Command::Process(const ADSP::CommandListProcessor | |||
| 80 | DecodeFromWaveBuffers(*processor.memory, args); | 89 | DecodeFromWaveBuffers(*processor.memory, args); |
| 81 | } | 90 | } |
| 82 | 91 | ||
| 83 | bool PcmInt16DataSourceVersion2Command::Verify(const ADSP::CommandListProcessor& processor) { | 92 | bool PcmInt16DataSourceVersion2Command::Verify( |
| 93 | const AudioRenderer::CommandListProcessor& processor) { | ||
| 84 | return true; | 94 | return true; |
| 85 | } | 95 | } |
| 86 | 96 | ||
| 87 | } // namespace AudioCore::AudioRenderer | 97 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/data_source/pcm_int16.h b/src/audio_core/renderer/command/data_source/pcm_int16.h index 5de1ad60d..2c013f003 100644 --- a/src/audio_core/renderer/command/data_source/pcm_int16.h +++ b/src/audio_core/renderer/command/data_source/pcm_int16.h | |||
| @@ -9,11 +9,12 @@ | |||
| 9 | #include "audio_core/renderer/command/icommand.h" | 9 | #include "audio_core/renderer/command/icommand.h" |
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | 11 | ||
| 12 | namespace AudioCore::AudioRenderer { | 12 | namespace AudioCore::ADSP::AudioRenderer { |
| 13 | namespace ADSP { | ||
| 14 | class CommandListProcessor; | 13 | class CommandListProcessor; |
| 15 | } | 14 | } |
| 16 | 15 | ||
| 16 | namespace AudioCore::Renderer { | ||
| 17 | |||
| 17 | /** | 18 | /** |
| 18 | * AudioRenderer command to decode PCM s16-encoded version 1 wavebuffers | 19 | * AudioRenderer command to decode PCM s16-encoded version 1 wavebuffers |
| 19 | * into the output_index mix buffer. | 20 | * into the output_index mix buffer. |
| @@ -25,14 +26,14 @@ struct PcmInt16DataSourceVersion1Command : ICommand { | |||
| 25 | * @param processor - The CommandListProcessor processing this command. | 26 | * @param processor - The CommandListProcessor processing this command. |
| 26 | * @param string - The string to print into. | 27 | * @param string - The string to print into. |
| 27 | */ | 28 | */ |
| 28 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 29 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 29 | 30 | ||
| 30 | /** | 31 | /** |
| 31 | * Process this command. | 32 | * Process this command. |
| 32 | * | 33 | * |
| 33 | * @param processor - The CommandListProcessor processing this command. | 34 | * @param processor - The CommandListProcessor processing this command. |
| 34 | */ | 35 | */ |
| 35 | void Process(const ADSP::CommandListProcessor& processor) override; | 36 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 36 | 37 | ||
| 37 | /** | 38 | /** |
| 38 | * Verify this command's data is valid. | 39 | * Verify this command's data is valid. |
| @@ -40,13 +41,13 @@ struct PcmInt16DataSourceVersion1Command : ICommand { | |||
| 40 | * @param processor - The CommandListProcessor processing this command. | 41 | * @param processor - The CommandListProcessor processing this command. |
| 41 | * @return True if the command is valid, otherwise false. | 42 | * @return True if the command is valid, otherwise false. |
| 42 | */ | 43 | */ |
| 43 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 44 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 44 | 45 | ||
| 45 | /// Quality used for sample rate conversion | 46 | /// Quality used for sample rate conversion |
| 46 | SrcQuality src_quality; | 47 | SrcQuality src_quality; |
| 47 | /// Mix buffer index for decoded samples | 48 | /// Mix buffer index for decoded samples |
| 48 | s16 output_index; | 49 | s16 output_index; |
| 49 | /// Flags to control decoding (see AudioCore::AudioRenderer::VoiceInfo::Flags) | 50 | /// Flags to control decoding (see AudioCore::Renderer::VoiceInfo::Flags) |
| 50 | u16 flags; | 51 | u16 flags; |
| 51 | /// Wavebuffer sample rate | 52 | /// Wavebuffer sample rate |
| 52 | u32 sample_rate; | 53 | u32 sample_rate; |
| @@ -72,26 +73,26 @@ struct PcmInt16DataSourceVersion2Command : ICommand { | |||
| 72 | * @param processor - The CommandListProcessor processing this command. | 73 | * @param processor - The CommandListProcessor processing this command. |
| 73 | * @param string - The string to print into. | 74 | * @param string - The string to print into. |
| 74 | */ | 75 | */ |
| 75 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 76 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 76 | 77 | ||
| 77 | /** | 78 | /** |
| 78 | * Process this command. | 79 | * Process this command. |
| 79 | * @param processor - The CommandListProcessor processing this command. | 80 | * @param processor - The CommandListProcessor processing this command. |
| 80 | */ | 81 | */ |
| 81 | void Process(const ADSP::CommandListProcessor& processor) override; | 82 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 82 | 83 | ||
| 83 | /** | 84 | /** |
| 84 | * Verify this command's data is valid. | 85 | * Verify this command's data is valid. |
| 85 | * @param processor - The CommandListProcessor processing this command. | 86 | * @param processor - The CommandListProcessor processing this command. |
| 86 | * @return True if the command is valid, otherwise false. | 87 | * @return True if the command is valid, otherwise false. |
| 87 | */ | 88 | */ |
| 88 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 89 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 89 | 90 | ||
| 90 | /// Quality used for sample rate conversion | 91 | /// Quality used for sample rate conversion |
| 91 | SrcQuality src_quality; | 92 | SrcQuality src_quality; |
| 92 | /// Mix buffer index for decoded samples | 93 | /// Mix buffer index for decoded samples |
| 93 | s16 output_index; | 94 | s16 output_index; |
| 94 | /// Flags to control decoding (see AudioCore::AudioRenderer::VoiceInfo::Flags) | 95 | /// Flags to control decoding (see AudioCore::Renderer::VoiceInfo::Flags) |
| 95 | u16 flags; | 96 | u16 flags; |
| 96 | /// Wavebuffer sample rate | 97 | /// Wavebuffer sample rate |
| 97 | u32 sample_rate; | 98 | u32 sample_rate; |
| @@ -107,4 +108,4 @@ struct PcmInt16DataSourceVersion2Command : ICommand { | |||
| 107 | CpuAddr voice_state; | 108 | CpuAddr voice_state; |
| 108 | }; | 109 | }; |
| 109 | 110 | ||
| 110 | } // namespace AudioCore::AudioRenderer | 111 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/effect/aux_.cpp b/src/audio_core/renderer/command/effect/aux_.cpp index a3e12b3e7..74d9c229f 100644 --- a/src/audio_core/renderer/command/effect/aux_.cpp +++ b/src/audio_core/renderer/command/effect/aux_.cpp | |||
| @@ -1,13 +1,13 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/adsp/command_list_processor.h" | 4 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" |
| 5 | #include "audio_core/renderer/command/effect/aux_.h" | 5 | #include "audio_core/renderer/command/effect/aux_.h" |
| 6 | #include "audio_core/renderer/effect/aux_.h" | 6 | #include "audio_core/renderer/effect/aux_.h" |
| 7 | #include "core/core.h" | 7 | #include "core/core.h" |
| 8 | #include "core/memory.h" | 8 | #include "core/memory.h" |
| 9 | 9 | ||
| 10 | namespace AudioCore::AudioRenderer { | 10 | namespace AudioCore::Renderer { |
| 11 | /** | 11 | /** |
| 12 | * Reset an AuxBuffer. | 12 | * Reset an AuxBuffer. |
| 13 | * | 13 | * |
| @@ -175,13 +175,13 @@ static u32 ReadAuxBufferDsp(Core::Memory::Memory& memory, CpuAddr return_info_, | |||
| 175 | return read_count_; | 175 | return read_count_; |
| 176 | } | 176 | } |
| 177 | 177 | ||
| 178 | void AuxCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, | 178 | void AuxCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, |
| 179 | std::string& string) { | 179 | std::string& string) { |
| 180 | string += fmt::format("AuxCommand\n\tenabled {} input {:02X} output {:02X}\n", effect_enabled, | 180 | string += fmt::format("AuxCommand\n\tenabled {} input {:02X} output {:02X}\n", effect_enabled, |
| 181 | input, output); | 181 | input, output); |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | void AuxCommand::Process(const ADSP::CommandListProcessor& processor) { | 184 | void AuxCommand::Process(const AudioRenderer::CommandListProcessor& processor) { |
| 185 | auto input_buffer{ | 185 | auto input_buffer{ |
| 186 | processor.mix_buffers.subspan(input * processor.sample_count, processor.sample_count)}; | 186 | processor.mix_buffers.subspan(input * processor.sample_count, processor.sample_count)}; |
| 187 | auto output_buffer{ | 187 | auto output_buffer{ |
| @@ -208,8 +208,8 @@ void AuxCommand::Process(const ADSP::CommandListProcessor& processor) { | |||
| 208 | } | 208 | } |
| 209 | } | 209 | } |
| 210 | 210 | ||
| 211 | bool AuxCommand::Verify(const ADSP::CommandListProcessor& processor) { | 211 | bool AuxCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { |
| 212 | return true; | 212 | return true; |
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | } // namespace AudioCore::AudioRenderer | 215 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/effect/aux_.h b/src/audio_core/renderer/command/effect/aux_.h index 825c93732..da1e55261 100644 --- a/src/audio_core/renderer/command/effect/aux_.h +++ b/src/audio_core/renderer/command/effect/aux_.h | |||
| @@ -8,11 +8,12 @@ | |||
| 8 | #include "audio_core/renderer/command/icommand.h" | 8 | #include "audio_core/renderer/command/icommand.h" |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | 10 | ||
| 11 | namespace AudioCore::AudioRenderer { | 11 | namespace AudioCore::ADSP::AudioRenderer { |
| 12 | namespace ADSP { | ||
| 13 | class CommandListProcessor; | 12 | class CommandListProcessor; |
| 14 | } | 13 | } |
| 15 | 14 | ||
| 15 | namespace AudioCore::Renderer { | ||
| 16 | |||
| 16 | /** | 17 | /** |
| 17 | * AudioRenderer command to read and write an auxiliary buffer, writing the input mix buffer to game | 18 | * AudioRenderer command to read and write an auxiliary buffer, writing the input mix buffer to game |
| 18 | * memory, and reading into the output buffer from game memory. | 19 | * memory, and reading into the output buffer from game memory. |
| @@ -24,14 +25,14 @@ struct AuxCommand : ICommand { | |||
| 24 | * @param processor - The CommandListProcessor processing this command. | 25 | * @param processor - The CommandListProcessor processing this command. |
| 25 | * @param string - The string to print into. | 26 | * @param string - The string to print into. |
| 26 | */ | 27 | */ |
| 27 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 28 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 28 | 29 | ||
| 29 | /** | 30 | /** |
| 30 | * Process this command. | 31 | * Process this command. |
| 31 | * | 32 | * |
| 32 | * @param processor - The CommandListProcessor processing this command. | 33 | * @param processor - The CommandListProcessor processing this command. |
| 33 | */ | 34 | */ |
| 34 | void Process(const ADSP::CommandListProcessor& processor) override; | 35 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 35 | 36 | ||
| 36 | /** | 37 | /** |
| 37 | * Verify this command's data is valid. | 38 | * Verify this command's data is valid. |
| @@ -39,7 +40,7 @@ struct AuxCommand : ICommand { | |||
| 39 | * @param processor - The CommandListProcessor processing this command. | 40 | * @param processor - The CommandListProcessor processing this command. |
| 40 | * @return True if the command is valid, otherwise false. | 41 | * @return True if the command is valid, otherwise false. |
| 41 | */ | 42 | */ |
| 42 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 43 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 43 | 44 | ||
| 44 | /// Input mix buffer index | 45 | /// Input mix buffer index |
| 45 | s16 input; | 46 | s16 input; |
| @@ -63,4 +64,4 @@ struct AuxCommand : ICommand { | |||
| 63 | bool effect_enabled; | 64 | bool effect_enabled; |
| 64 | }; | 65 | }; |
| 65 | 66 | ||
| 66 | } // namespace AudioCore::AudioRenderer | 67 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/effect/biquad_filter.cpp b/src/audio_core/renderer/command/effect/biquad_filter.cpp index dea6423dc..3392e7747 100644 --- a/src/audio_core/renderer/command/effect/biquad_filter.cpp +++ b/src/audio_core/renderer/command/effect/biquad_filter.cpp | |||
| @@ -1,12 +1,12 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/adsp/command_list_processor.h" | 4 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" |
| 5 | #include "audio_core/renderer/command/effect/biquad_filter.h" | 5 | #include "audio_core/renderer/command/effect/biquad_filter.h" |
| 6 | #include "audio_core/renderer/voice/voice_state.h" | 6 | #include "audio_core/renderer/voice/voice_state.h" |
| 7 | #include "common/bit_cast.h" | 7 | #include "common/bit_cast.h" |
| 8 | 8 | ||
| 9 | namespace AudioCore::AudioRenderer { | 9 | namespace AudioCore::Renderer { |
| 10 | /** | 10 | /** |
| 11 | * Biquad filter float implementation. | 11 | * Biquad filter float implementation. |
| 12 | * | 12 | * |
| @@ -76,14 +76,14 @@ static void ApplyBiquadFilterInt(std::span<s32> output, std::span<const s32> inp | |||
| 76 | } | 76 | } |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | void BiquadFilterCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, | 79 | void BiquadFilterCommand::Dump( |
| 80 | std::string& string) { | 80 | [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { |
| 81 | string += fmt::format( | 81 | string += fmt::format( |
| 82 | "BiquadFilterCommand\n\tinput {:02X} output {:02X} needs_init {} use_float_processing {}\n", | 82 | "BiquadFilterCommand\n\tinput {:02X} output {:02X} needs_init {} use_float_processing {}\n", |
| 83 | input, output, needs_init, use_float_processing); | 83 | input, output, needs_init, use_float_processing); |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | void BiquadFilterCommand::Process(const ADSP::CommandListProcessor& processor) { | 86 | void BiquadFilterCommand::Process(const AudioRenderer::CommandListProcessor& processor) { |
| 87 | auto state_{reinterpret_cast<VoiceState::BiquadFilterState*>(state)}; | 87 | auto state_{reinterpret_cast<VoiceState::BiquadFilterState*>(state)}; |
| 88 | if (needs_init) { | 88 | if (needs_init) { |
| 89 | *state_ = {}; | 89 | *state_ = {}; |
| @@ -103,8 +103,8 @@ void BiquadFilterCommand::Process(const ADSP::CommandListProcessor& processor) { | |||
| 103 | } | 103 | } |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | bool BiquadFilterCommand::Verify(const ADSP::CommandListProcessor& processor) { | 106 | bool BiquadFilterCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { |
| 107 | return true; | 107 | return true; |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | } // namespace AudioCore::AudioRenderer | 110 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/effect/biquad_filter.h b/src/audio_core/renderer/command/effect/biquad_filter.h index 4c9c42d29..0e903930a 100644 --- a/src/audio_core/renderer/command/effect/biquad_filter.h +++ b/src/audio_core/renderer/command/effect/biquad_filter.h | |||
| @@ -10,11 +10,12 @@ | |||
| 10 | #include "audio_core/renderer/voice/voice_state.h" | 10 | #include "audio_core/renderer/voice/voice_state.h" |
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | 12 | ||
| 13 | namespace AudioCore::AudioRenderer { | 13 | namespace AudioCore::ADSP::AudioRenderer { |
| 14 | namespace ADSP { | ||
| 15 | class CommandListProcessor; | 14 | class CommandListProcessor; |
| 16 | } | 15 | } |
| 17 | 16 | ||
| 17 | namespace AudioCore::Renderer { | ||
| 18 | |||
| 18 | /** | 19 | /** |
| 19 | * AudioRenderer command for applying a biquad filter to the input mix buffer, saving the results to | 20 | * AudioRenderer command for applying a biquad filter to the input mix buffer, saving the results to |
| 20 | * the output mix buffer. | 21 | * the output mix buffer. |
| @@ -26,14 +27,14 @@ struct BiquadFilterCommand : ICommand { | |||
| 26 | * @param processor - The CommandListProcessor processing this command. | 27 | * @param processor - The CommandListProcessor processing this command. |
| 27 | * @param string - The string to print into. | 28 | * @param string - The string to print into. |
| 28 | */ | 29 | */ |
| 29 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 30 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 30 | 31 | ||
| 31 | /** | 32 | /** |
| 32 | * Process this command. | 33 | * Process this command. |
| 33 | * | 34 | * |
| 34 | * @param processor - The CommandListProcessor processing this command. | 35 | * @param processor - The CommandListProcessor processing this command. |
| 35 | */ | 36 | */ |
| 36 | void Process(const ADSP::CommandListProcessor& processor) override; | 37 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 37 | 38 | ||
| 38 | /** | 39 | /** |
| 39 | * Verify this command's data is valid. | 40 | * Verify this command's data is valid. |
| @@ -41,7 +42,7 @@ struct BiquadFilterCommand : ICommand { | |||
| 41 | * @param processor - The CommandListProcessor processing this command. | 42 | * @param processor - The CommandListProcessor processing this command. |
| 42 | * @return True if the command is valid, otherwise false. | 43 | * @return True if the command is valid, otherwise false. |
| 43 | */ | 44 | */ |
| 44 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 45 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 45 | 46 | ||
| 46 | /// Input mix buffer index | 47 | /// Input mix buffer index |
| 47 | s16 input; | 48 | s16 input; |
| @@ -71,4 +72,4 @@ void ApplyBiquadFilterFloat(std::span<s32> output, std::span<const s32> input, | |||
| 71 | std::array<s16, 3>& b, std::array<s16, 2>& a, | 72 | std::array<s16, 3>& b, std::array<s16, 2>& a, |
| 72 | VoiceState::BiquadFilterState& state, const u32 sample_count); | 73 | VoiceState::BiquadFilterState& state, const u32 sample_count); |
| 73 | 74 | ||
| 74 | } // namespace AudioCore::AudioRenderer | 75 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/effect/capture.cpp b/src/audio_core/renderer/command/effect/capture.cpp index 042fd286e..f235ce027 100644 --- a/src/audio_core/renderer/command/effect/capture.cpp +++ b/src/audio_core/renderer/command/effect/capture.cpp | |||
| @@ -1,12 +1,12 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/adsp/command_list_processor.h" | 4 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" |
| 5 | #include "audio_core/renderer/command/effect/capture.h" | 5 | #include "audio_core/renderer/command/effect/capture.h" |
| 6 | #include "audio_core/renderer/effect/aux_.h" | 6 | #include "audio_core/renderer/effect/aux_.h" |
| 7 | #include "core/memory.h" | 7 | #include "core/memory.h" |
| 8 | 8 | ||
| 9 | namespace AudioCore::AudioRenderer { | 9 | namespace AudioCore::Renderer { |
| 10 | /** | 10 | /** |
| 11 | * Reset an AuxBuffer. | 11 | * Reset an AuxBuffer. |
| 12 | * | 12 | * |
| @@ -118,13 +118,13 @@ static u32 WriteAuxBufferDsp(Core::Memory::Memory& memory, const CpuAddr send_in | |||
| 118 | return write_count_; | 118 | return write_count_; |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | void CaptureCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, | 121 | void CaptureCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, |
| 122 | std::string& string) { | 122 | std::string& string) { |
| 123 | string += fmt::format("CaptureCommand\n\tenabled {} input {:02X} output {:02X}", effect_enabled, | 123 | string += fmt::format("CaptureCommand\n\tenabled {} input {:02X} output {:02X}", effect_enabled, |
| 124 | input, output); | 124 | input, output); |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | void CaptureCommand::Process(const ADSP::CommandListProcessor& processor) { | 127 | void CaptureCommand::Process(const AudioRenderer::CommandListProcessor& processor) { |
| 128 | if (effect_enabled) { | 128 | if (effect_enabled) { |
| 129 | auto input_buffer{ | 129 | auto input_buffer{ |
| 130 | processor.mix_buffers.subspan(input * processor.sample_count, processor.sample_count)}; | 130 | processor.mix_buffers.subspan(input * processor.sample_count, processor.sample_count)}; |
| @@ -135,8 +135,8 @@ void CaptureCommand::Process(const ADSP::CommandListProcessor& processor) { | |||
| 135 | } | 135 | } |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | bool CaptureCommand::Verify(const ADSP::CommandListProcessor& processor) { | 138 | bool CaptureCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { |
| 139 | return true; | 139 | return true; |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | } // namespace AudioCore::AudioRenderer | 142 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/effect/capture.h b/src/audio_core/renderer/command/effect/capture.h index 8670acb24..a0016c6f6 100644 --- a/src/audio_core/renderer/command/effect/capture.h +++ b/src/audio_core/renderer/command/effect/capture.h | |||
| @@ -8,11 +8,12 @@ | |||
| 8 | #include "audio_core/renderer/command/icommand.h" | 8 | #include "audio_core/renderer/command/icommand.h" |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | 10 | ||
| 11 | namespace AudioCore::AudioRenderer { | 11 | namespace AudioCore::ADSP::AudioRenderer { |
| 12 | namespace ADSP { | ||
| 13 | class CommandListProcessor; | 12 | class CommandListProcessor; |
| 14 | } | 13 | } |
| 15 | 14 | ||
| 15 | namespace AudioCore::Renderer { | ||
| 16 | |||
| 16 | /** | 17 | /** |
| 17 | * AudioRenderer command for capturing a mix buffer. That is, writing it back to a given game memory | 18 | * AudioRenderer command for capturing a mix buffer. That is, writing it back to a given game memory |
| 18 | * address. | 19 | * address. |
| @@ -24,14 +25,14 @@ struct CaptureCommand : ICommand { | |||
| 24 | * @param processor - The CommandListProcessor processing this command. | 25 | * @param processor - The CommandListProcessor processing this command. |
| 25 | * @param string - The string to print into. | 26 | * @param string - The string to print into. |
| 26 | */ | 27 | */ |
| 27 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 28 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 28 | 29 | ||
| 29 | /** | 30 | /** |
| 30 | * Process this command. | 31 | * Process this command. |
| 31 | * | 32 | * |
| 32 | * @param processor - The CommandListProcessor processing this command. | 33 | * @param processor - The CommandListProcessor processing this command. |
| 33 | */ | 34 | */ |
| 34 | void Process(const ADSP::CommandListProcessor& processor) override; | 35 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 35 | 36 | ||
| 36 | /** | 37 | /** |
| 37 | * Verify this command's data is valid. | 38 | * Verify this command's data is valid. |
| @@ -39,7 +40,7 @@ struct CaptureCommand : ICommand { | |||
| 39 | * @param processor - The CommandListProcessor processing this command. | 40 | * @param processor - The CommandListProcessor processing this command. |
| 40 | * @return True if the command is valid, otherwise false. | 41 | * @return True if the command is valid, otherwise false. |
| 41 | */ | 42 | */ |
| 42 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 43 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 43 | 44 | ||
| 44 | /// Input mix buffer index | 45 | /// Input mix buffer index |
| 45 | s16 input; | 46 | s16 input; |
| @@ -59,4 +60,4 @@ struct CaptureCommand : ICommand { | |||
| 59 | bool effect_enabled; | 60 | bool effect_enabled; |
| 60 | }; | 61 | }; |
| 61 | 62 | ||
| 62 | } // namespace AudioCore::AudioRenderer | 63 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/effect/compressor.cpp b/src/audio_core/renderer/command/effect/compressor.cpp index ee9b68d5b..7ff707f4e 100644 --- a/src/audio_core/renderer/command/effect/compressor.cpp +++ b/src/audio_core/renderer/command/effect/compressor.cpp | |||
| @@ -5,11 +5,11 @@ | |||
| 5 | #include <span> | 5 | #include <span> |
| 6 | #include <vector> | 6 | #include <vector> |
| 7 | 7 | ||
| 8 | #include "audio_core/renderer/adsp/command_list_processor.h" | 8 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" |
| 9 | #include "audio_core/renderer/command/effect/compressor.h" | 9 | #include "audio_core/renderer/command/effect/compressor.h" |
| 10 | #include "audio_core/renderer/effect/compressor.h" | 10 | #include "audio_core/renderer/effect/compressor.h" |
| 11 | 11 | ||
| 12 | namespace AudioCore::AudioRenderer { | 12 | namespace AudioCore::Renderer { |
| 13 | 13 | ||
| 14 | static void SetCompressorEffectParameter(const CompressorInfo::ParameterVersion2& params, | 14 | static void SetCompressorEffectParameter(const CompressorInfo::ParameterVersion2& params, |
| 15 | CompressorInfo::State& state) { | 15 | CompressorInfo::State& state) { |
| @@ -110,7 +110,7 @@ static void ApplyCompressorEffect(const CompressorInfo::ParameterVersion2& param | |||
| 110 | } | 110 | } |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | void CompressorCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, | 113 | void CompressorCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, |
| 114 | std::string& string) { | 114 | std::string& string) { |
| 115 | string += fmt::format("CompressorCommand\n\tenabled {} \n\tinputs: ", effect_enabled); | 115 | string += fmt::format("CompressorCommand\n\tenabled {} \n\tinputs: ", effect_enabled); |
| 116 | for (s16 i = 0; i < parameter.channel_count; i++) { | 116 | for (s16 i = 0; i < parameter.channel_count; i++) { |
| @@ -123,7 +123,7 @@ void CompressorCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& | |||
| 123 | string += "\n"; | 123 | string += "\n"; |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | void CompressorCommand::Process(const ADSP::CommandListProcessor& processor) { | 126 | void CompressorCommand::Process(const AudioRenderer::CommandListProcessor& processor) { |
| 127 | std::array<std::span<const s32>, MaxChannels> input_buffers{}; | 127 | std::array<std::span<const s32>, MaxChannels> input_buffers{}; |
| 128 | std::array<std::span<s32>, MaxChannels> output_buffers{}; | 128 | std::array<std::span<s32>, MaxChannels> output_buffers{}; |
| 129 | 129 | ||
| @@ -148,8 +148,8 @@ void CompressorCommand::Process(const ADSP::CommandListProcessor& processor) { | |||
| 148 | processor.sample_count); | 148 | processor.sample_count); |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | bool CompressorCommand::Verify(const ADSP::CommandListProcessor& processor) { | 151 | bool CompressorCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { |
| 152 | return true; | 152 | return true; |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | } // namespace AudioCore::AudioRenderer | 155 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/effect/compressor.h b/src/audio_core/renderer/command/effect/compressor.h index f8e96cb43..c011aa927 100644 --- a/src/audio_core/renderer/command/effect/compressor.h +++ b/src/audio_core/renderer/command/effect/compressor.h | |||
| @@ -10,11 +10,12 @@ | |||
| 10 | #include "audio_core/renderer/effect/compressor.h" | 10 | #include "audio_core/renderer/effect/compressor.h" |
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | 12 | ||
| 13 | namespace AudioCore::AudioRenderer { | 13 | namespace AudioCore::ADSP::AudioRenderer { |
| 14 | namespace ADSP { | ||
| 15 | class CommandListProcessor; | 14 | class CommandListProcessor; |
| 16 | } | 15 | } |
| 17 | 16 | ||
| 17 | namespace AudioCore::Renderer { | ||
| 18 | |||
| 18 | /** | 19 | /** |
| 19 | * AudioRenderer command for limiting volume between a high and low threshold. | 20 | * AudioRenderer command for limiting volume between a high and low threshold. |
| 20 | * Version 1. | 21 | * Version 1. |
| @@ -26,14 +27,14 @@ struct CompressorCommand : ICommand { | |||
| 26 | * @param processor - The CommandListProcessor processing this command. | 27 | * @param processor - The CommandListProcessor processing this command. |
| 27 | * @param string - The string to print into. | 28 | * @param string - The string to print into. |
| 28 | */ | 29 | */ |
| 29 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 30 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 30 | 31 | ||
| 31 | /** | 32 | /** |
| 32 | * Process this command. | 33 | * Process this command. |
| 33 | * | 34 | * |
| 34 | * @param processor - The CommandListProcessor processing this command. | 35 | * @param processor - The CommandListProcessor processing this command. |
| 35 | */ | 36 | */ |
| 36 | void Process(const ADSP::CommandListProcessor& processor) override; | 37 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 37 | 38 | ||
| 38 | /** | 39 | /** |
| 39 | * Verify this command's data is valid. | 40 | * Verify this command's data is valid. |
| @@ -41,7 +42,7 @@ struct CompressorCommand : ICommand { | |||
| 41 | * @param processor - The CommandListProcessor processing this command. | 42 | * @param processor - The CommandListProcessor processing this command. |
| 42 | * @return True if the command is valid, otherwise false. | 43 | * @return True if the command is valid, otherwise false. |
| 43 | */ | 44 | */ |
| 44 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 45 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 45 | 46 | ||
| 46 | /// Input mix buffer offsets for each channel | 47 | /// Input mix buffer offsets for each channel |
| 47 | std::array<s16, MaxChannels> inputs; | 48 | std::array<s16, MaxChannels> inputs; |
| @@ -57,4 +58,4 @@ struct CompressorCommand : ICommand { | |||
| 57 | bool effect_enabled; | 58 | bool effect_enabled; |
| 58 | }; | 59 | }; |
| 59 | 60 | ||
| 60 | } // namespace AudioCore::AudioRenderer | 61 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/effect/delay.cpp b/src/audio_core/renderer/command/effect/delay.cpp index e536cbb1e..ffb298c07 100644 --- a/src/audio_core/renderer/command/effect/delay.cpp +++ b/src/audio_core/renderer/command/effect/delay.cpp | |||
| @@ -1,10 +1,10 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/adsp/command_list_processor.h" | 4 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" |
| 5 | #include "audio_core/renderer/command/effect/delay.h" | 5 | #include "audio_core/renderer/command/effect/delay.h" |
| 6 | 6 | ||
| 7 | namespace AudioCore::AudioRenderer { | 7 | namespace AudioCore::Renderer { |
| 8 | /** | 8 | /** |
| 9 | * Update the DelayInfo state according to the given parameters. | 9 | * Update the DelayInfo state according to the given parameters. |
| 10 | * | 10 | * |
| @@ -194,7 +194,7 @@ static void ApplyDelayEffect(const DelayInfo::ParameterVersion1& params, DelayIn | |||
| 194 | } | 194 | } |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | void DelayCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, | 197 | void DelayCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, |
| 198 | std::string& string) { | 198 | std::string& string) { |
| 199 | string += fmt::format("DelayCommand\n\tenabled {} \n\tinputs: ", effect_enabled); | 199 | string += fmt::format("DelayCommand\n\tenabled {} \n\tinputs: ", effect_enabled); |
| 200 | for (u32 i = 0; i < MaxChannels; i++) { | 200 | for (u32 i = 0; i < MaxChannels; i++) { |
| @@ -207,7 +207,7 @@ void DelayCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& proce | |||
| 207 | string += "\n"; | 207 | string += "\n"; |
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | void DelayCommand::Process(const ADSP::CommandListProcessor& processor) { | 210 | void DelayCommand::Process(const AudioRenderer::CommandListProcessor& processor) { |
| 211 | std::array<std::span<const s32>, MaxChannels> input_buffers{}; | 211 | std::array<std::span<const s32>, MaxChannels> input_buffers{}; |
| 212 | std::array<std::span<s32>, MaxChannels> output_buffers{}; | 212 | std::array<std::span<s32>, MaxChannels> output_buffers{}; |
| 213 | 213 | ||
| @@ -231,8 +231,8 @@ void DelayCommand::Process(const ADSP::CommandListProcessor& processor) { | |||
| 231 | processor.sample_count); | 231 | processor.sample_count); |
| 232 | } | 232 | } |
| 233 | 233 | ||
| 234 | bool DelayCommand::Verify(const ADSP::CommandListProcessor& processor) { | 234 | bool DelayCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { |
| 235 | return true; | 235 | return true; |
| 236 | } | 236 | } |
| 237 | 237 | ||
| 238 | } // namespace AudioCore::AudioRenderer | 238 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/effect/delay.h b/src/audio_core/renderer/command/effect/delay.h index b7a15ae6b..bfeac7af4 100644 --- a/src/audio_core/renderer/command/effect/delay.h +++ b/src/audio_core/renderer/command/effect/delay.h | |||
| @@ -10,11 +10,12 @@ | |||
| 10 | #include "audio_core/renderer/effect/delay.h" | 10 | #include "audio_core/renderer/effect/delay.h" |
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | 12 | ||
| 13 | namespace AudioCore::AudioRenderer { | 13 | namespace AudioCore::ADSP::AudioRenderer { |
| 14 | namespace ADSP { | ||
| 15 | class CommandListProcessor; | 14 | class CommandListProcessor; |
| 16 | } | 15 | } |
| 17 | 16 | ||
| 17 | namespace AudioCore::Renderer { | ||
| 18 | |||
| 18 | /** | 19 | /** |
| 19 | * AudioRenderer command for a delay effect. Delays inputs mix buffers according to the parameters | 20 | * AudioRenderer command for a delay effect. Delays inputs mix buffers according to the parameters |
| 20 | * and state, outputs receives the delayed samples. | 21 | * and state, outputs receives the delayed samples. |
| @@ -26,14 +27,14 @@ struct DelayCommand : ICommand { | |||
| 26 | * @param processor - The CommandListProcessor processing this command. | 27 | * @param processor - The CommandListProcessor processing this command. |
| 27 | * @param string - The string to print into. | 28 | * @param string - The string to print into. |
| 28 | */ | 29 | */ |
| 29 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 30 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 30 | 31 | ||
| 31 | /** | 32 | /** |
| 32 | * Process this command. | 33 | * Process this command. |
| 33 | * | 34 | * |
| 34 | * @param processor - The CommandListProcessor processing this command. | 35 | * @param processor - The CommandListProcessor processing this command. |
| 35 | */ | 36 | */ |
| 36 | void Process(const ADSP::CommandListProcessor& processor) override; | 37 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 37 | 38 | ||
| 38 | /** | 39 | /** |
| 39 | * Verify this command's data is valid. | 40 | * Verify this command's data is valid. |
| @@ -41,7 +42,7 @@ struct DelayCommand : ICommand { | |||
| 41 | * @param processor - The CommandListProcessor processing this command. | 42 | * @param processor - The CommandListProcessor processing this command. |
| 42 | * @return True if the command is valid, otherwise false. | 43 | * @return True if the command is valid, otherwise false. |
| 43 | */ | 44 | */ |
| 44 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 45 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 45 | 46 | ||
| 46 | /// Input mix buffer offsets for each channel | 47 | /// Input mix buffer offsets for each channel |
| 47 | std::array<s16, MaxChannels> inputs; | 48 | std::array<s16, MaxChannels> inputs; |
| @@ -57,4 +58,4 @@ struct DelayCommand : ICommand { | |||
| 57 | bool effect_enabled; | 58 | bool effect_enabled; |
| 58 | }; | 59 | }; |
| 59 | 60 | ||
| 60 | } // namespace AudioCore::AudioRenderer | 61 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/effect/i3dl2_reverb.cpp b/src/audio_core/renderer/command/effect/i3dl2_reverb.cpp index d2bfb67cc..ecfdfabc6 100644 --- a/src/audio_core/renderer/command/effect/i3dl2_reverb.cpp +++ b/src/audio_core/renderer/command/effect/i3dl2_reverb.cpp | |||
| @@ -3,11 +3,11 @@ | |||
| 3 | 3 | ||
| 4 | #include <numbers> | 4 | #include <numbers> |
| 5 | 5 | ||
| 6 | #include "audio_core/renderer/adsp/command_list_processor.h" | 6 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" |
| 7 | #include "audio_core/renderer/command/effect/i3dl2_reverb.h" | 7 | #include "audio_core/renderer/command/effect/i3dl2_reverb.h" |
| 8 | #include "common/polyfill_ranges.h" | 8 | #include "common/polyfill_ranges.h" |
| 9 | 9 | ||
| 10 | namespace AudioCore::AudioRenderer { | 10 | namespace AudioCore::Renderer { |
| 11 | 11 | ||
| 12 | constexpr std::array<f32, I3dl2ReverbInfo::MaxDelayLines> MinDelayLineTimes{ | 12 | constexpr std::array<f32, I3dl2ReverbInfo::MaxDelayLines> MinDelayLineTimes{ |
| 13 | 5.0f, | 13 | 5.0f, |
| @@ -394,7 +394,7 @@ static void ApplyI3dl2ReverbEffect(const I3dl2ReverbInfo::ParameterVersion1& par | |||
| 394 | } | 394 | } |
| 395 | } | 395 | } |
| 396 | 396 | ||
| 397 | void I3dl2ReverbCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, | 397 | void I3dl2ReverbCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, |
| 398 | std::string& string) { | 398 | std::string& string) { |
| 399 | string += fmt::format("I3dl2ReverbCommand\n\tenabled {} \n\tinputs: ", effect_enabled); | 399 | string += fmt::format("I3dl2ReverbCommand\n\tenabled {} \n\tinputs: ", effect_enabled); |
| 400 | for (u32 i = 0; i < parameter.channel_count; i++) { | 400 | for (u32 i = 0; i < parameter.channel_count; i++) { |
| @@ -407,7 +407,7 @@ void I3dl2ReverbCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& | |||
| 407 | string += "\n"; | 407 | string += "\n"; |
| 408 | } | 408 | } |
| 409 | 409 | ||
| 410 | void I3dl2ReverbCommand::Process(const ADSP::CommandListProcessor& processor) { | 410 | void I3dl2ReverbCommand::Process(const AudioRenderer::CommandListProcessor& processor) { |
| 411 | std::array<std::span<const s32>, MaxChannels> input_buffers{}; | 411 | std::array<std::span<const s32>, MaxChannels> input_buffers{}; |
| 412 | std::array<std::span<s32>, MaxChannels> output_buffers{}; | 412 | std::array<std::span<s32>, MaxChannels> output_buffers{}; |
| 413 | 413 | ||
| @@ -431,8 +431,8 @@ void I3dl2ReverbCommand::Process(const ADSP::CommandListProcessor& processor) { | |||
| 431 | processor.sample_count); | 431 | processor.sample_count); |
| 432 | } | 432 | } |
| 433 | 433 | ||
| 434 | bool I3dl2ReverbCommand::Verify(const ADSP::CommandListProcessor& processor) { | 434 | bool I3dl2ReverbCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { |
| 435 | return true; | 435 | return true; |
| 436 | } | 436 | } |
| 437 | 437 | ||
| 438 | } // namespace AudioCore::AudioRenderer | 438 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/effect/i3dl2_reverb.h b/src/audio_core/renderer/command/effect/i3dl2_reverb.h index 243877056..e4c538ae8 100644 --- a/src/audio_core/renderer/command/effect/i3dl2_reverb.h +++ b/src/audio_core/renderer/command/effect/i3dl2_reverb.h | |||
| @@ -10,11 +10,12 @@ | |||
| 10 | #include "audio_core/renderer/effect/i3dl2.h" | 10 | #include "audio_core/renderer/effect/i3dl2.h" |
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | 12 | ||
| 13 | namespace AudioCore::AudioRenderer { | 13 | namespace AudioCore::ADSP::AudioRenderer { |
| 14 | namespace ADSP { | ||
| 15 | class CommandListProcessor; | 14 | class CommandListProcessor; |
| 16 | } | 15 | } |
| 17 | 16 | ||
| 17 | namespace AudioCore::Renderer { | ||
| 18 | |||
| 18 | /** | 19 | /** |
| 19 | * AudioRenderer command for a I3DL2Reverb effect. Apply a reverb to inputs mix buffer according to | 20 | * AudioRenderer command for a I3DL2Reverb effect. Apply a reverb to inputs mix buffer according to |
| 20 | * the I3DL2 spec, outputs receives the results. | 21 | * the I3DL2 spec, outputs receives the results. |
| @@ -26,14 +27,14 @@ struct I3dl2ReverbCommand : ICommand { | |||
| 26 | * @param processor - The CommandListProcessor processing this command. | 27 | * @param processor - The CommandListProcessor processing this command. |
| 27 | * @param string - The string to print into. | 28 | * @param string - The string to print into. |
| 28 | */ | 29 | */ |
| 29 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 30 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 30 | 31 | ||
| 31 | /** | 32 | /** |
| 32 | * Process this command. | 33 | * Process this command. |
| 33 | * | 34 | * |
| 34 | * @param processor - The CommandListProcessor processing this command. | 35 | * @param processor - The CommandListProcessor processing this command. |
| 35 | */ | 36 | */ |
| 36 | void Process(const ADSP::CommandListProcessor& processor) override; | 37 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 37 | 38 | ||
| 38 | /** | 39 | /** |
| 39 | * Verify this command's data is valid. | 40 | * Verify this command's data is valid. |
| @@ -41,7 +42,7 @@ struct I3dl2ReverbCommand : ICommand { | |||
| 41 | * @param processor - The CommandListProcessor processing this command. | 42 | * @param processor - The CommandListProcessor processing this command. |
| 42 | * @return True if the command is valid, otherwise false. | 43 | * @return True if the command is valid, otherwise false. |
| 43 | */ | 44 | */ |
| 44 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 45 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 45 | 46 | ||
| 46 | /// Input mix buffer offsets for each channel | 47 | /// Input mix buffer offsets for each channel |
| 47 | std::array<s16, MaxChannels> inputs; | 48 | std::array<s16, MaxChannels> inputs; |
| @@ -57,4 +58,4 @@ struct I3dl2ReverbCommand : ICommand { | |||
| 57 | bool effect_enabled; | 58 | bool effect_enabled; |
| 58 | }; | 59 | }; |
| 59 | 60 | ||
| 60 | } // namespace AudioCore::AudioRenderer | 61 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/effect/light_limiter.cpp b/src/audio_core/renderer/command/effect/light_limiter.cpp index 4161a9821..63aa06f5c 100644 --- a/src/audio_core/renderer/command/effect/light_limiter.cpp +++ b/src/audio_core/renderer/command/effect/light_limiter.cpp | |||
| @@ -1,10 +1,10 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/adsp/command_list_processor.h" | 4 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" |
| 5 | #include "audio_core/renderer/command/effect/light_limiter.h" | 5 | #include "audio_core/renderer/command/effect/light_limiter.h" |
| 6 | 6 | ||
| 7 | namespace AudioCore::AudioRenderer { | 7 | namespace AudioCore::Renderer { |
| 8 | /** | 8 | /** |
| 9 | * Update the LightLimiterInfo state according to the given parameters. | 9 | * Update the LightLimiterInfo state according to the given parameters. |
| 10 | * A no-op. | 10 | * A no-op. |
| @@ -133,8 +133,8 @@ static void ApplyLightLimiterEffect(const LightLimiterInfo::ParameterVersion2& p | |||
| 133 | } | 133 | } |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | void LightLimiterVersion1Command::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, | 136 | void LightLimiterVersion1Command::Dump( |
| 137 | std::string& string) { | 137 | [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { |
| 138 | string += fmt::format("LightLimiterVersion1Command\n\tinputs: "); | 138 | string += fmt::format("LightLimiterVersion1Command\n\tinputs: "); |
| 139 | for (u32 i = 0; i < MaxChannels; i++) { | 139 | for (u32 i = 0; i < MaxChannels; i++) { |
| 140 | string += fmt::format("{:02X}, ", inputs[i]); | 140 | string += fmt::format("{:02X}, ", inputs[i]); |
| @@ -146,7 +146,7 @@ void LightLimiterVersion1Command::Dump([[maybe_unused]] const ADSP::CommandListP | |||
| 146 | string += "\n"; | 146 | string += "\n"; |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | void LightLimiterVersion1Command::Process(const ADSP::CommandListProcessor& processor) { | 149 | void LightLimiterVersion1Command::Process(const AudioRenderer::CommandListProcessor& processor) { |
| 150 | std::array<std::span<const s32>, MaxChannels> input_buffers{}; | 150 | std::array<std::span<const s32>, MaxChannels> input_buffers{}; |
| 151 | std::array<std::span<s32>, MaxChannels> output_buffers{}; | 151 | std::array<std::span<s32>, MaxChannels> output_buffers{}; |
| 152 | 152 | ||
| @@ -172,12 +172,12 @@ void LightLimiterVersion1Command::Process(const ADSP::CommandListProcessor& proc | |||
| 172 | processor.sample_count, statistics); | 172 | processor.sample_count, statistics); |
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | bool LightLimiterVersion1Command::Verify(const ADSP::CommandListProcessor& processor) { | 175 | bool LightLimiterVersion1Command::Verify(const AudioRenderer::CommandListProcessor& processor) { |
| 176 | return true; | 176 | return true; |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | void LightLimiterVersion2Command::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, | 179 | void LightLimiterVersion2Command::Dump( |
| 180 | std::string& string) { | 180 | [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { |
| 181 | string += fmt::format("LightLimiterVersion2Command\n\tinputs: \n"); | 181 | string += fmt::format("LightLimiterVersion2Command\n\tinputs: \n"); |
| 182 | for (u32 i = 0; i < MaxChannels; i++) { | 182 | for (u32 i = 0; i < MaxChannels; i++) { |
| 183 | string += fmt::format("{:02X}, ", inputs[i]); | 183 | string += fmt::format("{:02X}, ", inputs[i]); |
| @@ -189,7 +189,7 @@ void LightLimiterVersion2Command::Dump([[maybe_unused]] const ADSP::CommandListP | |||
| 189 | string += "\n"; | 189 | string += "\n"; |
| 190 | } | 190 | } |
| 191 | 191 | ||
| 192 | void LightLimiterVersion2Command::Process(const ADSP::CommandListProcessor& processor) { | 192 | void LightLimiterVersion2Command::Process(const AudioRenderer::CommandListProcessor& processor) { |
| 193 | std::array<std::span<const s32>, MaxChannels> input_buffers{}; | 193 | std::array<std::span<const s32>, MaxChannels> input_buffers{}; |
| 194 | std::array<std::span<s32>, MaxChannels> output_buffers{}; | 194 | std::array<std::span<s32>, MaxChannels> output_buffers{}; |
| 195 | 195 | ||
| @@ -215,8 +215,8 @@ void LightLimiterVersion2Command::Process(const ADSP::CommandListProcessor& proc | |||
| 215 | processor.sample_count, statistics); | 215 | processor.sample_count, statistics); |
| 216 | } | 216 | } |
| 217 | 217 | ||
| 218 | bool LightLimiterVersion2Command::Verify(const ADSP::CommandListProcessor& processor) { | 218 | bool LightLimiterVersion2Command::Verify(const AudioRenderer::CommandListProcessor& processor) { |
| 219 | return true; | 219 | return true; |
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | } // namespace AudioCore::AudioRenderer | 222 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/effect/light_limiter.h b/src/audio_core/renderer/command/effect/light_limiter.h index 5d98272c7..6e3ee1b53 100644 --- a/src/audio_core/renderer/command/effect/light_limiter.h +++ b/src/audio_core/renderer/command/effect/light_limiter.h | |||
| @@ -10,11 +10,12 @@ | |||
| 10 | #include "audio_core/renderer/effect/light_limiter.h" | 10 | #include "audio_core/renderer/effect/light_limiter.h" |
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | 12 | ||
| 13 | namespace AudioCore::AudioRenderer { | 13 | namespace AudioCore::ADSP::AudioRenderer { |
| 14 | namespace ADSP { | ||
| 15 | class CommandListProcessor; | 14 | class CommandListProcessor; |
| 16 | } | 15 | } |
| 17 | 16 | ||
| 17 | namespace AudioCore::Renderer { | ||
| 18 | |||
| 18 | /** | 19 | /** |
| 19 | * AudioRenderer command for limiting volume between a high and low threshold. | 20 | * AudioRenderer command for limiting volume between a high and low threshold. |
| 20 | * Version 1. | 21 | * Version 1. |
| @@ -26,14 +27,14 @@ struct LightLimiterVersion1Command : ICommand { | |||
| 26 | * @param processor - The CommandListProcessor processing this command. | 27 | * @param processor - The CommandListProcessor processing this command. |
| 27 | * @param string - The string to print into. | 28 | * @param string - The string to print into. |
| 28 | */ | 29 | */ |
| 29 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 30 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 30 | 31 | ||
| 31 | /** | 32 | /** |
| 32 | * Process this command. | 33 | * Process this command. |
| 33 | * | 34 | * |
| 34 | * @param processor - The CommandListProcessor processing this command. | 35 | * @param processor - The CommandListProcessor processing this command. |
| 35 | */ | 36 | */ |
| 36 | void Process(const ADSP::CommandListProcessor& processor) override; | 37 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 37 | 38 | ||
| 38 | /** | 39 | /** |
| 39 | * Verify this command's data is valid. | 40 | * Verify this command's data is valid. |
| @@ -41,7 +42,7 @@ struct LightLimiterVersion1Command : ICommand { | |||
| 41 | * @param processor - The CommandListProcessor processing this command. | 42 | * @param processor - The CommandListProcessor processing this command. |
| 42 | * @return True if the command is valid, otherwise false. | 43 | * @return True if the command is valid, otherwise false. |
| 43 | */ | 44 | */ |
| 44 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 45 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 45 | 46 | ||
| 46 | /// Input mix buffer offsets for each channel | 47 | /// Input mix buffer offsets for each channel |
| 47 | std::array<s16, MaxChannels> inputs; | 48 | std::array<s16, MaxChannels> inputs; |
| @@ -68,21 +69,21 @@ struct LightLimiterVersion2Command : ICommand { | |||
| 68 | * @param processor - The CommandListProcessor processing this command. | 69 | * @param processor - The CommandListProcessor processing this command. |
| 69 | * @param string - The string to print into. | 70 | * @param string - The string to print into. |
| 70 | */ | 71 | */ |
| 71 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 72 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 72 | 73 | ||
| 73 | /** | 74 | /** |
| 74 | * Process this command. | 75 | * Process this command. |
| 75 | * | 76 | * |
| 76 | * @param processor - The CommandListProcessor processing this command. | 77 | * @param processor - The CommandListProcessor processing this command. |
| 77 | */ | 78 | */ |
| 78 | void Process(const ADSP::CommandListProcessor& processor) override; | 79 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 79 | 80 | ||
| 80 | /** | 81 | /** |
| 81 | * Verify this command's data is valid. | 82 | * Verify this command's data is valid. |
| 82 | * | 83 | * |
| 83 | * @param processor - The CommandListProcessor processing this command. | 84 | * @param processor - The CommandListProcessor processing this command. |
| 84 | */ | 85 | */ |
| 85 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 86 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 86 | 87 | ||
| 87 | /// Input mix buffer offsets for each channel | 88 | /// Input mix buffer offsets for each channel |
| 88 | std::array<s16, MaxChannels> inputs; | 89 | std::array<s16, MaxChannels> inputs; |
| @@ -100,4 +101,4 @@ struct LightLimiterVersion2Command : ICommand { | |||
| 100 | bool effect_enabled; | 101 | bool effect_enabled; |
| 101 | }; | 102 | }; |
| 102 | 103 | ||
| 103 | } // namespace AudioCore::AudioRenderer | 104 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/effect/multi_tap_biquad_filter.cpp b/src/audio_core/renderer/command/effect/multi_tap_biquad_filter.cpp index 48a7cba8a..208bbeaf2 100644 --- a/src/audio_core/renderer/command/effect/multi_tap_biquad_filter.cpp +++ b/src/audio_core/renderer/command/effect/multi_tap_biquad_filter.cpp | |||
| @@ -1,20 +1,20 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/adsp/command_list_processor.h" | 4 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" |
| 5 | #include "audio_core/renderer/command/effect/biquad_filter.h" | 5 | #include "audio_core/renderer/command/effect/biquad_filter.h" |
| 6 | #include "audio_core/renderer/command/effect/multi_tap_biquad_filter.h" | 6 | #include "audio_core/renderer/command/effect/multi_tap_biquad_filter.h" |
| 7 | 7 | ||
| 8 | namespace AudioCore::AudioRenderer { | 8 | namespace AudioCore::Renderer { |
| 9 | 9 | ||
| 10 | void MultiTapBiquadFilterCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, | 10 | void MultiTapBiquadFilterCommand::Dump( |
| 11 | std::string& string) { | 11 | [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { |
| 12 | string += fmt::format( | 12 | string += fmt::format( |
| 13 | "MultiTapBiquadFilterCommand\n\tinput {:02X}\n\toutput {:02X}\n\tneeds_init ({}, {})\n", | 13 | "MultiTapBiquadFilterCommand\n\tinput {:02X}\n\toutput {:02X}\n\tneeds_init ({}, {})\n", |
| 14 | input, output, needs_init[0], needs_init[1]); | 14 | input, output, needs_init[0], needs_init[1]); |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | void MultiTapBiquadFilterCommand::Process(const ADSP::CommandListProcessor& processor) { | 17 | void MultiTapBiquadFilterCommand::Process(const AudioRenderer::CommandListProcessor& processor) { |
| 18 | if (filter_tap_count > MaxBiquadFilters) { | 18 | if (filter_tap_count > MaxBiquadFilters) { |
| 19 | LOG_ERROR(Service_Audio, "Too many filter taps! {}", filter_tap_count); | 19 | LOG_ERROR(Service_Audio, "Too many filter taps! {}", filter_tap_count); |
| 20 | filter_tap_count = MaxBiquadFilters; | 20 | filter_tap_count = MaxBiquadFilters; |
| @@ -38,8 +38,8 @@ void MultiTapBiquadFilterCommand::Process(const ADSP::CommandListProcessor& proc | |||
| 38 | } | 38 | } |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | bool MultiTapBiquadFilterCommand::Verify(const ADSP::CommandListProcessor& processor) { | 41 | bool MultiTapBiquadFilterCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { |
| 42 | return true; | 42 | return true; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | } // namespace AudioCore::AudioRenderer | 45 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/effect/multi_tap_biquad_filter.h b/src/audio_core/renderer/command/effect/multi_tap_biquad_filter.h index 99c2c0830..50fce80b0 100644 --- a/src/audio_core/renderer/command/effect/multi_tap_biquad_filter.h +++ b/src/audio_core/renderer/command/effect/multi_tap_biquad_filter.h | |||
| @@ -10,11 +10,12 @@ | |||
| 10 | #include "audio_core/renderer/voice/voice_info.h" | 10 | #include "audio_core/renderer/voice/voice_info.h" |
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | 12 | ||
| 13 | namespace AudioCore::AudioRenderer { | 13 | namespace AudioCore::ADSP::AudioRenderer { |
| 14 | namespace ADSP { | ||
| 15 | class CommandListProcessor; | 14 | class CommandListProcessor; |
| 16 | } | 15 | } |
| 17 | 16 | ||
| 17 | namespace AudioCore::Renderer { | ||
| 18 | |||
| 18 | /** | 19 | /** |
| 19 | * AudioRenderer command for applying multiple biquads at once. | 20 | * AudioRenderer command for applying multiple biquads at once. |
| 20 | */ | 21 | */ |
| @@ -25,14 +26,14 @@ struct MultiTapBiquadFilterCommand : ICommand { | |||
| 25 | * @param processor - The CommandListProcessor processing this command. | 26 | * @param processor - The CommandListProcessor processing this command. |
| 26 | * @param string - The string to print into. | 27 | * @param string - The string to print into. |
| 27 | */ | 28 | */ |
| 28 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 29 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 29 | 30 | ||
| 30 | /** | 31 | /** |
| 31 | * Process this command. | 32 | * Process this command. |
| 32 | * | 33 | * |
| 33 | * @param processor - The CommandListProcessor processing this command. | 34 | * @param processor - The CommandListProcessor processing this command. |
| 34 | */ | 35 | */ |
| 35 | void Process(const ADSP::CommandListProcessor& processor) override; | 36 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 36 | 37 | ||
| 37 | /** | 38 | /** |
| 38 | * Verify this command's data is valid. | 39 | * Verify this command's data is valid. |
| @@ -40,7 +41,7 @@ struct MultiTapBiquadFilterCommand : ICommand { | |||
| 40 | * @param processor - The CommandListProcessor processing this command. | 41 | * @param processor - The CommandListProcessor processing this command. |
| 41 | * @return True if the command is valid, otherwise false. | 42 | * @return True if the command is valid, otherwise false. |
| 42 | */ | 43 | */ |
| 43 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 44 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 44 | 45 | ||
| 45 | /// Input mix buffer index | 46 | /// Input mix buffer index |
| 46 | s16 input; | 47 | s16 input; |
| @@ -56,4 +57,4 @@ struct MultiTapBiquadFilterCommand : ICommand { | |||
| 56 | u8 filter_tap_count; | 57 | u8 filter_tap_count; |
| 57 | }; | 58 | }; |
| 58 | 59 | ||
| 59 | } // namespace AudioCore::AudioRenderer | 60 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/effect/reverb.cpp b/src/audio_core/renderer/command/effect/reverb.cpp index fc2f15a5e..7f152a962 100644 --- a/src/audio_core/renderer/command/effect/reverb.cpp +++ b/src/audio_core/renderer/command/effect/reverb.cpp | |||
| @@ -4,11 +4,11 @@ | |||
| 4 | #include <numbers> | 4 | #include <numbers> |
| 5 | #include <ranges> | 5 | #include <ranges> |
| 6 | 6 | ||
| 7 | #include "audio_core/renderer/adsp/command_list_processor.h" | 7 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" |
| 8 | #include "audio_core/renderer/command/effect/reverb.h" | 8 | #include "audio_core/renderer/command/effect/reverb.h" |
| 9 | #include "common/polyfill_ranges.h" | 9 | #include "common/polyfill_ranges.h" |
| 10 | 10 | ||
| 11 | namespace AudioCore::AudioRenderer { | 11 | namespace AudioCore::Renderer { |
| 12 | 12 | ||
| 13 | constexpr std::array<f32, ReverbInfo::MaxDelayLines> FdnMaxDelayLineTimes = { | 13 | constexpr std::array<f32, ReverbInfo::MaxDelayLines> FdnMaxDelayLineTimes = { |
| 14 | 53.9532470703125f, | 14 | 53.9532470703125f, |
| @@ -396,7 +396,7 @@ static void ApplyReverbEffect(const ReverbInfo::ParameterVersion2& params, Rever | |||
| 396 | } | 396 | } |
| 397 | } | 397 | } |
| 398 | 398 | ||
| 399 | void ReverbCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, | 399 | void ReverbCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, |
| 400 | std::string& string) { | 400 | std::string& string) { |
| 401 | string += fmt::format( | 401 | string += fmt::format( |
| 402 | "ReverbCommand\n\tenabled {} long_size_pre_delay_supported {}\n\tinputs: ", effect_enabled, | 402 | "ReverbCommand\n\tenabled {} long_size_pre_delay_supported {}\n\tinputs: ", effect_enabled, |
| @@ -411,7 +411,7 @@ void ReverbCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& proc | |||
| 411 | string += "\n"; | 411 | string += "\n"; |
| 412 | } | 412 | } |
| 413 | 413 | ||
| 414 | void ReverbCommand::Process(const ADSP::CommandListProcessor& processor) { | 414 | void ReverbCommand::Process(const AudioRenderer::CommandListProcessor& processor) { |
| 415 | std::array<std::span<const s32>, MaxChannels> input_buffers{}; | 415 | std::array<std::span<const s32>, MaxChannels> input_buffers{}; |
| 416 | std::array<std::span<s32>, MaxChannels> output_buffers{}; | 416 | std::array<std::span<s32>, MaxChannels> output_buffers{}; |
| 417 | 417 | ||
| @@ -435,8 +435,8 @@ void ReverbCommand::Process(const ADSP::CommandListProcessor& processor) { | |||
| 435 | processor.sample_count); | 435 | processor.sample_count); |
| 436 | } | 436 | } |
| 437 | 437 | ||
| 438 | bool ReverbCommand::Verify(const ADSP::CommandListProcessor& processor) { | 438 | bool ReverbCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { |
| 439 | return true; | 439 | return true; |
| 440 | } | 440 | } |
| 441 | 441 | ||
| 442 | } // namespace AudioCore::AudioRenderer | 442 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/effect/reverb.h b/src/audio_core/renderer/command/effect/reverb.h index 328756150..2056c73f2 100644 --- a/src/audio_core/renderer/command/effect/reverb.h +++ b/src/audio_core/renderer/command/effect/reverb.h | |||
| @@ -10,11 +10,12 @@ | |||
| 10 | #include "audio_core/renderer/effect/reverb.h" | 10 | #include "audio_core/renderer/effect/reverb.h" |
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | 12 | ||
| 13 | namespace AudioCore::AudioRenderer { | 13 | namespace AudioCore::ADSP::AudioRenderer { |
| 14 | namespace ADSP { | ||
| 15 | class CommandListProcessor; | 14 | class CommandListProcessor; |
| 16 | } | 15 | } |
| 17 | 16 | ||
| 17 | namespace AudioCore::Renderer { | ||
| 18 | |||
| 18 | /** | 19 | /** |
| 19 | * AudioRenderer command for a Reverb effect. Apply a reverb to inputs mix buffer, outputs receives | 20 | * AudioRenderer command for a Reverb effect. Apply a reverb to inputs mix buffer, outputs receives |
| 20 | * the results. | 21 | * the results. |
| @@ -26,14 +27,14 @@ struct ReverbCommand : ICommand { | |||
| 26 | * @param processor - The CommandListProcessor processing this command. | 27 | * @param processor - The CommandListProcessor processing this command. |
| 27 | * @param string - The string to print into. | 28 | * @param string - The string to print into. |
| 28 | */ | 29 | */ |
| 29 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 30 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 30 | 31 | ||
| 31 | /** | 32 | /** |
| 32 | * Process this command. | 33 | * Process this command. |
| 33 | * | 34 | * |
| 34 | * @param processor - The CommandListProcessor processing this command. | 35 | * @param processor - The CommandListProcessor processing this command. |
| 35 | */ | 36 | */ |
| 36 | void Process(const ADSP::CommandListProcessor& processor) override; | 37 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 37 | 38 | ||
| 38 | /** | 39 | /** |
| 39 | * Verify this command's data is valid. | 40 | * Verify this command's data is valid. |
| @@ -41,7 +42,7 @@ struct ReverbCommand : ICommand { | |||
| 41 | * @param processor - The CommandListProcessor processing this command. | 42 | * @param processor - The CommandListProcessor processing this command. |
| 42 | * @return True if the command is valid, otherwise false. | 43 | * @return True if the command is valid, otherwise false. |
| 43 | */ | 44 | */ |
| 44 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 45 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 45 | 46 | ||
| 46 | /// Input mix buffer offsets for each channel | 47 | /// Input mix buffer offsets for each channel |
| 47 | std::array<s16, MaxChannels> inputs; | 48 | std::array<s16, MaxChannels> inputs; |
| @@ -59,4 +60,4 @@ struct ReverbCommand : ICommand { | |||
| 59 | bool long_size_pre_delay_supported; | 60 | bool long_size_pre_delay_supported; |
| 60 | }; | 61 | }; |
| 61 | 62 | ||
| 62 | } // namespace AudioCore::AudioRenderer | 63 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/icommand.h b/src/audio_core/renderer/command/icommand.h index f2dd41254..10a78ddf2 100644 --- a/src/audio_core/renderer/command/icommand.h +++ b/src/audio_core/renderer/command/icommand.h | |||
| @@ -3,14 +3,18 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include <string> | ||
| 7 | |||
| 6 | #include "audio_core/common/common.h" | 8 | #include "audio_core/common/common.h" |
| 7 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 8 | 10 | ||
| 9 | namespace AudioCore::AudioRenderer { | 11 | namespace AudioCore::ADSP::AudioRenderer { |
| 10 | namespace ADSP { | ||
| 11 | class CommandListProcessor; | 12 | class CommandListProcessor; |
| 12 | } | 13 | } |
| 13 | 14 | ||
| 15 | namespace AudioCore::Renderer { | ||
| 16 | using namespace ::AudioCore::ADSP; | ||
| 17 | |||
| 14 | enum class CommandId : u8 { | 18 | enum class CommandId : u8 { |
| 15 | /* 0x00 */ Invalid, | 19 | /* 0x00 */ Invalid, |
| 16 | /* 0x01 */ DataSourcePcmInt16Version1, | 20 | /* 0x01 */ DataSourcePcmInt16Version1, |
| @@ -59,14 +63,15 @@ struct ICommand { | |||
| 59 | * @param processor - The CommandListProcessor processing this command. | 63 | * @param processor - The CommandListProcessor processing this command. |
| 60 | * @param string - The string to print into. | 64 | * @param string - The string to print into. |
| 61 | */ | 65 | */ |
| 62 | virtual void Dump(const ADSP::CommandListProcessor& processor, std::string& string) = 0; | 66 | virtual void Dump(const AudioRenderer::CommandListProcessor& processor, |
| 67 | std::string& string) = 0; | ||
| 63 | 68 | ||
| 64 | /** | 69 | /** |
| 65 | * Process this command. | 70 | * Process this command. |
| 66 | * | 71 | * |
| 67 | * @param processor - The CommandListProcessor processing this command. | 72 | * @param processor - The CommandListProcessor processing this command. |
| 68 | */ | 73 | */ |
| 69 | virtual void Process(const ADSP::CommandListProcessor& processor) = 0; | 74 | virtual void Process(const AudioRenderer::CommandListProcessor& processor) = 0; |
| 70 | 75 | ||
| 71 | /** | 76 | /** |
| 72 | * Verify this command's data is valid. | 77 | * Verify this command's data is valid. |
| @@ -74,7 +79,7 @@ struct ICommand { | |||
| 74 | * @param processor - The CommandListProcessor processing this command. | 79 | * @param processor - The CommandListProcessor processing this command. |
| 75 | * @return True if the command is valid, otherwise false. | 80 | * @return True if the command is valid, otherwise false. |
| 76 | */ | 81 | */ |
| 77 | virtual bool Verify(const ADSP::CommandListProcessor& processor) = 0; | 82 | virtual bool Verify(const AudioRenderer::CommandListProcessor& processor) = 0; |
| 78 | 83 | ||
| 79 | /// Command magic 0xCAFEBABE | 84 | /// Command magic 0xCAFEBABE |
| 80 | u32 magic{}; | 85 | u32 magic{}; |
| @@ -90,4 +95,4 @@ struct ICommand { | |||
| 90 | u32 node_id{}; | 95 | u32 node_id{}; |
| 91 | }; | 96 | }; |
| 92 | 97 | ||
| 93 | } // namespace AudioCore::AudioRenderer | 98 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/mix/clear_mix.cpp b/src/audio_core/renderer/command/mix/clear_mix.cpp index 4f649d6a8..060d7cb28 100644 --- a/src/audio_core/renderer/command/mix/clear_mix.cpp +++ b/src/audio_core/renderer/command/mix/clear_mix.cpp | |||
| @@ -3,22 +3,22 @@ | |||
| 3 | 3 | ||
| 4 | #include <string> | 4 | #include <string> |
| 5 | 5 | ||
| 6 | #include "audio_core/renderer/adsp/command_list_processor.h" | 6 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" |
| 7 | #include "audio_core/renderer/command/mix/clear_mix.h" | 7 | #include "audio_core/renderer/command/mix/clear_mix.h" |
| 8 | 8 | ||
| 9 | namespace AudioCore::AudioRenderer { | 9 | namespace AudioCore::Renderer { |
| 10 | 10 | ||
| 11 | void ClearMixBufferCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, | 11 | void ClearMixBufferCommand::Dump( |
| 12 | std::string& string) { | 12 | [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { |
| 13 | string += fmt::format("ClearMixBufferCommand\n"); | 13 | string += fmt::format("ClearMixBufferCommand\n"); |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | void ClearMixBufferCommand::Process(const ADSP::CommandListProcessor& processor) { | 16 | void ClearMixBufferCommand::Process(const AudioRenderer::CommandListProcessor& processor) { |
| 17 | memset(processor.mix_buffers.data(), 0, processor.mix_buffers.size_bytes()); | 17 | memset(processor.mix_buffers.data(), 0, processor.mix_buffers.size_bytes()); |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | bool ClearMixBufferCommand::Verify(const ADSP::CommandListProcessor& processor) { | 20 | bool ClearMixBufferCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { |
| 21 | return true; | 21 | return true; |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | } // namespace AudioCore::AudioRenderer | 24 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/mix/clear_mix.h b/src/audio_core/renderer/command/mix/clear_mix.h index 956ec0b65..650fa1a8a 100644 --- a/src/audio_core/renderer/command/mix/clear_mix.h +++ b/src/audio_core/renderer/command/mix/clear_mix.h | |||
| @@ -8,11 +8,12 @@ | |||
| 8 | #include "audio_core/renderer/command/icommand.h" | 8 | #include "audio_core/renderer/command/icommand.h" |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | 10 | ||
| 11 | namespace AudioCore::AudioRenderer { | 11 | namespace AudioCore::ADSP::AudioRenderer { |
| 12 | namespace ADSP { | ||
| 13 | class CommandListProcessor; | 12 | class CommandListProcessor; |
| 14 | } | 13 | } |
| 15 | 14 | ||
| 15 | namespace AudioCore::Renderer { | ||
| 16 | |||
| 16 | /** | 17 | /** |
| 17 | * AudioRenderer command for a clearing the mix buffers. | 18 | * AudioRenderer command for a clearing the mix buffers. |
| 18 | * Used at the start of each command list. | 19 | * Used at the start of each command list. |
| @@ -24,14 +25,14 @@ struct ClearMixBufferCommand : ICommand { | |||
| 24 | * @param processor - The CommandListProcessor processing this command. | 25 | * @param processor - The CommandListProcessor processing this command. |
| 25 | * @param string - The string to print into. | 26 | * @param string - The string to print into. |
| 26 | */ | 27 | */ |
| 27 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 28 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 28 | 29 | ||
| 29 | /** | 30 | /** |
| 30 | * Process this command. | 31 | * Process this command. |
| 31 | * | 32 | * |
| 32 | * @param processor - The CommandListProcessor processing this command. | 33 | * @param processor - The CommandListProcessor processing this command. |
| 33 | */ | 34 | */ |
| 34 | void Process(const ADSP::CommandListProcessor& processor) override; | 35 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 35 | 36 | ||
| 36 | /** | 37 | /** |
| 37 | * Verify this command's data is valid. | 38 | * Verify this command's data is valid. |
| @@ -39,7 +40,7 @@ struct ClearMixBufferCommand : ICommand { | |||
| 39 | * @param processor - The CommandListProcessor processing this command. | 40 | * @param processor - The CommandListProcessor processing this command. |
| 40 | * @return True if the command is valid, otherwise false. | 41 | * @return True if the command is valid, otherwise false. |
| 41 | */ | 42 | */ |
| 42 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 43 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 43 | }; | 44 | }; |
| 44 | 45 | ||
| 45 | } // namespace AudioCore::AudioRenderer | 46 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/mix/copy_mix.cpp b/src/audio_core/renderer/command/mix/copy_mix.cpp index 1d49f1644..5d386f95a 100644 --- a/src/audio_core/renderer/command/mix/copy_mix.cpp +++ b/src/audio_core/renderer/command/mix/copy_mix.cpp | |||
| @@ -1,18 +1,18 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/adsp/command_list_processor.h" | 4 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" |
| 5 | #include "audio_core/renderer/command/mix/copy_mix.h" | 5 | #include "audio_core/renderer/command/mix/copy_mix.h" |
| 6 | 6 | ||
| 7 | namespace AudioCore::AudioRenderer { | 7 | namespace AudioCore::Renderer { |
| 8 | 8 | ||
| 9 | void CopyMixBufferCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, | 9 | void CopyMixBufferCommand::Dump( |
| 10 | std::string& string) { | 10 | [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { |
| 11 | string += fmt::format("CopyMixBufferCommand\n\tinput {:02X} output {:02X}\n", input_index, | 11 | string += fmt::format("CopyMixBufferCommand\n\tinput {:02X} output {:02X}\n", input_index, |
| 12 | output_index); | 12 | output_index); |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | void CopyMixBufferCommand::Process(const ADSP::CommandListProcessor& processor) { | 15 | void CopyMixBufferCommand::Process(const AudioRenderer::CommandListProcessor& processor) { |
| 16 | auto output{processor.mix_buffers.subspan(output_index * processor.sample_count, | 16 | auto output{processor.mix_buffers.subspan(output_index * processor.sample_count, |
| 17 | processor.sample_count)}; | 17 | processor.sample_count)}; |
| 18 | auto input{processor.mix_buffers.subspan(input_index * processor.sample_count, | 18 | auto input{processor.mix_buffers.subspan(input_index * processor.sample_count, |
| @@ -20,8 +20,8 @@ void CopyMixBufferCommand::Process(const ADSP::CommandListProcessor& processor) | |||
| 20 | std::memcpy(output.data(), input.data(), processor.sample_count * sizeof(s32)); | 20 | std::memcpy(output.data(), input.data(), processor.sample_count * sizeof(s32)); |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | bool CopyMixBufferCommand::Verify(const ADSP::CommandListProcessor& processor) { | 23 | bool CopyMixBufferCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { |
| 24 | return true; | 24 | return true; |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | } // namespace AudioCore::AudioRenderer | 27 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/mix/copy_mix.h b/src/audio_core/renderer/command/mix/copy_mix.h index a59007fb6..ae247c3f8 100644 --- a/src/audio_core/renderer/command/mix/copy_mix.h +++ b/src/audio_core/renderer/command/mix/copy_mix.h | |||
| @@ -8,11 +8,12 @@ | |||
| 8 | #include "audio_core/renderer/command/icommand.h" | 8 | #include "audio_core/renderer/command/icommand.h" |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | 10 | ||
| 11 | namespace AudioCore::AudioRenderer { | 11 | namespace AudioCore::ADSP::AudioRenderer { |
| 12 | namespace ADSP { | ||
| 13 | class CommandListProcessor; | 12 | class CommandListProcessor; |
| 14 | } | 13 | } |
| 15 | 14 | ||
| 15 | namespace AudioCore::Renderer { | ||
| 16 | |||
| 16 | /** | 17 | /** |
| 17 | * AudioRenderer command for a copying a mix buffer from input to output. | 18 | * AudioRenderer command for a copying a mix buffer from input to output. |
| 18 | */ | 19 | */ |
| @@ -23,14 +24,14 @@ struct CopyMixBufferCommand : ICommand { | |||
| 23 | * @param processor - The CommandListProcessor processing this command. | 24 | * @param processor - The CommandListProcessor processing this command. |
| 24 | * @param string - The string to print into. | 25 | * @param string - The string to print into. |
| 25 | */ | 26 | */ |
| 26 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 27 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 27 | 28 | ||
| 28 | /** | 29 | /** |
| 29 | * Process this command. | 30 | * Process this command. |
| 30 | * | 31 | * |
| 31 | * @param processor - The CommandListProcessor processing this command. | 32 | * @param processor - The CommandListProcessor processing this command. |
| 32 | */ | 33 | */ |
| 33 | void Process(const ADSP::CommandListProcessor& processor) override; | 34 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 34 | 35 | ||
| 35 | /** | 36 | /** |
| 36 | * Verify this command's data is valid. | 37 | * Verify this command's data is valid. |
| @@ -38,7 +39,7 @@ struct CopyMixBufferCommand : ICommand { | |||
| 38 | * @param processor - The CommandListProcessor processing this command. | 39 | * @param processor - The CommandListProcessor processing this command. |
| 39 | * @return True if the command is valid, otherwise false. | 40 | * @return True if the command is valid, otherwise false. |
| 40 | */ | 41 | */ |
| 41 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 42 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 42 | 43 | ||
| 43 | /// Input mix buffer index | 44 | /// Input mix buffer index |
| 44 | s16 input_index; | 45 | s16 input_index; |
| @@ -46,4 +47,4 @@ struct CopyMixBufferCommand : ICommand { | |||
| 46 | s16 output_index; | 47 | s16 output_index; |
| 47 | }; | 48 | }; |
| 48 | 49 | ||
| 49 | } // namespace AudioCore::AudioRenderer | 50 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/mix/depop_for_mix_buffers.cpp b/src/audio_core/renderer/command/mix/depop_for_mix_buffers.cpp index c2bc10061..caedb56b7 100644 --- a/src/audio_core/renderer/command/mix/depop_for_mix_buffers.cpp +++ b/src/audio_core/renderer/command/mix/depop_for_mix_buffers.cpp | |||
| @@ -1,11 +1,11 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" | ||
| 4 | #include "audio_core/common/common.h" | 5 | #include "audio_core/common/common.h" |
| 5 | #include "audio_core/renderer/adsp/command_list_processor.h" | ||
| 6 | #include "audio_core/renderer/command/mix/depop_for_mix_buffers.h" | 6 | #include "audio_core/renderer/command/mix/depop_for_mix_buffers.h" |
| 7 | 7 | ||
| 8 | namespace AudioCore::AudioRenderer { | 8 | namespace AudioCore::Renderer { |
| 9 | /** | 9 | /** |
| 10 | * Apply depopping. Add the depopped sample to each incoming new sample, decaying it each time | 10 | * Apply depopping. Add the depopped sample to each incoming new sample, decaying it each time |
| 11 | * according to decay. | 11 | * according to decay. |
| @@ -36,13 +36,13 @@ static s32 ApplyDepopMix(std::span<s32> output, const s32 depop_sample, | |||
| 36 | } | 36 | } |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | void DepopForMixBuffersCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, | 39 | void DepopForMixBuffersCommand::Dump( |
| 40 | std::string& string) { | 40 | [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { |
| 41 | string += fmt::format("DepopForMixBuffersCommand\n\tinput {:02X} count {} decay {}\n", input, | 41 | string += fmt::format("DepopForMixBuffersCommand\n\tinput {:02X} count {} decay {}\n", input, |
| 42 | count, decay.to_float()); | 42 | count, decay.to_float()); |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | void DepopForMixBuffersCommand::Process(const ADSP::CommandListProcessor& processor) { | 45 | void DepopForMixBuffersCommand::Process(const AudioRenderer::CommandListProcessor& processor) { |
| 46 | auto end_index{std::min(processor.buffer_count, input + count)}; | 46 | auto end_index{std::min(processor.buffer_count, input + count)}; |
| 47 | std::span<s32> depop_buff{reinterpret_cast<s32*>(depop_buffer), end_index}; | 47 | std::span<s32> depop_buff{reinterpret_cast<s32*>(depop_buffer), end_index}; |
| 48 | 48 | ||
| @@ -57,8 +57,8 @@ void DepopForMixBuffersCommand::Process(const ADSP::CommandListProcessor& proces | |||
| 57 | } | 57 | } |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | bool DepopForMixBuffersCommand::Verify(const ADSP::CommandListProcessor& processor) { | 60 | bool DepopForMixBuffersCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { |
| 61 | return true; | 61 | return true; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | } // namespace AudioCore::AudioRenderer | 64 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/mix/depop_for_mix_buffers.h b/src/audio_core/renderer/command/mix/depop_for_mix_buffers.h index e7268ff27..699d38988 100644 --- a/src/audio_core/renderer/command/mix/depop_for_mix_buffers.h +++ b/src/audio_core/renderer/command/mix/depop_for_mix_buffers.h | |||
| @@ -9,11 +9,12 @@ | |||
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | #include "common/fixed_point.h" | 10 | #include "common/fixed_point.h" |
| 11 | 11 | ||
| 12 | namespace AudioCore::AudioRenderer { | 12 | namespace AudioCore::ADSP::AudioRenderer { |
| 13 | namespace ADSP { | ||
| 14 | class CommandListProcessor; | 13 | class CommandListProcessor; |
| 15 | } | 14 | } |
| 16 | 15 | ||
| 16 | namespace AudioCore::Renderer { | ||
| 17 | |||
| 17 | /** | 18 | /** |
| 18 | * AudioRenderer command for depopping a mix buffer. | 19 | * AudioRenderer command for depopping a mix buffer. |
| 19 | * Adds a cumulation of previous samples to the current mix buffer with a decay. | 20 | * Adds a cumulation of previous samples to the current mix buffer with a decay. |
| @@ -25,14 +26,14 @@ struct DepopForMixBuffersCommand : ICommand { | |||
| 25 | * @param processor - The CommandListProcessor processing this command. | 26 | * @param processor - The CommandListProcessor processing this command. |
| 26 | * @param string - The string to print into. | 27 | * @param string - The string to print into. |
| 27 | */ | 28 | */ |
| 28 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 29 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 29 | 30 | ||
| 30 | /** | 31 | /** |
| 31 | * Process this command. | 32 | * Process this command. |
| 32 | * | 33 | * |
| 33 | * @param processor - The CommandListProcessor processing this command. | 34 | * @param processor - The CommandListProcessor processing this command. |
| 34 | */ | 35 | */ |
| 35 | void Process(const ADSP::CommandListProcessor& processor) override; | 36 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 36 | 37 | ||
| 37 | /** | 38 | /** |
| 38 | * Verify this command's data is valid. | 39 | * Verify this command's data is valid. |
| @@ -40,7 +41,7 @@ struct DepopForMixBuffersCommand : ICommand { | |||
| 40 | * @param processor - The CommandListProcessor processing this command. | 41 | * @param processor - The CommandListProcessor processing this command. |
| 41 | * @return True if the command is valid, otherwise false. | 42 | * @return True if the command is valid, otherwise false. |
| 42 | */ | 43 | */ |
| 43 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 44 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 44 | 45 | ||
| 45 | /// Starting input mix buffer index | 46 | /// Starting input mix buffer index |
| 46 | u32 input; | 47 | u32 input; |
| @@ -52,4 +53,4 @@ struct DepopForMixBuffersCommand : ICommand { | |||
| 52 | CpuAddr depop_buffer; | 53 | CpuAddr depop_buffer; |
| 53 | }; | 54 | }; |
| 54 | 55 | ||
| 55 | } // namespace AudioCore::AudioRenderer | 56 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/mix/depop_prepare.cpp b/src/audio_core/renderer/command/mix/depop_prepare.cpp index 69bb78ccc..2faf4681a 100644 --- a/src/audio_core/renderer/command/mix/depop_prepare.cpp +++ b/src/audio_core/renderer/command/mix/depop_prepare.cpp | |||
| @@ -1,15 +1,15 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/adsp/command_list_processor.h" | 4 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" |
| 5 | #include "audio_core/renderer/command/mix/depop_prepare.h" | 5 | #include "audio_core/renderer/command/mix/depop_prepare.h" |
| 6 | #include "audio_core/renderer/voice/voice_state.h" | 6 | #include "audio_core/renderer/voice/voice_state.h" |
| 7 | #include "common/fixed_point.h" | 7 | #include "common/fixed_point.h" |
| 8 | 8 | ||
| 9 | namespace AudioCore::AudioRenderer { | 9 | namespace AudioCore::Renderer { |
| 10 | 10 | ||
| 11 | void DepopPrepareCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, | 11 | void DepopPrepareCommand::Dump( |
| 12 | std::string& string) { | 12 | [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { |
| 13 | string += fmt::format("DepopPrepareCommand\n\tinputs: "); | 13 | string += fmt::format("DepopPrepareCommand\n\tinputs: "); |
| 14 | for (u32 i = 0; i < buffer_count; i++) { | 14 | for (u32 i = 0; i < buffer_count; i++) { |
| 15 | string += fmt::format("{:02X}, ", inputs[i]); | 15 | string += fmt::format("{:02X}, ", inputs[i]); |
| @@ -17,7 +17,7 @@ void DepopPrepareCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor | |||
| 17 | string += "\n"; | 17 | string += "\n"; |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | void DepopPrepareCommand::Process(const ADSP::CommandListProcessor& processor) { | 20 | void DepopPrepareCommand::Process(const AudioRenderer::CommandListProcessor& processor) { |
| 21 | auto samples{reinterpret_cast<s32*>(previous_samples)}; | 21 | auto samples{reinterpret_cast<s32*>(previous_samples)}; |
| 22 | auto buffer{reinterpret_cast<s32*>(depop_buffer)}; | 22 | auto buffer{reinterpret_cast<s32*>(depop_buffer)}; |
| 23 | 23 | ||
| @@ -29,8 +29,8 @@ void DepopPrepareCommand::Process(const ADSP::CommandListProcessor& processor) { | |||
| 29 | } | 29 | } |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | bool DepopPrepareCommand::Verify(const ADSP::CommandListProcessor& processor) { | 32 | bool DepopPrepareCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { |
| 33 | return true; | 33 | return true; |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | } // namespace AudioCore::AudioRenderer | 36 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/mix/depop_prepare.h b/src/audio_core/renderer/command/mix/depop_prepare.h index a5465da9a..161a94461 100644 --- a/src/audio_core/renderer/command/mix/depop_prepare.h +++ b/src/audio_core/renderer/command/mix/depop_prepare.h | |||
| @@ -8,11 +8,12 @@ | |||
| 8 | #include "audio_core/renderer/command/icommand.h" | 8 | #include "audio_core/renderer/command/icommand.h" |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | 10 | ||
| 11 | namespace AudioCore::AudioRenderer { | 11 | namespace AudioCore::ADSP::AudioRenderer { |
| 12 | namespace ADSP { | ||
| 13 | class CommandListProcessor; | 12 | class CommandListProcessor; |
| 14 | } | 13 | } |
| 15 | 14 | ||
| 15 | namespace AudioCore::Renderer { | ||
| 16 | |||
| 16 | /** | 17 | /** |
| 17 | * AudioRenderer command for preparing depop. | 18 | * AudioRenderer command for preparing depop. |
| 18 | * Adds the previusly output last samples to the depop buffer. | 19 | * Adds the previusly output last samples to the depop buffer. |
| @@ -24,14 +25,14 @@ struct DepopPrepareCommand : ICommand { | |||
| 24 | * @param processor - The CommandListProcessor processing this command. | 25 | * @param processor - The CommandListProcessor processing this command. |
| 25 | * @param string - The string to print into. | 26 | * @param string - The string to print into. |
| 26 | */ | 27 | */ |
| 27 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 28 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 28 | 29 | ||
| 29 | /** | 30 | /** |
| 30 | * Process this command. | 31 | * Process this command. |
| 31 | * | 32 | * |
| 32 | * @param processor - The CommandListProcessor processing this command. | 33 | * @param processor - The CommandListProcessor processing this command. |
| 33 | */ | 34 | */ |
| 34 | void Process(const ADSP::CommandListProcessor& processor) override; | 35 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 35 | 36 | ||
| 36 | /** | 37 | /** |
| 37 | * Verify this command's data is valid. | 38 | * Verify this command's data is valid. |
| @@ -39,7 +40,7 @@ struct DepopPrepareCommand : ICommand { | |||
| 39 | * @param processor - The CommandListProcessor processing this command. | 40 | * @param processor - The CommandListProcessor processing this command. |
| 40 | * @return True if the command is valid, otherwise false. | 41 | * @return True if the command is valid, otherwise false. |
| 41 | */ | 42 | */ |
| 42 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 43 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 43 | 44 | ||
| 44 | /// Depop buffer offset for each mix buffer | 45 | /// Depop buffer offset for each mix buffer |
| 45 | std::array<s16, MaxMixBuffers> inputs; | 46 | std::array<s16, MaxMixBuffers> inputs; |
| @@ -51,4 +52,4 @@ struct DepopPrepareCommand : ICommand { | |||
| 51 | CpuAddr depop_buffer; | 52 | CpuAddr depop_buffer; |
| 52 | }; | 53 | }; |
| 53 | 54 | ||
| 54 | } // namespace AudioCore::AudioRenderer | 55 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/mix/mix.cpp b/src/audio_core/renderer/command/mix/mix.cpp index 8ecf9b05a..8bd689b88 100644 --- a/src/audio_core/renderer/command/mix/mix.cpp +++ b/src/audio_core/renderer/command/mix/mix.cpp | |||
| @@ -5,11 +5,11 @@ | |||
| 5 | #include <limits> | 5 | #include <limits> |
| 6 | #include <span> | 6 | #include <span> |
| 7 | 7 | ||
| 8 | #include "audio_core/renderer/adsp/command_list_processor.h" | 8 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" |
| 9 | #include "audio_core/renderer/command/mix/mix.h" | 9 | #include "audio_core/renderer/command/mix/mix.h" |
| 10 | #include "common/fixed_point.h" | 10 | #include "common/fixed_point.h" |
| 11 | 11 | ||
| 12 | namespace AudioCore::AudioRenderer { | 12 | namespace AudioCore::Renderer { |
| 13 | /** | 13 | /** |
| 14 | * Mix input mix buffer into output mix buffer, with volume applied to the input. | 14 | * Mix input mix buffer into output mix buffer, with volume applied to the input. |
| 15 | * | 15 | * |
| @@ -28,7 +28,7 @@ static void ApplyMix(std::span<s32> output, std::span<const s32> input, const f3 | |||
| 28 | } | 28 | } |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | void MixCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, | 31 | void MixCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, |
| 32 | std::string& string) { | 32 | std::string& string) { |
| 33 | string += fmt::format("MixCommand"); | 33 | string += fmt::format("MixCommand"); |
| 34 | string += fmt::format("\n\tinput {:02X}", input_index); | 34 | string += fmt::format("\n\tinput {:02X}", input_index); |
| @@ -37,7 +37,7 @@ void MixCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& process | |||
| 37 | string += "\n"; | 37 | string += "\n"; |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | void MixCommand::Process(const ADSP::CommandListProcessor& processor) { | 40 | void MixCommand::Process(const AudioRenderer::CommandListProcessor& processor) { |
| 41 | auto output{processor.mix_buffers.subspan(output_index * processor.sample_count, | 41 | auto output{processor.mix_buffers.subspan(output_index * processor.sample_count, |
| 42 | processor.sample_count)}; | 42 | processor.sample_count)}; |
| 43 | auto input{processor.mix_buffers.subspan(input_index * processor.sample_count, | 43 | auto input{processor.mix_buffers.subspan(input_index * processor.sample_count, |
| @@ -63,8 +63,8 @@ void MixCommand::Process(const ADSP::CommandListProcessor& processor) { | |||
| 63 | } | 63 | } |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | bool MixCommand::Verify(const ADSP::CommandListProcessor& processor) { | 66 | bool MixCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { |
| 67 | return true; | 67 | return true; |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | } // namespace AudioCore::AudioRenderer | 70 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/mix/mix.h b/src/audio_core/renderer/command/mix/mix.h index 0201cf171..64c812382 100644 --- a/src/audio_core/renderer/command/mix/mix.h +++ b/src/audio_core/renderer/command/mix/mix.h | |||
| @@ -8,11 +8,12 @@ | |||
| 8 | #include "audio_core/renderer/command/icommand.h" | 8 | #include "audio_core/renderer/command/icommand.h" |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | 10 | ||
| 11 | namespace AudioCore::AudioRenderer { | 11 | namespace AudioCore::ADSP::AudioRenderer { |
| 12 | namespace ADSP { | ||
| 13 | class CommandListProcessor; | 12 | class CommandListProcessor; |
| 14 | } | 13 | } |
| 15 | 14 | ||
| 15 | namespace AudioCore::Renderer { | ||
| 16 | |||
| 16 | /** | 17 | /** |
| 17 | * AudioRenderer command for mixing an input mix buffer to an output mix buffer, with a volume | 18 | * AudioRenderer command for mixing an input mix buffer to an output mix buffer, with a volume |
| 18 | * applied to the input. | 19 | * applied to the input. |
| @@ -24,14 +25,14 @@ struct MixCommand : ICommand { | |||
| 24 | * @param processor - The CommandListProcessor processing this command. | 25 | * @param processor - The CommandListProcessor processing this command. |
| 25 | * @param string - The string to print into. | 26 | * @param string - The string to print into. |
| 26 | */ | 27 | */ |
| 27 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 28 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 28 | 29 | ||
| 29 | /** | 30 | /** |
| 30 | * Process this command. | 31 | * Process this command. |
| 31 | * | 32 | * |
| 32 | * @param processor - The CommandListProcessor processing this command. | 33 | * @param processor - The CommandListProcessor processing this command. |
| 33 | */ | 34 | */ |
| 34 | void Process(const ADSP::CommandListProcessor& processor) override; | 35 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 35 | 36 | ||
| 36 | /** | 37 | /** |
| 37 | * Verify this command's data is valid. | 38 | * Verify this command's data is valid. |
| @@ -39,7 +40,7 @@ struct MixCommand : ICommand { | |||
| 39 | * @param processor - The CommandListProcessor processing this command. | 40 | * @param processor - The CommandListProcessor processing this command. |
| 40 | * @return True if the command is valid, otherwise false. | 41 | * @return True if the command is valid, otherwise false. |
| 41 | */ | 42 | */ |
| 42 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 43 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 43 | 44 | ||
| 44 | /// Fixed point precision | 45 | /// Fixed point precision |
| 45 | u8 precision; | 46 | u8 precision; |
| @@ -51,4 +52,4 @@ struct MixCommand : ICommand { | |||
| 51 | f32 volume; | 52 | f32 volume; |
| 52 | }; | 53 | }; |
| 53 | 54 | ||
| 54 | } // namespace AudioCore::AudioRenderer | 55 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/mix/mix_ramp.cpp b/src/audio_core/renderer/command/mix/mix_ramp.cpp index d67123cd8..2f6500da5 100644 --- a/src/audio_core/renderer/command/mix/mix_ramp.cpp +++ b/src/audio_core/renderer/command/mix/mix_ramp.cpp | |||
| @@ -1,12 +1,12 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/adsp/command_list_processor.h" | 4 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" |
| 5 | #include "audio_core/renderer/command/mix/mix_ramp.h" | 5 | #include "audio_core/renderer/command/mix/mix_ramp.h" |
| 6 | #include "common/fixed_point.h" | 6 | #include "common/fixed_point.h" |
| 7 | #include "common/logging/log.h" | 7 | #include "common/logging/log.h" |
| 8 | 8 | ||
| 9 | namespace AudioCore::AudioRenderer { | 9 | namespace AudioCore::Renderer { |
| 10 | 10 | ||
| 11 | template <size_t Q> | 11 | template <size_t Q> |
| 12 | s32 ApplyMixRamp(std::span<s32> output, std::span<const s32> input, const f32 volume_, | 12 | s32 ApplyMixRamp(std::span<s32> output, std::span<const s32> input, const f32 volume_, |
| @@ -33,7 +33,8 @@ s32 ApplyMixRamp(std::span<s32> output, std::span<const s32> input, const f32 vo | |||
| 33 | template s32 ApplyMixRamp<15>(std::span<s32>, std::span<const s32>, f32, f32, u32); | 33 | template s32 ApplyMixRamp<15>(std::span<s32>, std::span<const s32>, f32, f32, u32); |
| 34 | template s32 ApplyMixRamp<23>(std::span<s32>, std::span<const s32>, f32, f32, u32); | 34 | template s32 ApplyMixRamp<23>(std::span<s32>, std::span<const s32>, f32, f32, u32); |
| 35 | 35 | ||
| 36 | void MixRampCommand::Dump(const ADSP::CommandListProcessor& processor, std::string& string) { | 36 | void MixRampCommand::Dump(const AudioRenderer::CommandListProcessor& processor, |
| 37 | std::string& string) { | ||
| 37 | const auto ramp{(volume - prev_volume) / static_cast<f32>(processor.sample_count)}; | 38 | const auto ramp{(volume - prev_volume) / static_cast<f32>(processor.sample_count)}; |
| 38 | string += fmt::format("MixRampCommand"); | 39 | string += fmt::format("MixRampCommand"); |
| 39 | string += fmt::format("\n\tinput {:02X}", input_index); | 40 | string += fmt::format("\n\tinput {:02X}", input_index); |
| @@ -44,7 +45,7 @@ void MixRampCommand::Dump(const ADSP::CommandListProcessor& processor, std::stri | |||
| 44 | string += "\n"; | 45 | string += "\n"; |
| 45 | } | 46 | } |
| 46 | 47 | ||
| 47 | void MixRampCommand::Process(const ADSP::CommandListProcessor& processor) { | 48 | void MixRampCommand::Process(const AudioRenderer::CommandListProcessor& processor) { |
| 48 | auto output{processor.mix_buffers.subspan(output_index * processor.sample_count, | 49 | auto output{processor.mix_buffers.subspan(output_index * processor.sample_count, |
| 49 | processor.sample_count)}; | 50 | processor.sample_count)}; |
| 50 | auto input{processor.mix_buffers.subspan(input_index * processor.sample_count, | 51 | auto input{processor.mix_buffers.subspan(input_index * processor.sample_count, |
| @@ -75,8 +76,8 @@ void MixRampCommand::Process(const ADSP::CommandListProcessor& processor) { | |||
| 75 | } | 76 | } |
| 76 | } | 77 | } |
| 77 | 78 | ||
| 78 | bool MixRampCommand::Verify(const ADSP::CommandListProcessor& processor) { | 79 | bool MixRampCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { |
| 79 | return true; | 80 | return true; |
| 80 | } | 81 | } |
| 81 | 82 | ||
| 82 | } // namespace AudioCore::AudioRenderer | 83 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/mix/mix_ramp.h b/src/audio_core/renderer/command/mix/mix_ramp.h index 52f74a273..92209b53a 100644 --- a/src/audio_core/renderer/command/mix/mix_ramp.h +++ b/src/audio_core/renderer/command/mix/mix_ramp.h | |||
| @@ -9,11 +9,12 @@ | |||
| 9 | #include "audio_core/renderer/command/icommand.h" | 9 | #include "audio_core/renderer/command/icommand.h" |
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | 11 | ||
| 12 | namespace AudioCore::AudioRenderer { | 12 | namespace AudioCore::ADSP::AudioRenderer { |
| 13 | namespace ADSP { | ||
| 14 | class CommandListProcessor; | 13 | class CommandListProcessor; |
| 15 | } | 14 | } |
| 16 | 15 | ||
| 16 | namespace AudioCore::Renderer { | ||
| 17 | |||
| 17 | /** | 18 | /** |
| 18 | * AudioRenderer command for mixing an input mix buffer to an output mix buffer, with a volume | 19 | * AudioRenderer command for mixing an input mix buffer to an output mix buffer, with a volume |
| 19 | * applied to the input, and volume ramping to smooth out the transition. | 20 | * applied to the input, and volume ramping to smooth out the transition. |
| @@ -25,14 +26,14 @@ struct MixRampCommand : ICommand { | |||
| 25 | * @param processor - The CommandListProcessor processing this command. | 26 | * @param processor - The CommandListProcessor processing this command. |
| 26 | * @param string - The string to print into. | 27 | * @param string - The string to print into. |
| 27 | */ | 28 | */ |
| 28 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 29 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 29 | 30 | ||
| 30 | /** | 31 | /** |
| 31 | * Process this command. | 32 | * Process this command. |
| 32 | * | 33 | * |
| 33 | * @param processor - The CommandListProcessor processing this command. | 34 | * @param processor - The CommandListProcessor processing this command. |
| 34 | */ | 35 | */ |
| 35 | void Process(const ADSP::CommandListProcessor& processor) override; | 36 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 36 | 37 | ||
| 37 | /** | 38 | /** |
| 38 | * Verify this command's data is valid. | 39 | * Verify this command's data is valid. |
| @@ -40,7 +41,7 @@ struct MixRampCommand : ICommand { | |||
| 40 | * @param processor - The CommandListProcessor processing this command. | 41 | * @param processor - The CommandListProcessor processing this command. |
| 41 | * @return True if the command is valid, otherwise false. | 42 | * @return True if the command is valid, otherwise false. |
| 42 | */ | 43 | */ |
| 43 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 44 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 44 | 45 | ||
| 45 | /// Fixed point precision | 46 | /// Fixed point precision |
| 46 | u8 precision; | 47 | u8 precision; |
| @@ -70,4 +71,4 @@ template <size_t Q> | |||
| 70 | s32 ApplyMixRamp(std::span<s32> output, std::span<const s32> input, f32 volume_, f32 ramp_, | 71 | s32 ApplyMixRamp(std::span<s32> output, std::span<const s32> input, f32 volume_, f32 ramp_, |
| 71 | u32 sample_count); | 72 | u32 sample_count); |
| 72 | 73 | ||
| 73 | } // namespace AudioCore::AudioRenderer | 74 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/mix/mix_ramp_grouped.cpp b/src/audio_core/renderer/command/mix/mix_ramp_grouped.cpp index 43dbef9fc..64138a9bf 100644 --- a/src/audio_core/renderer/command/mix/mix_ramp_grouped.cpp +++ b/src/audio_core/renderer/command/mix/mix_ramp_grouped.cpp | |||
| @@ -1,13 +1,14 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/adsp/command_list_processor.h" | 4 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" |
| 5 | #include "audio_core/renderer/command/mix/mix_ramp.h" | 5 | #include "audio_core/renderer/command/mix/mix_ramp.h" |
| 6 | #include "audio_core/renderer/command/mix/mix_ramp_grouped.h" | 6 | #include "audio_core/renderer/command/mix/mix_ramp_grouped.h" |
| 7 | 7 | ||
| 8 | namespace AudioCore::AudioRenderer { | 8 | namespace AudioCore::Renderer { |
| 9 | 9 | ||
| 10 | void MixRampGroupedCommand::Dump(const ADSP::CommandListProcessor& processor, std::string& string) { | 10 | void MixRampGroupedCommand::Dump(const AudioRenderer::CommandListProcessor& processor, |
| 11 | std::string& string) { | ||
| 11 | string += "MixRampGroupedCommand"; | 12 | string += "MixRampGroupedCommand"; |
| 12 | for (u32 i = 0; i < buffer_count; i++) { | 13 | for (u32 i = 0; i < buffer_count; i++) { |
| 13 | string += fmt::format("\n\t{}", i); | 14 | string += fmt::format("\n\t{}", i); |
| @@ -21,7 +22,7 @@ void MixRampGroupedCommand::Dump(const ADSP::CommandListProcessor& processor, st | |||
| 21 | } | 22 | } |
| 22 | } | 23 | } |
| 23 | 24 | ||
| 24 | void MixRampGroupedCommand::Process(const ADSP::CommandListProcessor& processor) { | 25 | void MixRampGroupedCommand::Process(const AudioRenderer::CommandListProcessor& processor) { |
| 25 | std::span<s32> prev_samples = {reinterpret_cast<s32*>(previous_samples), MaxMixBuffers}; | 26 | std::span<s32> prev_samples = {reinterpret_cast<s32*>(previous_samples), MaxMixBuffers}; |
| 26 | 27 | ||
| 27 | for (u32 i = 0; i < buffer_count; i++) { | 28 | for (u32 i = 0; i < buffer_count; i++) { |
| @@ -58,8 +59,8 @@ void MixRampGroupedCommand::Process(const ADSP::CommandListProcessor& processor) | |||
| 58 | } | 59 | } |
| 59 | } | 60 | } |
| 60 | 61 | ||
| 61 | bool MixRampGroupedCommand::Verify(const ADSP::CommandListProcessor& processor) { | 62 | bool MixRampGroupedCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { |
| 62 | return true; | 63 | return true; |
| 63 | } | 64 | } |
| 64 | 65 | ||
| 65 | } // namespace AudioCore::AudioRenderer | 66 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/mix/mix_ramp_grouped.h b/src/audio_core/renderer/command/mix/mix_ramp_grouped.h index 3b0ce67ef..9621e42a3 100644 --- a/src/audio_core/renderer/command/mix/mix_ramp_grouped.h +++ b/src/audio_core/renderer/command/mix/mix_ramp_grouped.h | |||
| @@ -9,11 +9,12 @@ | |||
| 9 | #include "audio_core/renderer/command/icommand.h" | 9 | #include "audio_core/renderer/command/icommand.h" |
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | 11 | ||
| 12 | namespace AudioCore::AudioRenderer { | 12 | namespace AudioCore::ADSP::AudioRenderer { |
| 13 | namespace ADSP { | ||
| 14 | class CommandListProcessor; | 13 | class CommandListProcessor; |
| 15 | } | 14 | } |
| 16 | 15 | ||
| 16 | namespace AudioCore::Renderer { | ||
| 17 | |||
| 17 | /** | 18 | /** |
| 18 | * AudioRenderer command for mixing multiple input mix buffers to multiple output mix buffers, with | 19 | * AudioRenderer command for mixing multiple input mix buffers to multiple output mix buffers, with |
| 19 | * a volume applied to the input, and volume ramping to smooth out the transition. | 20 | * a volume applied to the input, and volume ramping to smooth out the transition. |
| @@ -25,14 +26,14 @@ struct MixRampGroupedCommand : ICommand { | |||
| 25 | * @param processor - The CommandListProcessor processing this command. | 26 | * @param processor - The CommandListProcessor processing this command. |
| 26 | * @param string - The string to print into. | 27 | * @param string - The string to print into. |
| 27 | */ | 28 | */ |
| 28 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 29 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 29 | 30 | ||
| 30 | /** | 31 | /** |
| 31 | * Process this command. | 32 | * Process this command. |
| 32 | * | 33 | * |
| 33 | * @param processor - The CommandListProcessor processing this command. | 34 | * @param processor - The CommandListProcessor processing this command. |
| 34 | */ | 35 | */ |
| 35 | void Process(const ADSP::CommandListProcessor& processor) override; | 36 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 36 | 37 | ||
| 37 | /** | 38 | /** |
| 38 | * Verify this command's data is valid. | 39 | * Verify this command's data is valid. |
| @@ -40,7 +41,7 @@ struct MixRampGroupedCommand : ICommand { | |||
| 40 | * @param processor - The CommandListProcessor processing this command. | 41 | * @param processor - The CommandListProcessor processing this command. |
| 41 | * @return True if the command is valid, otherwise false. | 42 | * @return True if the command is valid, otherwise false. |
| 42 | */ | 43 | */ |
| 43 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 44 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 44 | 45 | ||
| 45 | /// Fixed point precision | 46 | /// Fixed point precision |
| 46 | u8 precision; | 47 | u8 precision; |
| @@ -58,4 +59,4 @@ struct MixRampGroupedCommand : ICommand { | |||
| 58 | CpuAddr previous_samples; | 59 | CpuAddr previous_samples; |
| 59 | }; | 60 | }; |
| 60 | 61 | ||
| 61 | } // namespace AudioCore::AudioRenderer | 62 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/mix/volume.cpp b/src/audio_core/renderer/command/mix/volume.cpp index b045fb062..92baf6cc3 100644 --- a/src/audio_core/renderer/command/mix/volume.cpp +++ b/src/audio_core/renderer/command/mix/volume.cpp | |||
| @@ -1,12 +1,12 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/adsp/command_list_processor.h" | 4 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" |
| 5 | #include "audio_core/renderer/command/mix/volume.h" | 5 | #include "audio_core/renderer/command/mix/volume.h" |
| 6 | #include "common/fixed_point.h" | 6 | #include "common/fixed_point.h" |
| 7 | #include "common/logging/log.h" | 7 | #include "common/logging/log.h" |
| 8 | 8 | ||
| 9 | namespace AudioCore::AudioRenderer { | 9 | namespace AudioCore::Renderer { |
| 10 | /** | 10 | /** |
| 11 | * Apply volume to the input mix buffer, saving to the output buffer. | 11 | * Apply volume to the input mix buffer, saving to the output buffer. |
| 12 | * | 12 | * |
| @@ -29,7 +29,7 @@ static void ApplyUniformGain(std::span<s32> output, std::span<const s32> input, | |||
| 29 | } | 29 | } |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | void VolumeCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, | 32 | void VolumeCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, |
| 33 | std::string& string) { | 33 | std::string& string) { |
| 34 | string += fmt::format("VolumeCommand"); | 34 | string += fmt::format("VolumeCommand"); |
| 35 | string += fmt::format("\n\tinput {:02X}", input_index); | 35 | string += fmt::format("\n\tinput {:02X}", input_index); |
| @@ -38,7 +38,7 @@ void VolumeCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& proc | |||
| 38 | string += "\n"; | 38 | string += "\n"; |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | void VolumeCommand::Process(const ADSP::CommandListProcessor& processor) { | 41 | void VolumeCommand::Process(const AudioRenderer::CommandListProcessor& processor) { |
| 42 | // If input and output buffers are the same, and the volume is 1.0f, this won't do | 42 | // If input and output buffers are the same, and the volume is 1.0f, this won't do |
| 43 | // anything, so just skip. | 43 | // anything, so just skip. |
| 44 | if (input_index == output_index && volume == 1.0f) { | 44 | if (input_index == output_index && volume == 1.0f) { |
| @@ -65,8 +65,8 @@ void VolumeCommand::Process(const ADSP::CommandListProcessor& processor) { | |||
| 65 | } | 65 | } |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | bool VolumeCommand::Verify(const ADSP::CommandListProcessor& processor) { | 68 | bool VolumeCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { |
| 69 | return true; | 69 | return true; |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | } // namespace AudioCore::AudioRenderer | 72 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/mix/volume.h b/src/audio_core/renderer/command/mix/volume.h index 6ae9fb794..fbb8156ca 100644 --- a/src/audio_core/renderer/command/mix/volume.h +++ b/src/audio_core/renderer/command/mix/volume.h | |||
| @@ -8,11 +8,12 @@ | |||
| 8 | #include "audio_core/renderer/command/icommand.h" | 8 | #include "audio_core/renderer/command/icommand.h" |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | 10 | ||
| 11 | namespace AudioCore::AudioRenderer { | 11 | namespace AudioCore::ADSP::AudioRenderer { |
| 12 | namespace ADSP { | ||
| 13 | class CommandListProcessor; | 12 | class CommandListProcessor; |
| 14 | } | 13 | } |
| 15 | 14 | ||
| 15 | namespace AudioCore::Renderer { | ||
| 16 | |||
| 16 | /** | 17 | /** |
| 17 | * AudioRenderer command for applying volume to a mix buffer. | 18 | * AudioRenderer command for applying volume to a mix buffer. |
| 18 | */ | 19 | */ |
| @@ -23,14 +24,14 @@ struct VolumeCommand : ICommand { | |||
| 23 | * @param processor - The CommandListProcessor processing this command. | 24 | * @param processor - The CommandListProcessor processing this command. |
| 24 | * @param string - The string to print into. | 25 | * @param string - The string to print into. |
| 25 | */ | 26 | */ |
| 26 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 27 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 27 | 28 | ||
| 28 | /** | 29 | /** |
| 29 | * Process this command. | 30 | * Process this command. |
| 30 | * | 31 | * |
| 31 | * @param processor - The CommandListProcessor processing this command. | 32 | * @param processor - The CommandListProcessor processing this command. |
| 32 | */ | 33 | */ |
| 33 | void Process(const ADSP::CommandListProcessor& processor) override; | 34 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 34 | 35 | ||
| 35 | /** | 36 | /** |
| 36 | * Verify this command's data is valid. | 37 | * Verify this command's data is valid. |
| @@ -38,7 +39,7 @@ struct VolumeCommand : ICommand { | |||
| 38 | * @param processor - The CommandListProcessor processing this command. | 39 | * @param processor - The CommandListProcessor processing this command. |
| 39 | * @return True if the command is valid, otherwise false. | 40 | * @return True if the command is valid, otherwise false. |
| 40 | */ | 41 | */ |
| 41 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 42 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 42 | 43 | ||
| 43 | /// Fixed point precision | 44 | /// Fixed point precision |
| 44 | u8 precision; | 45 | u8 precision; |
| @@ -50,4 +51,4 @@ struct VolumeCommand : ICommand { | |||
| 50 | f32 volume; | 51 | f32 volume; |
| 51 | }; | 52 | }; |
| 52 | 53 | ||
| 53 | } // namespace AudioCore::AudioRenderer | 54 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/mix/volume_ramp.cpp b/src/audio_core/renderer/command/mix/volume_ramp.cpp index 424307148..fdc751957 100644 --- a/src/audio_core/renderer/command/mix/volume_ramp.cpp +++ b/src/audio_core/renderer/command/mix/volume_ramp.cpp | |||
| @@ -1,11 +1,11 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/adsp/command_list_processor.h" | 4 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" |
| 5 | #include "audio_core/renderer/command/mix/volume_ramp.h" | 5 | #include "audio_core/renderer/command/mix/volume_ramp.h" |
| 6 | #include "common/fixed_point.h" | 6 | #include "common/fixed_point.h" |
| 7 | 7 | ||
| 8 | namespace AudioCore::AudioRenderer { | 8 | namespace AudioCore::Renderer { |
| 9 | /** | 9 | /** |
| 10 | * Apply volume with ramping to the input mix buffer, saving to the output buffer. | 10 | * Apply volume with ramping to the input mix buffer, saving to the output buffer. |
| 11 | * | 11 | * |
| @@ -38,7 +38,8 @@ static void ApplyLinearEnvelopeGain(std::span<s32> output, std::span<const s32> | |||
| 38 | } | 38 | } |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | void VolumeRampCommand::Dump(const ADSP::CommandListProcessor& processor, std::string& string) { | 41 | void VolumeRampCommand::Dump(const AudioRenderer::CommandListProcessor& processor, |
| 42 | std::string& string) { | ||
| 42 | const auto ramp{(volume - prev_volume) / static_cast<f32>(processor.sample_count)}; | 43 | const auto ramp{(volume - prev_volume) / static_cast<f32>(processor.sample_count)}; |
| 43 | string += fmt::format("VolumeRampCommand"); | 44 | string += fmt::format("VolumeRampCommand"); |
| 44 | string += fmt::format("\n\tinput {:02X}", input_index); | 45 | string += fmt::format("\n\tinput {:02X}", input_index); |
| @@ -49,7 +50,7 @@ void VolumeRampCommand::Dump(const ADSP::CommandListProcessor& processor, std::s | |||
| 49 | string += "\n"; | 50 | string += "\n"; |
| 50 | } | 51 | } |
| 51 | 52 | ||
| 52 | void VolumeRampCommand::Process(const ADSP::CommandListProcessor& processor) { | 53 | void VolumeRampCommand::Process(const AudioRenderer::CommandListProcessor& processor) { |
| 53 | auto output{processor.mix_buffers.subspan(output_index * processor.sample_count, | 54 | auto output{processor.mix_buffers.subspan(output_index * processor.sample_count, |
| 54 | processor.sample_count)}; | 55 | processor.sample_count)}; |
| 55 | auto input{processor.mix_buffers.subspan(input_index * processor.sample_count, | 56 | auto input{processor.mix_buffers.subspan(input_index * processor.sample_count, |
| @@ -77,8 +78,8 @@ void VolumeRampCommand::Process(const ADSP::CommandListProcessor& processor) { | |||
| 77 | } | 78 | } |
| 78 | } | 79 | } |
| 79 | 80 | ||
| 80 | bool VolumeRampCommand::Verify(const ADSP::CommandListProcessor& processor) { | 81 | bool VolumeRampCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { |
| 81 | return true; | 82 | return true; |
| 82 | } | 83 | } |
| 83 | 84 | ||
| 84 | } // namespace AudioCore::AudioRenderer | 85 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/mix/volume_ramp.h b/src/audio_core/renderer/command/mix/volume_ramp.h index 77b61547e..d9794fb95 100644 --- a/src/audio_core/renderer/command/mix/volume_ramp.h +++ b/src/audio_core/renderer/command/mix/volume_ramp.h | |||
| @@ -8,11 +8,12 @@ | |||
| 8 | #include "audio_core/renderer/command/icommand.h" | 8 | #include "audio_core/renderer/command/icommand.h" |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | 10 | ||
| 11 | namespace AudioCore::AudioRenderer { | 11 | namespace AudioCore::ADSP::AudioRenderer { |
| 12 | namespace ADSP { | ||
| 13 | class CommandListProcessor; | 12 | class CommandListProcessor; |
| 14 | } | 13 | } |
| 15 | 14 | ||
| 15 | namespace AudioCore::Renderer { | ||
| 16 | |||
| 16 | /** | 17 | /** |
| 17 | * AudioRenderer command for applying volume to a mix buffer, with ramping for the volume to smooth | 18 | * AudioRenderer command for applying volume to a mix buffer, with ramping for the volume to smooth |
| 18 | * out the transition. | 19 | * out the transition. |
| @@ -24,14 +25,14 @@ struct VolumeRampCommand : ICommand { | |||
| 24 | * @param processor - The CommandListProcessor processing this command. | 25 | * @param processor - The CommandListProcessor processing this command. |
| 25 | * @param string - The string to print into. | 26 | * @param string - The string to print into. |
| 26 | */ | 27 | */ |
| 27 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 28 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 28 | 29 | ||
| 29 | /** | 30 | /** |
| 30 | * Process this command. | 31 | * Process this command. |
| 31 | * | 32 | * |
| 32 | * @param processor - The CommandListProcessor processing this command. | 33 | * @param processor - The CommandListProcessor processing this command. |
| 33 | */ | 34 | */ |
| 34 | void Process(const ADSP::CommandListProcessor& processor) override; | 35 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 35 | 36 | ||
| 36 | /** | 37 | /** |
| 37 | * Verify this command's data is valid. | 38 | * Verify this command's data is valid. |
| @@ -39,7 +40,7 @@ struct VolumeRampCommand : ICommand { | |||
| 39 | * @param processor - The CommandListProcessor processing this command. | 40 | * @param processor - The CommandListProcessor processing this command. |
| 40 | * @return True if the command is valid, otherwise false. | 41 | * @return True if the command is valid, otherwise false. |
| 41 | */ | 42 | */ |
| 42 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 43 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 43 | 44 | ||
| 44 | /// Fixed point precision | 45 | /// Fixed point precision |
| 45 | u8 precision; | 46 | u8 precision; |
| @@ -53,4 +54,4 @@ struct VolumeRampCommand : ICommand { | |||
| 53 | f32 volume; | 54 | f32 volume; |
| 54 | }; | 55 | }; |
| 55 | 56 | ||
| 56 | } // namespace AudioCore::AudioRenderer | 57 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/performance/performance.cpp b/src/audio_core/renderer/command/performance/performance.cpp index 4a881547f..f0cfcc9fd 100644 --- a/src/audio_core/renderer/command/performance/performance.cpp +++ b/src/audio_core/renderer/command/performance/performance.cpp | |||
| @@ -1,25 +1,25 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/adsp/command_list_processor.h" | 4 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" |
| 5 | #include "audio_core/renderer/command/performance/performance.h" | 5 | #include "audio_core/renderer/command/performance/performance.h" |
| 6 | #include "core/core.h" | 6 | #include "core/core.h" |
| 7 | #include "core/core_timing.h" | 7 | #include "core/core_timing.h" |
| 8 | 8 | ||
| 9 | namespace AudioCore::AudioRenderer { | 9 | namespace AudioCore::Renderer { |
| 10 | 10 | ||
| 11 | void PerformanceCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, | 11 | void PerformanceCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, |
| 12 | std::string& string) { | 12 | std::string& string) { |
| 13 | string += fmt::format("PerformanceCommand\n\tstate {}\n", static_cast<u32>(state)); | 13 | string += fmt::format("PerformanceCommand\n\tstate {}\n", static_cast<u32>(state)); |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | void PerformanceCommand::Process(const ADSP::CommandListProcessor& processor) { | 16 | void PerformanceCommand::Process(const AudioRenderer::CommandListProcessor& processor) { |
| 17 | auto base{entry_address.translated_address}; | 17 | auto base{entry_address.translated_address}; |
| 18 | if (state == PerformanceState::Start) { | 18 | if (state == PerformanceState::Start) { |
| 19 | auto start_time_ptr{reinterpret_cast<u32*>(base + entry_address.entry_start_time_offset)}; | 19 | auto start_time_ptr{reinterpret_cast<u32*>(base + entry_address.entry_start_time_offset)}; |
| 20 | *start_time_ptr = | 20 | *start_time_ptr = |
| 21 | static_cast<u32>(processor.system->CoreTiming().GetClockTicks() - processor.start_time - | 21 | static_cast<u32>(processor.system->CoreTiming().GetGlobalTimeUs().count() - |
| 22 | processor.current_processing_time); | 22 | processor.start_time - processor.current_processing_time); |
| 23 | } else if (state == PerformanceState::Stop) { | 23 | } else if (state == PerformanceState::Stop) { |
| 24 | auto processed_time_ptr{ | 24 | auto processed_time_ptr{ |
| 25 | reinterpret_cast<u32*>(base + entry_address.entry_processed_time_offset)}; | 25 | reinterpret_cast<u32*>(base + entry_address.entry_processed_time_offset)}; |
| @@ -27,14 +27,14 @@ void PerformanceCommand::Process(const ADSP::CommandListProcessor& processor) { | |||
| 27 | reinterpret_cast<u32*>(base + entry_address.header_entry_count_offset)}; | 27 | reinterpret_cast<u32*>(base + entry_address.header_entry_count_offset)}; |
| 28 | 28 | ||
| 29 | *processed_time_ptr = | 29 | *processed_time_ptr = |
| 30 | static_cast<u32>(processor.system->CoreTiming().GetClockTicks() - processor.start_time - | 30 | static_cast<u32>(processor.system->CoreTiming().GetGlobalTimeUs().count() - |
| 31 | processor.current_processing_time); | 31 | processor.start_time - processor.current_processing_time); |
| 32 | (*entry_count_ptr)++; | 32 | (*entry_count_ptr)++; |
| 33 | } | 33 | } |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | bool PerformanceCommand::Verify(const ADSP::CommandListProcessor& processor) { | 36 | bool PerformanceCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { |
| 37 | return true; | 37 | return true; |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | } // namespace AudioCore::AudioRenderer | 40 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/performance/performance.h b/src/audio_core/renderer/command/performance/performance.h index 11a7d6c08..522e51e34 100644 --- a/src/audio_core/renderer/command/performance/performance.h +++ b/src/audio_core/renderer/command/performance/performance.h | |||
| @@ -10,11 +10,12 @@ | |||
| 10 | #include "audio_core/renderer/performance/performance_manager.h" | 10 | #include "audio_core/renderer/performance/performance_manager.h" |
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | 12 | ||
| 13 | namespace AudioCore::AudioRenderer { | 13 | namespace AudioCore::ADSP::AudioRenderer { |
| 14 | namespace ADSP { | ||
| 15 | class CommandListProcessor; | 14 | class CommandListProcessor; |
| 16 | } | 15 | } |
| 17 | 16 | ||
| 17 | namespace AudioCore::Renderer { | ||
| 18 | |||
| 18 | /** | 19 | /** |
| 19 | * AudioRenderer command for writing AudioRenderer performance metrics back to the sysmodule. | 20 | * AudioRenderer command for writing AudioRenderer performance metrics back to the sysmodule. |
| 20 | */ | 21 | */ |
| @@ -25,14 +26,14 @@ struct PerformanceCommand : ICommand { | |||
| 25 | * @param processor - The CommandListProcessor processing this command. | 26 | * @param processor - The CommandListProcessor processing this command. |
| 26 | * @param string - The string to print into. | 27 | * @param string - The string to print into. |
| 27 | */ | 28 | */ |
| 28 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 29 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 29 | 30 | ||
| 30 | /** | 31 | /** |
| 31 | * Process this command. | 32 | * Process this command. |
| 32 | * | 33 | * |
| 33 | * @param processor - The CommandListProcessor processing this command. | 34 | * @param processor - The CommandListProcessor processing this command. |
| 34 | */ | 35 | */ |
| 35 | void Process(const ADSP::CommandListProcessor& processor) override; | 36 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 36 | 37 | ||
| 37 | /** | 38 | /** |
| 38 | * Verify this command's data is valid. | 39 | * Verify this command's data is valid. |
| @@ -40,7 +41,7 @@ struct PerformanceCommand : ICommand { | |||
| 40 | * @param processor - The CommandListProcessor processing this command. | 41 | * @param processor - The CommandListProcessor processing this command. |
| 41 | * @return True if the command is valid, otherwise false. | 42 | * @return True if the command is valid, otherwise false. |
| 42 | */ | 43 | */ |
| 43 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 44 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 44 | 45 | ||
| 45 | /// State of the performance | 46 | /// State of the performance |
| 46 | PerformanceState state; | 47 | PerformanceState state; |
| @@ -48,4 +49,4 @@ struct PerformanceCommand : ICommand { | |||
| 48 | PerformanceEntryAddresses entry_address; | 49 | PerformanceEntryAddresses entry_address; |
| 49 | }; | 50 | }; |
| 50 | 51 | ||
| 51 | } // namespace AudioCore::AudioRenderer | 52 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/resample/downmix_6ch_to_2ch.cpp b/src/audio_core/renderer/command/resample/downmix_6ch_to_2ch.cpp index 1fd90308a..f9b289887 100644 --- a/src/audio_core/renderer/command/resample/downmix_6ch_to_2ch.cpp +++ b/src/audio_core/renderer/command/resample/downmix_6ch_to_2ch.cpp | |||
| @@ -1,13 +1,13 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/adsp/command_list_processor.h" | 4 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" |
| 5 | #include "audio_core/renderer/command/resample/downmix_6ch_to_2ch.h" | 5 | #include "audio_core/renderer/command/resample/downmix_6ch_to_2ch.h" |
| 6 | 6 | ||
| 7 | namespace AudioCore::AudioRenderer { | 7 | namespace AudioCore::Renderer { |
| 8 | 8 | ||
| 9 | void DownMix6chTo2chCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, | 9 | void DownMix6chTo2chCommand::Dump( |
| 10 | std::string& string) { | 10 | [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { |
| 11 | string += fmt::format("DownMix6chTo2chCommand\n\tinputs: "); | 11 | string += fmt::format("DownMix6chTo2chCommand\n\tinputs: "); |
| 12 | for (u32 i = 0; i < MaxChannels; i++) { | 12 | for (u32 i = 0; i < MaxChannels; i++) { |
| 13 | string += fmt::format("{:02X}, ", inputs[i]); | 13 | string += fmt::format("{:02X}, ", inputs[i]); |
| @@ -19,7 +19,7 @@ void DownMix6chTo2chCommand::Dump([[maybe_unused]] const ADSP::CommandListProces | |||
| 19 | string += "\n"; | 19 | string += "\n"; |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | void DownMix6chTo2chCommand::Process(const ADSP::CommandListProcessor& processor) { | 22 | void DownMix6chTo2chCommand::Process(const AudioRenderer::CommandListProcessor& processor) { |
| 23 | auto in_front_left{ | 23 | auto in_front_left{ |
| 24 | processor.mix_buffers.subspan(inputs[0] * processor.sample_count, processor.sample_count)}; | 24 | processor.mix_buffers.subspan(inputs[0] * processor.sample_count, processor.sample_count)}; |
| 25 | auto in_front_right{ | 25 | auto in_front_right{ |
| @@ -67,8 +67,8 @@ void DownMix6chTo2chCommand::Process(const ADSP::CommandListProcessor& processor | |||
| 67 | std::memset(out_back_right.data(), 0, out_back_right.size_bytes()); | 67 | std::memset(out_back_right.data(), 0, out_back_right.size_bytes()); |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | bool DownMix6chTo2chCommand::Verify(const ADSP::CommandListProcessor& processor) { | 70 | bool DownMix6chTo2chCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { |
| 71 | return true; | 71 | return true; |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | } // namespace AudioCore::AudioRenderer | 74 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/resample/downmix_6ch_to_2ch.h b/src/audio_core/renderer/command/resample/downmix_6ch_to_2ch.h index dc133a73b..96cbc5506 100644 --- a/src/audio_core/renderer/command/resample/downmix_6ch_to_2ch.h +++ b/src/audio_core/renderer/command/resample/downmix_6ch_to_2ch.h | |||
| @@ -9,11 +9,12 @@ | |||
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | #include "common/fixed_point.h" | 10 | #include "common/fixed_point.h" |
| 11 | 11 | ||
| 12 | namespace AudioCore::AudioRenderer { | 12 | namespace AudioCore::ADSP::AudioRenderer { |
| 13 | namespace ADSP { | ||
| 14 | class CommandListProcessor; | 13 | class CommandListProcessor; |
| 15 | } | 14 | } |
| 16 | 15 | ||
| 16 | namespace AudioCore::Renderer { | ||
| 17 | |||
| 17 | /** | 18 | /** |
| 18 | * AudioRenderer command for downmixing 6 channels to 2. | 19 | * AudioRenderer command for downmixing 6 channels to 2. |
| 19 | * Channel layout (SMPTE): | 20 | * Channel layout (SMPTE): |
| @@ -31,14 +32,14 @@ struct DownMix6chTo2chCommand : ICommand { | |||
| 31 | * @param processor - The CommandListProcessor processing this command. | 32 | * @param processor - The CommandListProcessor processing this command. |
| 32 | * @param string - The string to print into. | 33 | * @param string - The string to print into. |
| 33 | */ | 34 | */ |
| 34 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 35 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 35 | 36 | ||
| 36 | /** | 37 | /** |
| 37 | * Process this command. | 38 | * Process this command. |
| 38 | * | 39 | * |
| 39 | * @param processor - The CommandListProcessor processing this command. | 40 | * @param processor - The CommandListProcessor processing this command. |
| 40 | */ | 41 | */ |
| 41 | void Process(const ADSP::CommandListProcessor& processor) override; | 42 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 42 | 43 | ||
| 43 | /** | 44 | /** |
| 44 | * Verify this command's data is valid. | 45 | * Verify this command's data is valid. |
| @@ -46,7 +47,7 @@ struct DownMix6chTo2chCommand : ICommand { | |||
| 46 | * @param processor - The CommandListProcessor processing this command. | 47 | * @param processor - The CommandListProcessor processing this command. |
| 47 | * @return True if the command is valid, otherwise false. | 48 | * @return True if the command is valid, otherwise false. |
| 48 | */ | 49 | */ |
| 49 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 50 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 50 | 51 | ||
| 51 | /// Input mix buffer offsets for each channel | 52 | /// Input mix buffer offsets for each channel |
| 52 | std::array<s16, MaxChannels> inputs; | 53 | std::array<s16, MaxChannels> inputs; |
| @@ -56,4 +57,4 @@ struct DownMix6chTo2chCommand : ICommand { | |||
| 56 | std::array<Common::FixedPoint<48, 16>, 4> down_mix_coeff; | 57 | std::array<Common::FixedPoint<48, 16>, 4> down_mix_coeff; |
| 57 | }; | 58 | }; |
| 58 | 59 | ||
| 59 | } // namespace AudioCore::AudioRenderer | 60 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/resample/resample.cpp b/src/audio_core/renderer/command/resample/resample.cpp index 070c9d2b8..51f4ba39e 100644 --- a/src/audio_core/renderer/command/resample/resample.cpp +++ b/src/audio_core/renderer/command/resample/resample.cpp | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/command/resample/resample.h" | 4 | #include "audio_core/renderer/command/resample/resample.h" |
| 5 | 5 | ||
| 6 | namespace AudioCore::AudioRenderer { | 6 | namespace AudioCore::Renderer { |
| 7 | 7 | ||
| 8 | static void ResampleLowQuality(std::span<s32> output, std::span<const s16> input, | 8 | static void ResampleLowQuality(std::span<s32> output, std::span<const s16> input, |
| 9 | const Common::FixedPoint<49, 15>& sample_rate_ratio, | 9 | const Common::FixedPoint<49, 15>& sample_rate_ratio, |
| @@ -880,4 +880,4 @@ void Resample(std::span<s32> output, std::span<const s16> input, | |||
| 880 | } | 880 | } |
| 881 | } | 881 | } |
| 882 | 882 | ||
| 883 | } // namespace AudioCore::AudioRenderer | 883 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/resample/resample.h b/src/audio_core/renderer/command/resample/resample.h index ba9209b82..134aff0c9 100644 --- a/src/audio_core/renderer/command/resample/resample.h +++ b/src/audio_core/renderer/command/resample/resample.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | #include "common/fixed_point.h" | 10 | #include "common/fixed_point.h" |
| 11 | 11 | ||
| 12 | namespace AudioCore::AudioRenderer { | 12 | namespace AudioCore::Renderer { |
| 13 | /** | 13 | /** |
| 14 | * Resample an input buffer into an output buffer, according to the sample_rate_ratio. | 14 | * Resample an input buffer into an output buffer, according to the sample_rate_ratio. |
| 15 | * | 15 | * |
| @@ -26,4 +26,4 @@ void Resample(std::span<s32> output, std::span<const s16> input, | |||
| 26 | const Common::FixedPoint<49, 15>& sample_rate_ratio, | 26 | const Common::FixedPoint<49, 15>& sample_rate_ratio, |
| 27 | Common::FixedPoint<49, 15>& fraction, u32 samples_to_write, SrcQuality src_quality); | 27 | Common::FixedPoint<49, 15>& fraction, u32 samples_to_write, SrcQuality src_quality); |
| 28 | 28 | ||
| 29 | } // namespace AudioCore::AudioRenderer | 29 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/resample/upsample.cpp b/src/audio_core/renderer/command/resample/upsample.cpp index 86ddee1a4..691d70390 100644 --- a/src/audio_core/renderer/command/resample/upsample.cpp +++ b/src/audio_core/renderer/command/resample/upsample.cpp | |||
| @@ -3,11 +3,11 @@ | |||
| 3 | 3 | ||
| 4 | #include <array> | 4 | #include <array> |
| 5 | 5 | ||
| 6 | #include "audio_core/renderer/adsp/command_list_processor.h" | 6 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" |
| 7 | #include "audio_core/renderer/command/resample/upsample.h" | 7 | #include "audio_core/renderer/command/resample/upsample.h" |
| 8 | #include "audio_core/renderer/upsampler/upsampler_info.h" | 8 | #include "audio_core/renderer/upsampler/upsampler_info.h" |
| 9 | 9 | ||
| 10 | namespace AudioCore::AudioRenderer { | 10 | namespace AudioCore::Renderer { |
| 11 | /** | 11 | /** |
| 12 | * Upsampling impl. Input must be 8K, 16K or 32K, output is 48K. | 12 | * Upsampling impl. Input must be 8K, 16K or 32K, output is 48K. |
| 13 | * | 13 | * |
| @@ -198,7 +198,7 @@ static void SrcProcessFrame(std::span<s32> output, std::span<const s32> input, | |||
| 198 | } | 198 | } |
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | auto UpsampleCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, | 201 | auto UpsampleCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, |
| 202 | std::string& string) -> void { | 202 | std::string& string) -> void { |
| 203 | string += fmt::format("UpsampleCommand\n\tsource_sample_count {} source_sample_rate {}", | 203 | string += fmt::format("UpsampleCommand\n\tsource_sample_count {} source_sample_rate {}", |
| 204 | source_sample_count, source_sample_rate); | 204 | source_sample_count, source_sample_rate); |
| @@ -213,7 +213,7 @@ auto UpsampleCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& pr | |||
| 213 | string += "\n"; | 213 | string += "\n"; |
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | void UpsampleCommand::Process(const ADSP::CommandListProcessor& processor) { | 216 | void UpsampleCommand::Process(const AudioRenderer::CommandListProcessor& processor) { |
| 217 | const auto info{reinterpret_cast<UpsamplerInfo*>(upsampler_info)}; | 217 | const auto info{reinterpret_cast<UpsamplerInfo*>(upsampler_info)}; |
| 218 | const auto input_count{std::min(info->input_count, buffer_count)}; | 218 | const auto input_count{std::min(info->input_count, buffer_count)}; |
| 219 | const std::span<const s16> inputs_{reinterpret_cast<const s16*>(inputs), input_count}; | 219 | const std::span<const s16> inputs_{reinterpret_cast<const s16*>(inputs), input_count}; |
| @@ -234,8 +234,8 @@ void UpsampleCommand::Process(const ADSP::CommandListProcessor& processor) { | |||
| 234 | } | 234 | } |
| 235 | } | 235 | } |
| 236 | 236 | ||
| 237 | bool UpsampleCommand::Verify(const ADSP::CommandListProcessor& processor) { | 237 | bool UpsampleCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { |
| 238 | return true; | 238 | return true; |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | } // namespace AudioCore::AudioRenderer | 241 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/resample/upsample.h b/src/audio_core/renderer/command/resample/upsample.h index bfc94e8af..877271ba9 100644 --- a/src/audio_core/renderer/command/resample/upsample.h +++ b/src/audio_core/renderer/command/resample/upsample.h | |||
| @@ -8,11 +8,12 @@ | |||
| 8 | #include "audio_core/renderer/command/icommand.h" | 8 | #include "audio_core/renderer/command/icommand.h" |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | 10 | ||
| 11 | namespace AudioCore::AudioRenderer { | 11 | namespace AudioCore::ADSP::AudioRenderer { |
| 12 | namespace ADSP { | ||
| 13 | class CommandListProcessor; | 12 | class CommandListProcessor; |
| 14 | } | 13 | } |
| 15 | 14 | ||
| 15 | namespace AudioCore::Renderer { | ||
| 16 | |||
| 16 | /** | 17 | /** |
| 17 | * AudioRenderer command for upsampling a mix buffer to 48Khz. | 18 | * AudioRenderer command for upsampling a mix buffer to 48Khz. |
| 18 | * Input must be 8Khz, 16Khz or 32Khz, and output will be 48Khz. | 19 | * Input must be 8Khz, 16Khz or 32Khz, and output will be 48Khz. |
| @@ -24,14 +25,14 @@ struct UpsampleCommand : ICommand { | |||
| 24 | * @param processor - The CommandListProcessor processing this command. | 25 | * @param processor - The CommandListProcessor processing this command. |
| 25 | * @param string - The string to print into. | 26 | * @param string - The string to print into. |
| 26 | */ | 27 | */ |
| 27 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 28 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 28 | 29 | ||
| 29 | /** | 30 | /** |
| 30 | * Process this command. | 31 | * Process this command. |
| 31 | * | 32 | * |
| 32 | * @param processor - The CommandListProcessor processing this command. | 33 | * @param processor - The CommandListProcessor processing this command. |
| 33 | */ | 34 | */ |
| 34 | void Process(const ADSP::CommandListProcessor& processor) override; | 35 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 35 | 36 | ||
| 36 | /** | 37 | /** |
| 37 | * Verify this command's data is valid. | 38 | * Verify this command's data is valid. |
| @@ -39,7 +40,7 @@ struct UpsampleCommand : ICommand { | |||
| 39 | * @param processor - The CommandListProcessor processing this command. | 40 | * @param processor - The CommandListProcessor processing this command. |
| 40 | * @return True if the command is valid, otherwise false. | 41 | * @return True if the command is valid, otherwise false. |
| 41 | */ | 42 | */ |
| 42 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 43 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 43 | 44 | ||
| 44 | /// Pointer to the output samples buffer. | 45 | /// Pointer to the output samples buffer. |
| 45 | CpuAddr samples_buffer; | 46 | CpuAddr samples_buffer; |
| @@ -57,4 +58,4 @@ struct UpsampleCommand : ICommand { | |||
| 57 | CpuAddr upsampler_info; | 58 | CpuAddr upsampler_info; |
| 58 | }; | 59 | }; |
| 59 | 60 | ||
| 60 | } // namespace AudioCore::AudioRenderer | 61 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/sink/circular_buffer.cpp b/src/audio_core/renderer/command/sink/circular_buffer.cpp index e2ce59792..e056d15a6 100644 --- a/src/audio_core/renderer/command/sink/circular_buffer.cpp +++ b/src/audio_core/renderer/command/sink/circular_buffer.cpp | |||
| @@ -3,14 +3,14 @@ | |||
| 3 | 3 | ||
| 4 | #include <vector> | 4 | #include <vector> |
| 5 | 5 | ||
| 6 | #include "audio_core/renderer/adsp/command_list_processor.h" | 6 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" |
| 7 | #include "audio_core/renderer/command/sink/circular_buffer.h" | 7 | #include "audio_core/renderer/command/sink/circular_buffer.h" |
| 8 | #include "core/memory.h" | 8 | #include "core/memory.h" |
| 9 | 9 | ||
| 10 | namespace AudioCore::AudioRenderer { | 10 | namespace AudioCore::Renderer { |
| 11 | 11 | ||
| 12 | void CircularBufferSinkCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, | 12 | void CircularBufferSinkCommand::Dump( |
| 13 | std::string& string) { | 13 | [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { |
| 14 | string += fmt::format( | 14 | string += fmt::format( |
| 15 | "CircularBufferSinkCommand\n\tinput_count {} ring size {:04X} ring pos {:04X}\n\tinputs: ", | 15 | "CircularBufferSinkCommand\n\tinput_count {} ring size {:04X} ring pos {:04X}\n\tinputs: ", |
| 16 | input_count, size, pos); | 16 | input_count, size, pos); |
| @@ -20,7 +20,7 @@ void CircularBufferSinkCommand::Dump([[maybe_unused]] const ADSP::CommandListPro | |||
| 20 | string += "\n"; | 20 | string += "\n"; |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | void CircularBufferSinkCommand::Process(const ADSP::CommandListProcessor& processor) { | 23 | void CircularBufferSinkCommand::Process(const AudioRenderer::CommandListProcessor& processor) { |
| 24 | constexpr s32 min{std::numeric_limits<s16>::min()}; | 24 | constexpr s32 min{std::numeric_limits<s16>::min()}; |
| 25 | constexpr s32 max{std::numeric_limits<s16>::max()}; | 25 | constexpr s32 max{std::numeric_limits<s16>::max()}; |
| 26 | 26 | ||
| @@ -41,8 +41,8 @@ void CircularBufferSinkCommand::Process(const ADSP::CommandListProcessor& proces | |||
| 41 | } | 41 | } |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | bool CircularBufferSinkCommand::Verify(const ADSP::CommandListProcessor& processor) { | 44 | bool CircularBufferSinkCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { |
| 45 | return true; | 45 | return true; |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | } // namespace AudioCore::AudioRenderer | 48 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/sink/circular_buffer.h b/src/audio_core/renderer/command/sink/circular_buffer.h index e7d5be26e..a3234a406 100644 --- a/src/audio_core/renderer/command/sink/circular_buffer.h +++ b/src/audio_core/renderer/command/sink/circular_buffer.h | |||
| @@ -8,11 +8,12 @@ | |||
| 8 | #include "audio_core/renderer/command/icommand.h" | 8 | #include "audio_core/renderer/command/icommand.h" |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | 10 | ||
| 11 | namespace AudioCore::AudioRenderer { | 11 | namespace AudioCore::ADSP::AudioRenderer { |
| 12 | namespace ADSP { | ||
| 13 | class CommandListProcessor; | 12 | class CommandListProcessor; |
| 14 | } | 13 | } |
| 15 | 14 | ||
| 15 | namespace AudioCore::Renderer { | ||
| 16 | |||
| 16 | /** | 17 | /** |
| 17 | * AudioRenderer command for sinking samples to a circular buffer. | 18 | * AudioRenderer command for sinking samples to a circular buffer. |
| 18 | */ | 19 | */ |
| @@ -23,14 +24,14 @@ struct CircularBufferSinkCommand : ICommand { | |||
| 23 | * @param processor - The CommandListProcessor processing this command. | 24 | * @param processor - The CommandListProcessor processing this command. |
| 24 | * @param string - The string to print into. | 25 | * @param string - The string to print into. |
| 25 | */ | 26 | */ |
| 26 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 27 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 27 | 28 | ||
| 28 | /** | 29 | /** |
| 29 | * Process this command. | 30 | * Process this command. |
| 30 | * | 31 | * |
| 31 | * @param processor - The CommandListProcessor processing this command. | 32 | * @param processor - The CommandListProcessor processing this command. |
| 32 | */ | 33 | */ |
| 33 | void Process(const ADSP::CommandListProcessor& processor) override; | 34 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 34 | 35 | ||
| 35 | /** | 36 | /** |
| 36 | * Verify this command's data is valid. | 37 | * Verify this command's data is valid. |
| @@ -38,7 +39,7 @@ struct CircularBufferSinkCommand : ICommand { | |||
| 38 | * @param processor - The CommandListProcessor processing this command. | 39 | * @param processor - The CommandListProcessor processing this command. |
| 39 | * @return True if the command is valid, otherwise false. | 40 | * @return True if the command is valid, otherwise false. |
| 40 | */ | 41 | */ |
| 41 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 42 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 42 | 43 | ||
| 43 | /// Number of input mix buffers | 44 | /// Number of input mix buffers |
| 44 | u32 input_count; | 45 | u32 input_count; |
| @@ -52,4 +53,4 @@ struct CircularBufferSinkCommand : ICommand { | |||
| 52 | u32 pos; | 53 | u32 pos; |
| 53 | }; | 54 | }; |
| 54 | 55 | ||
| 55 | } // namespace AudioCore::AudioRenderer | 56 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/sink/device.cpp b/src/audio_core/renderer/command/sink/device.cpp index 5f74dd7ad..3480ed475 100644 --- a/src/audio_core/renderer/command/sink/device.cpp +++ b/src/audio_core/renderer/command/sink/device.cpp | |||
| @@ -3,13 +3,13 @@ | |||
| 3 | 3 | ||
| 4 | #include <algorithm> | 4 | #include <algorithm> |
| 5 | 5 | ||
| 6 | #include "audio_core/renderer/adsp/command_list_processor.h" | 6 | #include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" |
| 7 | #include "audio_core/renderer/command/sink/device.h" | 7 | #include "audio_core/renderer/command/sink/device.h" |
| 8 | #include "audio_core/sink/sink.h" | 8 | #include "audio_core/sink/sink.h" |
| 9 | 9 | ||
| 10 | namespace AudioCore::AudioRenderer { | 10 | namespace AudioCore::Renderer { |
| 11 | 11 | ||
| 12 | void DeviceSinkCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, | 12 | void DeviceSinkCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, |
| 13 | std::string& string) { | 13 | std::string& string) { |
| 14 | string += fmt::format("DeviceSinkCommand\n\t{} session {} input_count {}\n\tinputs: ", | 14 | string += fmt::format("DeviceSinkCommand\n\t{} session {} input_count {}\n\tinputs: ", |
| 15 | std::string_view(name), session_id, input_count); | 15 | std::string_view(name), session_id, input_count); |
| @@ -19,7 +19,7 @@ void DeviceSinkCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& | |||
| 19 | string += "\n"; | 19 | string += "\n"; |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | void DeviceSinkCommand::Process(const ADSP::CommandListProcessor& processor) { | 22 | void DeviceSinkCommand::Process(const AudioRenderer::CommandListProcessor& processor) { |
| 23 | constexpr s32 min = std::numeric_limits<s16>::min(); | 23 | constexpr s32 min = std::numeric_limits<s16>::min(); |
| 24 | constexpr s32 max = std::numeric_limits<s16>::max(); | 24 | constexpr s32 max = std::numeric_limits<s16>::max(); |
| 25 | 25 | ||
| @@ -51,8 +51,8 @@ void DeviceSinkCommand::Process(const ADSP::CommandListProcessor& processor) { | |||
| 51 | } | 51 | } |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | bool DeviceSinkCommand::Verify(const ADSP::CommandListProcessor& processor) { | 54 | bool DeviceSinkCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { |
| 55 | return true; | 55 | return true; |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | } // namespace AudioCore::AudioRenderer | 58 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/command/sink/device.h b/src/audio_core/renderer/command/sink/device.h index 1099bcf8c..385b51ecc 100644 --- a/src/audio_core/renderer/command/sink/device.h +++ b/src/audio_core/renderer/command/sink/device.h | |||
| @@ -10,11 +10,12 @@ | |||
| 10 | #include "audio_core/renderer/command/icommand.h" | 10 | #include "audio_core/renderer/command/icommand.h" |
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | 12 | ||
| 13 | namespace AudioCore::AudioRenderer { | 13 | namespace AudioCore::ADSP::AudioRenderer { |
| 14 | namespace ADSP { | ||
| 15 | class CommandListProcessor; | 14 | class CommandListProcessor; |
| 16 | } | 15 | } |
| 17 | 16 | ||
| 17 | namespace AudioCore::Renderer { | ||
| 18 | |||
| 18 | /** | 19 | /** |
| 19 | * AudioRenderer command for sinking samples to an output device. | 20 | * AudioRenderer command for sinking samples to an output device. |
| 20 | */ | 21 | */ |
| @@ -25,14 +26,14 @@ struct DeviceSinkCommand : ICommand { | |||
| 25 | * @param processor - The CommandListProcessor processing this command. | 26 | * @param processor - The CommandListProcessor processing this command. |
| 26 | * @param string - The string to print into. | 27 | * @param string - The string to print into. |
| 27 | */ | 28 | */ |
| 28 | void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; | 29 | void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; |
| 29 | 30 | ||
| 30 | /** | 31 | /** |
| 31 | * Process this command. | 32 | * Process this command. |
| 32 | * | 33 | * |
| 33 | * @param processor - The CommandListProcessor processing this command. | 34 | * @param processor - The CommandListProcessor processing this command. |
| 34 | */ | 35 | */ |
| 35 | void Process(const ADSP::CommandListProcessor& processor) override; | 36 | void Process(const AudioRenderer::CommandListProcessor& processor) override; |
| 36 | 37 | ||
| 37 | /** | 38 | /** |
| 38 | * Verify this command's data is valid. | 39 | * Verify this command's data is valid. |
| @@ -40,7 +41,7 @@ struct DeviceSinkCommand : ICommand { | |||
| 40 | * @param processor - The CommandListProcessor processing this command. | 41 | * @param processor - The CommandListProcessor processing this command. |
| 41 | * @return True if the command is valid, otherwise false. | 42 | * @return True if the command is valid, otherwise false. |
| 42 | */ | 43 | */ |
| 43 | bool Verify(const ADSP::CommandListProcessor& processor) override; | 44 | bool Verify(const AudioRenderer::CommandListProcessor& processor) override; |
| 44 | 45 | ||
| 45 | /// Device name | 46 | /// Device name |
| 46 | char name[0x100]; | 47 | char name[0x100]; |
| @@ -54,4 +55,4 @@ struct DeviceSinkCommand : ICommand { | |||
| 54 | std::array<s16, MaxChannels> inputs; | 55 | std::array<s16, MaxChannels> inputs; |
| 55 | }; | 56 | }; |
| 56 | 57 | ||
| 57 | } // namespace AudioCore::AudioRenderer | 58 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/effect/aux_.cpp b/src/audio_core/renderer/effect/aux_.cpp index 51e780ef1..1c1411eff 100644 --- a/src/audio_core/renderer/effect/aux_.cpp +++ b/src/audio_core/renderer/effect/aux_.cpp | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/effect/aux_.h" | 4 | #include "audio_core/renderer/effect/aux_.h" |
| 5 | 5 | ||
| 6 | namespace AudioCore::AudioRenderer { | 6 | namespace AudioCore::Renderer { |
| 7 | 7 | ||
| 8 | void AuxInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params, | 8 | void AuxInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params, |
| 9 | const PoolMapper& pool_mapper) { | 9 | const PoolMapper& pool_mapper) { |
| @@ -90,4 +90,4 @@ CpuAddr AuxInfo::GetWorkbuffer(s32 index) { | |||
| 90 | return workbuffers[index].GetReference(true); | 90 | return workbuffers[index].GetReference(true); |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | } // namespace AudioCore::AudioRenderer | 93 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/effect/aux_.h b/src/audio_core/renderer/effect/aux_.h index 4d3d9e3d9..c5b3058da 100644 --- a/src/audio_core/renderer/effect/aux_.h +++ b/src/audio_core/renderer/effect/aux_.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include "audio_core/renderer/effect/effect_info_base.h" | 9 | #include "audio_core/renderer/effect/effect_info_base.h" |
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | 11 | ||
| 12 | namespace AudioCore::AudioRenderer { | 12 | namespace AudioCore::Renderer { |
| 13 | /** | 13 | /** |
| 14 | * Auxiliary Buffer used for Aux commands. | 14 | * Auxiliary Buffer used for Aux commands. |
| 15 | * Send and return buffers are available (names from the game's perspective). | 15 | * Send and return buffers are available (names from the game's perspective). |
| @@ -120,4 +120,4 @@ public: | |||
| 120 | CpuAddr GetWorkbuffer(s32 index) override; | 120 | CpuAddr GetWorkbuffer(s32 index) override; |
| 121 | }; | 121 | }; |
| 122 | 122 | ||
| 123 | } // namespace AudioCore::AudioRenderer | 123 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/effect/biquad_filter.cpp b/src/audio_core/renderer/effect/biquad_filter.cpp index a1efb3231..08161d840 100644 --- a/src/audio_core/renderer/effect/biquad_filter.cpp +++ b/src/audio_core/renderer/effect/biquad_filter.cpp | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/effect/biquad_filter.h" | 4 | #include "audio_core/renderer/effect/biquad_filter.h" |
| 5 | 5 | ||
| 6 | namespace AudioCore::AudioRenderer { | 6 | namespace AudioCore::Renderer { |
| 7 | 7 | ||
| 8 | void BiquadFilterInfo::Update(BehaviorInfo::ErrorInfo& error_info, | 8 | void BiquadFilterInfo::Update(BehaviorInfo::ErrorInfo& error_info, |
| 9 | const InParameterVersion1& in_params, const PoolMapper& pool_mapper) { | 9 | const InParameterVersion1& in_params, const PoolMapper& pool_mapper) { |
| @@ -49,4 +49,4 @@ void BiquadFilterInfo::InitializeResultState(EffectResultState& result_state) {} | |||
| 49 | void BiquadFilterInfo::UpdateResultState(EffectResultState& cpu_state, | 49 | void BiquadFilterInfo::UpdateResultState(EffectResultState& cpu_state, |
| 50 | EffectResultState& dsp_state) {} | 50 | EffectResultState& dsp_state) {} |
| 51 | 51 | ||
| 52 | } // namespace AudioCore::AudioRenderer | 52 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/effect/biquad_filter.h b/src/audio_core/renderer/effect/biquad_filter.h index f53fd5bab..5a22899ab 100644 --- a/src/audio_core/renderer/effect/biquad_filter.h +++ b/src/audio_core/renderer/effect/biquad_filter.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include "audio_core/renderer/effect/effect_info_base.h" | 9 | #include "audio_core/renderer/effect/effect_info_base.h" |
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | 11 | ||
| 12 | namespace AudioCore::AudioRenderer { | 12 | namespace AudioCore::Renderer { |
| 13 | 13 | ||
| 14 | class BiquadFilterInfo : public EffectInfoBase { | 14 | class BiquadFilterInfo : public EffectInfoBase { |
| 15 | public: | 15 | public: |
| @@ -76,4 +76,4 @@ public: | |||
| 76 | void UpdateResultState(EffectResultState& cpu_state, EffectResultState& dsp_state) override; | 76 | void UpdateResultState(EffectResultState& cpu_state, EffectResultState& dsp_state) override; |
| 77 | }; | 77 | }; |
| 78 | 78 | ||
| 79 | } // namespace AudioCore::AudioRenderer | 79 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/effect/buffer_mixer.cpp b/src/audio_core/renderer/effect/buffer_mixer.cpp index 9c8877f01..826e246ec 100644 --- a/src/audio_core/renderer/effect/buffer_mixer.cpp +++ b/src/audio_core/renderer/effect/buffer_mixer.cpp | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/effect/buffer_mixer.h" | 4 | #include "audio_core/renderer/effect/buffer_mixer.h" |
| 5 | 5 | ||
| 6 | namespace AudioCore::AudioRenderer { | 6 | namespace AudioCore::Renderer { |
| 7 | 7 | ||
| 8 | void BufferMixerInfo::Update(BehaviorInfo::ErrorInfo& error_info, | 8 | void BufferMixerInfo::Update(BehaviorInfo::ErrorInfo& error_info, |
| 9 | const InParameterVersion1& in_params, const PoolMapper& pool_mapper) { | 9 | const InParameterVersion1& in_params, const PoolMapper& pool_mapper) { |
| @@ -46,4 +46,4 @@ void BufferMixerInfo::InitializeResultState(EffectResultState& result_state) {} | |||
| 46 | void BufferMixerInfo::UpdateResultState(EffectResultState& cpu_state, | 46 | void BufferMixerInfo::UpdateResultState(EffectResultState& cpu_state, |
| 47 | EffectResultState& dsp_state) {} | 47 | EffectResultState& dsp_state) {} |
| 48 | 48 | ||
| 49 | } // namespace AudioCore::AudioRenderer | 49 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/effect/buffer_mixer.h b/src/audio_core/renderer/effect/buffer_mixer.h index 23eed4a8b..0c01ef38d 100644 --- a/src/audio_core/renderer/effect/buffer_mixer.h +++ b/src/audio_core/renderer/effect/buffer_mixer.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include "audio_core/renderer/effect/effect_info_base.h" | 9 | #include "audio_core/renderer/effect/effect_info_base.h" |
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | 11 | ||
| 12 | namespace AudioCore::AudioRenderer { | 12 | namespace AudioCore::Renderer { |
| 13 | 13 | ||
| 14 | class BufferMixerInfo : public EffectInfoBase { | 14 | class BufferMixerInfo : public EffectInfoBase { |
| 15 | public: | 15 | public: |
| @@ -72,4 +72,4 @@ public: | |||
| 72 | void UpdateResultState(EffectResultState& cpu_state, EffectResultState& dsp_state) override; | 72 | void UpdateResultState(EffectResultState& cpu_state, EffectResultState& dsp_state) override; |
| 73 | }; | 73 | }; |
| 74 | 74 | ||
| 75 | } // namespace AudioCore::AudioRenderer | 75 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/effect/capture.cpp b/src/audio_core/renderer/effect/capture.cpp index 3f038efdb..dfa062a59 100644 --- a/src/audio_core/renderer/effect/capture.cpp +++ b/src/audio_core/renderer/effect/capture.cpp | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | #include "audio_core/renderer/effect/aux_.h" | 4 | #include "audio_core/renderer/effect/aux_.h" |
| 5 | #include "audio_core/renderer/effect/capture.h" | 5 | #include "audio_core/renderer/effect/capture.h" |
| 6 | 6 | ||
| 7 | namespace AudioCore::AudioRenderer { | 7 | namespace AudioCore::Renderer { |
| 8 | 8 | ||
| 9 | void CaptureInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params, | 9 | void CaptureInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params, |
| 10 | const PoolMapper& pool_mapper) { | 10 | const PoolMapper& pool_mapper) { |
| @@ -79,4 +79,4 @@ CpuAddr CaptureInfo::GetWorkbuffer(s32 index) { | |||
| 79 | return workbuffers[index].GetReference(true); | 79 | return workbuffers[index].GetReference(true); |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | } // namespace AudioCore::AudioRenderer | 82 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/effect/capture.h b/src/audio_core/renderer/effect/capture.h index 6fbed8e6b..cbe71e22a 100644 --- a/src/audio_core/renderer/effect/capture.h +++ b/src/audio_core/renderer/effect/capture.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include "audio_core/renderer/effect/effect_info_base.h" | 9 | #include "audio_core/renderer/effect/effect_info_base.h" |
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | 11 | ||
| 12 | namespace AudioCore::AudioRenderer { | 12 | namespace AudioCore::Renderer { |
| 13 | 13 | ||
| 14 | class CaptureInfo : public EffectInfoBase { | 14 | class CaptureInfo : public EffectInfoBase { |
| 15 | public: | 15 | public: |
| @@ -62,4 +62,4 @@ public: | |||
| 62 | CpuAddr GetWorkbuffer(s32 index) override; | 62 | CpuAddr GetWorkbuffer(s32 index) override; |
| 63 | }; | 63 | }; |
| 64 | 64 | ||
| 65 | } // namespace AudioCore::AudioRenderer | 65 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/effect/compressor.cpp b/src/audio_core/renderer/effect/compressor.cpp index 220ae02f9..fea0aefcf 100644 --- a/src/audio_core/renderer/effect/compressor.cpp +++ b/src/audio_core/renderer/effect/compressor.cpp | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/effect/compressor.h" | 4 | #include "audio_core/renderer/effect/compressor.h" |
| 5 | 5 | ||
| 6 | namespace AudioCore::AudioRenderer { | 6 | namespace AudioCore::Renderer { |
| 7 | 7 | ||
| 8 | void CompressorInfo::Update(BehaviorInfo::ErrorInfo& error_info, | 8 | void CompressorInfo::Update(BehaviorInfo::ErrorInfo& error_info, |
| 9 | const InParameterVersion1& in_params, const PoolMapper& pool_mapper) {} | 9 | const InParameterVersion1& in_params, const PoolMapper& pool_mapper) {} |
| @@ -37,4 +37,4 @@ CpuAddr CompressorInfo::GetWorkbuffer(s32 index) { | |||
| 37 | return GetSingleBuffer(index); | 37 | return GetSingleBuffer(index); |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | } // namespace AudioCore::AudioRenderer | 40 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/effect/compressor.h b/src/audio_core/renderer/effect/compressor.h index 019a5ae58..cda55c284 100644 --- a/src/audio_core/renderer/effect/compressor.h +++ b/src/audio_core/renderer/effect/compressor.h | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | #include "common/fixed_point.h" | 11 | #include "common/fixed_point.h" |
| 12 | 12 | ||
| 13 | namespace AudioCore::AudioRenderer { | 13 | namespace AudioCore::Renderer { |
| 14 | 14 | ||
| 15 | class CompressorInfo : public EffectInfoBase { | 15 | class CompressorInfo : public EffectInfoBase { |
| 16 | public: | 16 | public: |
| @@ -103,4 +103,4 @@ public: | |||
| 103 | CpuAddr GetWorkbuffer(s32 index) override; | 103 | CpuAddr GetWorkbuffer(s32 index) override; |
| 104 | }; | 104 | }; |
| 105 | 105 | ||
| 106 | } // namespace AudioCore::AudioRenderer | 106 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/effect/delay.cpp b/src/audio_core/renderer/effect/delay.cpp index d9853efd9..e038d4498 100644 --- a/src/audio_core/renderer/effect/delay.cpp +++ b/src/audio_core/renderer/effect/delay.cpp | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/effect/delay.h" | 4 | #include "audio_core/renderer/effect/delay.h" |
| 5 | 5 | ||
| 6 | namespace AudioCore::AudioRenderer { | 6 | namespace AudioCore::Renderer { |
| 7 | 7 | ||
| 8 | void DelayInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params, | 8 | void DelayInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params, |
| 9 | const PoolMapper& pool_mapper) { | 9 | const PoolMapper& pool_mapper) { |
| @@ -90,4 +90,4 @@ CpuAddr DelayInfo::GetWorkbuffer(s32 index) { | |||
| 90 | return GetSingleBuffer(index); | 90 | return GetSingleBuffer(index); |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | } // namespace AudioCore::AudioRenderer | 93 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/effect/delay.h b/src/audio_core/renderer/effect/delay.h index accc42a06..47417fbc6 100644 --- a/src/audio_core/renderer/effect/delay.h +++ b/src/audio_core/renderer/effect/delay.h | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | #include "common/fixed_point.h" | 12 | #include "common/fixed_point.h" |
| 13 | 13 | ||
| 14 | namespace AudioCore::AudioRenderer { | 14 | namespace AudioCore::Renderer { |
| 15 | 15 | ||
| 16 | class DelayInfo : public EffectInfoBase { | 16 | class DelayInfo : public EffectInfoBase { |
| 17 | public: | 17 | public: |
| @@ -132,4 +132,4 @@ public: | |||
| 132 | CpuAddr GetWorkbuffer(s32 index) override; | 132 | CpuAddr GetWorkbuffer(s32 index) override; |
| 133 | }; | 133 | }; |
| 134 | 134 | ||
| 135 | } // namespace AudioCore::AudioRenderer | 135 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/effect/effect_context.cpp b/src/audio_core/renderer/effect/effect_context.cpp index 74c7801c9..00f6d7822 100644 --- a/src/audio_core/renderer/effect/effect_context.cpp +++ b/src/audio_core/renderer/effect/effect_context.cpp | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/effect/effect_context.h" | 4 | #include "audio_core/renderer/effect/effect_context.h" |
| 5 | 5 | ||
| 6 | namespace AudioCore::AudioRenderer { | 6 | namespace AudioCore::Renderer { |
| 7 | 7 | ||
| 8 | void EffectContext::Initialize(std::span<EffectInfoBase> effect_infos_, const u32 effect_count_, | 8 | void EffectContext::Initialize(std::span<EffectInfoBase> effect_infos_, const u32 effect_count_, |
| 9 | std::span<EffectResultState> result_states_cpu_, | 9 | std::span<EffectResultState> result_states_cpu_, |
| @@ -38,4 +38,4 @@ void EffectContext::UpdateStateByDspShared() { | |||
| 38 | } | 38 | } |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | } // namespace AudioCore::AudioRenderer | 41 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/effect/effect_context.h b/src/audio_core/renderer/effect/effect_context.h index 8f6d6e7d8..8364c5521 100644 --- a/src/audio_core/renderer/effect/effect_context.h +++ b/src/audio_core/renderer/effect/effect_context.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include "audio_core/renderer/effect/effect_result_state.h" | 9 | #include "audio_core/renderer/effect/effect_result_state.h" |
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | 11 | ||
| 12 | namespace AudioCore::AudioRenderer { | 12 | namespace AudioCore::Renderer { |
| 13 | 13 | ||
| 14 | class EffectContext { | 14 | class EffectContext { |
| 15 | public: | 15 | public: |
| @@ -72,4 +72,4 @@ private: | |||
| 72 | size_t dsp_state_count{}; | 72 | size_t dsp_state_count{}; |
| 73 | }; | 73 | }; |
| 74 | 74 | ||
| 75 | } // namespace AudioCore::AudioRenderer | 75 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/effect/effect_info_base.h b/src/audio_core/renderer/effect/effect_info_base.h index dbdccf278..b49503409 100644 --- a/src/audio_core/renderer/effect/effect_info_base.h +++ b/src/audio_core/renderer/effect/effect_info_base.h | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | #include "audio_core/renderer/memory/pool_mapper.h" | 12 | #include "audio_core/renderer/memory/pool_mapper.h" |
| 13 | #include "common/common_types.h" | 13 | #include "common/common_types.h" |
| 14 | 14 | ||
| 15 | namespace AudioCore::AudioRenderer { | 15 | namespace AudioCore::Renderer { |
| 16 | /** | 16 | /** |
| 17 | * Base of all effects. Holds various data and functions used for all derived effects. | 17 | * Base of all effects. Holds various data and functions used for all derived effects. |
| 18 | * Should not be used directly. | 18 | * Should not be used directly. |
| @@ -432,4 +432,4 @@ protected: | |||
| 432 | std::array<u8, sizeof(State)> state{}; | 432 | std::array<u8, sizeof(State)> state{}; |
| 433 | }; | 433 | }; |
| 434 | 434 | ||
| 435 | } // namespace AudioCore::AudioRenderer | 435 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/effect/effect_reset.h b/src/audio_core/renderer/effect/effect_reset.h index 1ea67e334..c9e3b4b78 100644 --- a/src/audio_core/renderer/effect/effect_reset.h +++ b/src/audio_core/renderer/effect/effect_reset.h | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | #include "audio_core/renderer/effect/reverb.h" | 14 | #include "audio_core/renderer/effect/reverb.h" |
| 15 | #include "common/common_types.h" | 15 | #include "common/common_types.h" |
| 16 | 16 | ||
| 17 | namespace AudioCore::AudioRenderer { | 17 | namespace AudioCore::Renderer { |
| 18 | /** | 18 | /** |
| 19 | * Reset an effect, and create a new one of the given type. | 19 | * Reset an effect, and create a new one of the given type. |
| 20 | * | 20 | * |
| @@ -68,4 +68,4 @@ static void ResetEffect(EffectInfoBase* effect, const EffectInfoBase::Type type) | |||
| 68 | } | 68 | } |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | } // namespace AudioCore::AudioRenderer | 71 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/effect/effect_result_state.h b/src/audio_core/renderer/effect/effect_result_state.h index ae096ad69..f4d4b6086 100644 --- a/src/audio_core/renderer/effect/effect_result_state.h +++ b/src/audio_core/renderer/effect/effect_result_state.h | |||
| @@ -7,10 +7,10 @@ | |||
| 7 | 7 | ||
| 8 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | 9 | ||
| 10 | namespace AudioCore::AudioRenderer { | 10 | namespace AudioCore::Renderer { |
| 11 | 11 | ||
| 12 | struct EffectResultState { | 12 | struct EffectResultState { |
| 13 | std::array<u8, 0x80> state; | 13 | std::array<u8, 0x80> state; |
| 14 | }; | 14 | }; |
| 15 | 15 | ||
| 16 | } // namespace AudioCore::AudioRenderer | 16 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/effect/i3dl2.cpp b/src/audio_core/renderer/effect/i3dl2.cpp index 960b29cfc..a3c324c1e 100644 --- a/src/audio_core/renderer/effect/i3dl2.cpp +++ b/src/audio_core/renderer/effect/i3dl2.cpp | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/effect/i3dl2.h" | 4 | #include "audio_core/renderer/effect/i3dl2.h" |
| 5 | 5 | ||
| 6 | namespace AudioCore::AudioRenderer { | 6 | namespace AudioCore::Renderer { |
| 7 | 7 | ||
| 8 | void I3dl2ReverbInfo::Update(BehaviorInfo::ErrorInfo& error_info, | 8 | void I3dl2ReverbInfo::Update(BehaviorInfo::ErrorInfo& error_info, |
| 9 | const InParameterVersion1& in_params, const PoolMapper& pool_mapper) { | 9 | const InParameterVersion1& in_params, const PoolMapper& pool_mapper) { |
| @@ -91,4 +91,4 @@ CpuAddr I3dl2ReverbInfo::GetWorkbuffer(s32 index) { | |||
| 91 | return GetSingleBuffer(index); | 91 | return GetSingleBuffer(index); |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | } // namespace AudioCore::AudioRenderer | 94 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/effect/i3dl2.h b/src/audio_core/renderer/effect/i3dl2.h index 6e3ffd1d4..e0432b4ae 100644 --- a/src/audio_core/renderer/effect/i3dl2.h +++ b/src/audio_core/renderer/effect/i3dl2.h | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | #include "common/fixed_point.h" | 12 | #include "common/fixed_point.h" |
| 13 | 13 | ||
| 14 | namespace AudioCore::AudioRenderer { | 14 | namespace AudioCore::Renderer { |
| 15 | 15 | ||
| 16 | class I3dl2ReverbInfo : public EffectInfoBase { | 16 | class I3dl2ReverbInfo : public EffectInfoBase { |
| 17 | public: | 17 | public: |
| @@ -198,4 +198,4 @@ public: | |||
| 198 | CpuAddr GetWorkbuffer(s32 index) override; | 198 | CpuAddr GetWorkbuffer(s32 index) override; |
| 199 | }; | 199 | }; |
| 200 | 200 | ||
| 201 | } // namespace AudioCore::AudioRenderer | 201 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/effect/light_limiter.cpp b/src/audio_core/renderer/effect/light_limiter.cpp index 1635a952d..9c8ea3c49 100644 --- a/src/audio_core/renderer/effect/light_limiter.cpp +++ b/src/audio_core/renderer/effect/light_limiter.cpp | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/effect/light_limiter.h" | 4 | #include "audio_core/renderer/effect/light_limiter.h" |
| 5 | 5 | ||
| 6 | namespace AudioCore::AudioRenderer { | 6 | namespace AudioCore::Renderer { |
| 7 | 7 | ||
| 8 | void LightLimiterInfo::Update(BehaviorInfo::ErrorInfo& error_info, | 8 | void LightLimiterInfo::Update(BehaviorInfo::ErrorInfo& error_info, |
| 9 | const InParameterVersion1& in_params, const PoolMapper& pool_mapper) { | 9 | const InParameterVersion1& in_params, const PoolMapper& pool_mapper) { |
| @@ -78,4 +78,4 @@ CpuAddr LightLimiterInfo::GetWorkbuffer(s32 index) { | |||
| 78 | return GetSingleBuffer(index); | 78 | return GetSingleBuffer(index); |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | } // namespace AudioCore::AudioRenderer | 81 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/effect/light_limiter.h b/src/audio_core/renderer/effect/light_limiter.h index 338d67bbc..7f2ede405 100644 --- a/src/audio_core/renderer/effect/light_limiter.h +++ b/src/audio_core/renderer/effect/light_limiter.h | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | #include "common/fixed_point.h" | 12 | #include "common/fixed_point.h" |
| 13 | 13 | ||
| 14 | namespace AudioCore::AudioRenderer { | 14 | namespace AudioCore::Renderer { |
| 15 | 15 | ||
| 16 | class LightLimiterInfo : public EffectInfoBase { | 16 | class LightLimiterInfo : public EffectInfoBase { |
| 17 | public: | 17 | public: |
| @@ -135,4 +135,4 @@ public: | |||
| 135 | CpuAddr GetWorkbuffer(s32 index) override; | 135 | CpuAddr GetWorkbuffer(s32 index) override; |
| 136 | }; | 136 | }; |
| 137 | 137 | ||
| 138 | } // namespace AudioCore::AudioRenderer | 138 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/effect/reverb.cpp b/src/audio_core/renderer/effect/reverb.cpp index 2d32383d0..4da72469a 100644 --- a/src/audio_core/renderer/effect/reverb.cpp +++ b/src/audio_core/renderer/effect/reverb.cpp | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/effect/reverb.h" | 4 | #include "audio_core/renderer/effect/reverb.h" |
| 5 | 5 | ||
| 6 | namespace AudioCore::AudioRenderer { | 6 | namespace AudioCore::Renderer { |
| 7 | 7 | ||
| 8 | void ReverbInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params, | 8 | void ReverbInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params, |
| 9 | const PoolMapper& pool_mapper) { | 9 | const PoolMapper& pool_mapper) { |
| @@ -90,4 +90,4 @@ CpuAddr ReverbInfo::GetWorkbuffer(s32 index) { | |||
| 90 | return GetSingleBuffer(index); | 90 | return GetSingleBuffer(index); |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | } // namespace AudioCore::AudioRenderer | 93 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/effect/reverb.h b/src/audio_core/renderer/effect/reverb.h index 6cc345ef6..52a048da6 100644 --- a/src/audio_core/renderer/effect/reverb.h +++ b/src/audio_core/renderer/effect/reverb.h | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | #include "common/fixed_point.h" | 12 | #include "common/fixed_point.h" |
| 13 | 13 | ||
| 14 | namespace AudioCore::AudioRenderer { | 14 | namespace AudioCore::Renderer { |
| 15 | 15 | ||
| 16 | class ReverbInfo : public EffectInfoBase { | 16 | class ReverbInfo : public EffectInfoBase { |
| 17 | public: | 17 | public: |
| @@ -187,4 +187,4 @@ public: | |||
| 187 | CpuAddr GetWorkbuffer(s32 index) override; | 187 | CpuAddr GetWorkbuffer(s32 index) override; |
| 188 | }; | 188 | }; |
| 189 | 189 | ||
| 190 | } // namespace AudioCore::AudioRenderer | 190 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/memory/address_info.h b/src/audio_core/renderer/memory/address_info.h index bb5c930e1..c81ef1b8a 100644 --- a/src/audio_core/renderer/memory/address_info.h +++ b/src/audio_core/renderer/memory/address_info.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include "audio_core/renderer/memory/memory_pool_info.h" | 6 | #include "audio_core/renderer/memory/memory_pool_info.h" |
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | 8 | ||
| 9 | namespace AudioCore::AudioRenderer { | 9 | namespace AudioCore::Renderer { |
| 10 | 10 | ||
| 11 | /** | 11 | /** |
| 12 | * Represents a region of mapped or unmapped memory. | 12 | * Represents a region of mapped or unmapped memory. |
| @@ -121,4 +121,4 @@ private: | |||
| 121 | CpuAddr dsp_address; | 121 | CpuAddr dsp_address; |
| 122 | }; | 122 | }; |
| 123 | 123 | ||
| 124 | } // namespace AudioCore::AudioRenderer | 124 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/memory/memory_pool_info.cpp b/src/audio_core/renderer/memory/memory_pool_info.cpp index 9b7824af1..03b44d5f3 100644 --- a/src/audio_core/renderer/memory/memory_pool_info.cpp +++ b/src/audio_core/renderer/memory/memory_pool_info.cpp | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/memory/memory_pool_info.h" | 4 | #include "audio_core/renderer/memory/memory_pool_info.h" |
| 5 | 5 | ||
| 6 | namespace AudioCore::AudioRenderer { | 6 | namespace AudioCore::Renderer { |
| 7 | 7 | ||
| 8 | CpuAddr MemoryPoolInfo::GetCpuAddress() const { | 8 | CpuAddr MemoryPoolInfo::GetCpuAddress() const { |
| 9 | return cpu_address; | 9 | return cpu_address; |
| @@ -58,4 +58,4 @@ bool MemoryPoolInfo::IsUsed() const { | |||
| 58 | return in_use; | 58 | return in_use; |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | } // namespace AudioCore::AudioRenderer | 61 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/memory/memory_pool_info.h b/src/audio_core/renderer/memory/memory_pool_info.h index 80c571bc1..2f9c85184 100644 --- a/src/audio_core/renderer/memory/memory_pool_info.h +++ b/src/audio_core/renderer/memory/memory_pool_info.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #include "audio_core/common/common.h" | 8 | #include "audio_core/common/common.h" |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | 10 | ||
| 11 | namespace AudioCore::AudioRenderer { | 11 | namespace AudioCore::Renderer { |
| 12 | /** | 12 | /** |
| 13 | * CPU pools are mapped in user memory with the supplied process_handle (see PoolMapper). | 13 | * CPU pools are mapped in user memory with the supplied process_handle (see PoolMapper). |
| 14 | */ | 14 | */ |
| @@ -167,4 +167,4 @@ private: | |||
| 167 | bool in_use{}; | 167 | bool in_use{}; |
| 168 | }; | 168 | }; |
| 169 | 169 | ||
| 170 | } // namespace AudioCore::AudioRenderer | 170 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/memory/pool_mapper.cpp b/src/audio_core/renderer/memory/pool_mapper.cpp index 7fd2b5f47..999bb746b 100644 --- a/src/audio_core/renderer/memory/pool_mapper.cpp +++ b/src/audio_core/renderer/memory/pool_mapper.cpp | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include "core/hle/kernel/k_process.h" | 6 | #include "core/hle/kernel/k_process.h" |
| 7 | #include "core/hle/kernel/svc.h" | 7 | #include "core/hle/kernel/svc.h" |
| 8 | 8 | ||
| 9 | namespace AudioCore::AudioRenderer { | 9 | namespace AudioCore::Renderer { |
| 10 | 10 | ||
| 11 | PoolMapper::PoolMapper(u32 process_handle_, bool force_map_) | 11 | PoolMapper::PoolMapper(u32 process_handle_, bool force_map_) |
| 12 | : process_handle{process_handle_}, force_map{force_map_} {} | 12 | : process_handle{process_handle_}, force_map{force_map_} {} |
| @@ -240,4 +240,4 @@ bool PoolMapper::InitializeSystemPool(MemoryPoolInfo& pool, const u8* memory, | |||
| 240 | } | 240 | } |
| 241 | } | 241 | } |
| 242 | 242 | ||
| 243 | } // namespace AudioCore::AudioRenderer | 243 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/memory/pool_mapper.h b/src/audio_core/renderer/memory/pool_mapper.h index 9a691da7a..95ae5d8ea 100644 --- a/src/audio_core/renderer/memory/pool_mapper.h +++ b/src/audio_core/renderer/memory/pool_mapper.h | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | #include "core/hle/service/audio/errors.h" | 11 | #include "core/hle/service/audio/errors.h" |
| 12 | 12 | ||
| 13 | namespace AudioCore::AudioRenderer { | 13 | namespace AudioCore::Renderer { |
| 14 | class AddressInfo; | 14 | class AddressInfo; |
| 15 | 15 | ||
| 16 | /** | 16 | /** |
| @@ -176,4 +176,4 @@ private: | |||
| 176 | bool force_map; | 176 | bool force_map; |
| 177 | }; | 177 | }; |
| 178 | 178 | ||
| 179 | } // namespace AudioCore::AudioRenderer | 179 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/mix/mix_context.cpp b/src/audio_core/renderer/mix/mix_context.cpp index 3a18ae7c2..c712610bb 100644 --- a/src/audio_core/renderer/mix/mix_context.cpp +++ b/src/audio_core/renderer/mix/mix_context.cpp | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | #include "audio_core/renderer/splitter/splitter_context.h" | 7 | #include "audio_core/renderer/splitter/splitter_context.h" |
| 8 | #include "common/polyfill_ranges.h" | 8 | #include "common/polyfill_ranges.h" |
| 9 | 9 | ||
| 10 | namespace AudioCore::AudioRenderer { | 10 | namespace AudioCore::Renderer { |
| 11 | 11 | ||
| 12 | void MixContext::Initialize(std::span<MixInfo*> sorted_mix_infos_, std::span<MixInfo> mix_infos_, | 12 | void MixContext::Initialize(std::span<MixInfo*> sorted_mix_infos_, std::span<MixInfo> mix_infos_, |
| 13 | const u32 count_, std::span<s32> effect_process_order_buffer_, | 13 | const u32 count_, std::span<s32> effect_process_order_buffer_, |
| @@ -139,4 +139,4 @@ EdgeMatrix& MixContext::GetEdgeMatrix() { | |||
| 139 | return edge_matrix; | 139 | return edge_matrix; |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | } // namespace AudioCore::AudioRenderer | 142 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/mix/mix_context.h b/src/audio_core/renderer/mix/mix_context.h index bcd9637da..ce19ec8d6 100644 --- a/src/audio_core/renderer/mix/mix_context.h +++ b/src/audio_core/renderer/mix/mix_context.h | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | #include "audio_core/renderer/nodes/node_states.h" | 10 | #include "audio_core/renderer/nodes/node_states.h" |
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | 12 | ||
| 13 | namespace AudioCore::AudioRenderer { | 13 | namespace AudioCore::Renderer { |
| 14 | class SplitterContext; | 14 | class SplitterContext; |
| 15 | 15 | ||
| 16 | /* | 16 | /* |
| @@ -121,4 +121,4 @@ private: | |||
| 121 | EdgeMatrix edge_matrix{}; | 121 | EdgeMatrix edge_matrix{}; |
| 122 | }; | 122 | }; |
| 123 | 123 | ||
| 124 | } // namespace AudioCore::AudioRenderer | 124 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/mix/mix_info.cpp b/src/audio_core/renderer/mix/mix_info.cpp index cc18e57ee..5e44bde18 100644 --- a/src/audio_core/renderer/mix/mix_info.cpp +++ b/src/audio_core/renderer/mix/mix_info.cpp | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | #include "audio_core/renderer/nodes/edge_matrix.h" | 7 | #include "audio_core/renderer/nodes/edge_matrix.h" |
| 8 | #include "audio_core/renderer/splitter/splitter_context.h" | 8 | #include "audio_core/renderer/splitter/splitter_context.h" |
| 9 | 9 | ||
| 10 | namespace AudioCore::AudioRenderer { | 10 | namespace AudioCore::Renderer { |
| 11 | 11 | ||
| 12 | MixInfo::MixInfo(std::span<s32> effect_order_buffer_, s32 effect_count_, BehaviorInfo& behavior) | 12 | MixInfo::MixInfo(std::span<s32> effect_order_buffer_, s32 effect_count_, BehaviorInfo& behavior) |
| 13 | : effect_order_buffer{effect_order_buffer_}, effect_count{effect_count_}, | 13 | : effect_order_buffer{effect_order_buffer_}, effect_count{effect_count_}, |
| @@ -117,4 +117,4 @@ bool MixInfo::HasAnyConnection() const { | |||
| 117 | return dst_mix_id != UnusedMixId || dst_splitter_id != UnusedSplitterId; | 117 | return dst_mix_id != UnusedMixId || dst_splitter_id != UnusedSplitterId; |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | } // namespace AudioCore::AudioRenderer | 120 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/mix/mix_info.h b/src/audio_core/renderer/mix/mix_info.h index b5fa4c0c7..7005daa4f 100644 --- a/src/audio_core/renderer/mix/mix_info.h +++ b/src/audio_core/renderer/mix/mix_info.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include "audio_core/common/common.h" | 9 | #include "audio_core/common/common.h" |
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | 11 | ||
| 12 | namespace AudioCore::AudioRenderer { | 12 | namespace AudioCore::Renderer { |
| 13 | class EdgeMatrix; | 13 | class EdgeMatrix; |
| 14 | class SplitterContext; | 14 | class SplitterContext; |
| 15 | class EffectContext; | 15 | class EffectContext; |
| @@ -121,4 +121,4 @@ public: | |||
| 121 | const bool long_size_pre_delay_supported; | 121 | const bool long_size_pre_delay_supported; |
| 122 | }; | 122 | }; |
| 123 | 123 | ||
| 124 | } // namespace AudioCore::AudioRenderer | 124 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/nodes/bit_array.h b/src/audio_core/renderer/nodes/bit_array.h index b0d53cd51..d8a2d09d0 100644 --- a/src/audio_core/renderer/nodes/bit_array.h +++ b/src/audio_core/renderer/nodes/bit_array.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | 9 | ||
| 10 | namespace AudioCore::AudioRenderer { | 10 | namespace AudioCore::Renderer { |
| 11 | /** | 11 | /** |
| 12 | * Represents an array of bits used for nodes and edges for the mixing graph. | 12 | * Represents an array of bits used for nodes and edges for the mixing graph. |
| 13 | */ | 13 | */ |
| @@ -22,4 +22,4 @@ struct BitArray { | |||
| 22 | u32 size{}; | 22 | u32 size{}; |
| 23 | }; | 23 | }; |
| 24 | 24 | ||
| 25 | } // namespace AudioCore::AudioRenderer | 25 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/nodes/edge_matrix.cpp b/src/audio_core/renderer/nodes/edge_matrix.cpp index 5573f33b9..c28773b22 100644 --- a/src/audio_core/renderer/nodes/edge_matrix.cpp +++ b/src/audio_core/renderer/nodes/edge_matrix.cpp | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/nodes/edge_matrix.h" | 4 | #include "audio_core/renderer/nodes/edge_matrix.h" |
| 5 | 5 | ||
| 6 | namespace AudioCore::AudioRenderer { | 6 | namespace AudioCore::Renderer { |
| 7 | 7 | ||
| 8 | void EdgeMatrix::Initialize([[maybe_unused]] std::span<u8> buffer, | 8 | void EdgeMatrix::Initialize([[maybe_unused]] std::span<u8> buffer, |
| 9 | [[maybe_unused]] const u64 node_buffer_size, const u32 count_) { | 9 | [[maybe_unused]] const u64 node_buffer_size, const u32 count_) { |
| @@ -35,4 +35,4 @@ u32 EdgeMatrix::GetNodeCount() const { | |||
| 35 | return count; | 35 | return count; |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | } // namespace AudioCore::AudioRenderer | 38 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/nodes/edge_matrix.h b/src/audio_core/renderer/nodes/edge_matrix.h index 27a20e43e..0271c23b1 100644 --- a/src/audio_core/renderer/nodes/edge_matrix.h +++ b/src/audio_core/renderer/nodes/edge_matrix.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include "common/alignment.h" | 9 | #include "common/alignment.h" |
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | 11 | ||
| 12 | namespace AudioCore::AudioRenderer { | 12 | namespace AudioCore::Renderer { |
| 13 | /** | 13 | /** |
| 14 | * An edge matrix, holding the connections for each node to every other node in the graph. | 14 | * An edge matrix, holding the connections for each node to every other node in the graph. |
| 15 | */ | 15 | */ |
| @@ -79,4 +79,4 @@ private: | |||
| 79 | u32 count; | 79 | u32 count; |
| 80 | }; | 80 | }; |
| 81 | 81 | ||
| 82 | } // namespace AudioCore::AudioRenderer | 82 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/nodes/node_states.cpp b/src/audio_core/renderer/nodes/node_states.cpp index b7a44a54c..028a58041 100644 --- a/src/audio_core/renderer/nodes/node_states.cpp +++ b/src/audio_core/renderer/nodes/node_states.cpp | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | #include "audio_core/renderer/nodes/node_states.h" | 4 | #include "audio_core/renderer/nodes/node_states.h" |
| 5 | #include "common/logging/log.h" | 5 | #include "common/logging/log.h" |
| 6 | 6 | ||
| 7 | namespace AudioCore::AudioRenderer { | 7 | namespace AudioCore::Renderer { |
| 8 | 8 | ||
| 9 | void NodeStates::Initialize(std::span<u8> buffer_, [[maybe_unused]] const u64 node_buffer_size, | 9 | void NodeStates::Initialize(std::span<u8> buffer_, [[maybe_unused]] const u64 node_buffer_size, |
| 10 | const u32 count) { | 10 | const u32 count) { |
| @@ -138,4 +138,4 @@ std::pair<std::span<u32>::reverse_iterator, size_t> NodeStates::GetSortedResuls( | |||
| 138 | return {results.rbegin(), result_pos}; | 138 | return {results.rbegin(), result_pos}; |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | } // namespace AudioCore::AudioRenderer | 141 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/nodes/node_states.h b/src/audio_core/renderer/nodes/node_states.h index e768cd4b5..991a82841 100644 --- a/src/audio_core/renderer/nodes/node_states.h +++ b/src/audio_core/renderer/nodes/node_states.h | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | #include "common/alignment.h" | 10 | #include "common/alignment.h" |
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | 12 | ||
| 13 | namespace AudioCore::AudioRenderer { | 13 | namespace AudioCore::Renderer { |
| 14 | /** | 14 | /** |
| 15 | * Graph utility functions for sorting and getting results from the DAG. | 15 | * Graph utility functions for sorting and getting results from the DAG. |
| 16 | */ | 16 | */ |
| @@ -192,4 +192,4 @@ private: | |||
| 192 | Stack stack{}; | 192 | Stack stack{}; |
| 193 | }; | 193 | }; |
| 194 | 194 | ||
| 195 | } // namespace AudioCore::AudioRenderer | 195 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/performance/detail_aspect.cpp b/src/audio_core/renderer/performance/detail_aspect.cpp index f6405937f..ef8b47cee 100644 --- a/src/audio_core/renderer/performance/detail_aspect.cpp +++ b/src/audio_core/renderer/performance/detail_aspect.cpp | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | #include "audio_core/renderer/command/command_generator.h" | 5 | #include "audio_core/renderer/command/command_generator.h" |
| 6 | #include "audio_core/renderer/performance/detail_aspect.h" | 6 | #include "audio_core/renderer/performance/detail_aspect.h" |
| 7 | 7 | ||
| 8 | namespace AudioCore::AudioRenderer { | 8 | namespace AudioCore::Renderer { |
| 9 | 9 | ||
| 10 | DetailAspect::DetailAspect(CommandGenerator& command_generator_, | 10 | DetailAspect::DetailAspect(CommandGenerator& command_generator_, |
| 11 | const PerformanceEntryType entry_type, const s32 node_id_, | 11 | const PerformanceEntryType entry_type, const s32 node_id_, |
| @@ -22,4 +22,4 @@ DetailAspect::DetailAspect(CommandGenerator& command_generator_, | |||
| 22 | } | 22 | } |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | } // namespace AudioCore::AudioRenderer | 25 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/performance/detail_aspect.h b/src/audio_core/renderer/performance/detail_aspect.h index 736c331b9..0bd7f80c8 100644 --- a/src/audio_core/renderer/performance/detail_aspect.h +++ b/src/audio_core/renderer/performance/detail_aspect.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | #include "audio_core/renderer/performance/performance_manager.h" | 7 | #include "audio_core/renderer/performance/performance_manager.h" |
| 8 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | 9 | ||
| 10 | namespace AudioCore::AudioRenderer { | 10 | namespace AudioCore::Renderer { |
| 11 | class CommandGenerator; | 11 | class CommandGenerator; |
| 12 | 12 | ||
| 13 | /** | 13 | /** |
| @@ -29,4 +29,4 @@ public: | |||
| 29 | s32 node_id; | 29 | s32 node_id; |
| 30 | }; | 30 | }; |
| 31 | 31 | ||
| 32 | } // namespace AudioCore::AudioRenderer | 32 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/performance/entry_aspect.cpp b/src/audio_core/renderer/performance/entry_aspect.cpp index dd4165803..c9241a639 100644 --- a/src/audio_core/renderer/performance/entry_aspect.cpp +++ b/src/audio_core/renderer/performance/entry_aspect.cpp | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | #include "audio_core/renderer/command/command_generator.h" | 5 | #include "audio_core/renderer/command/command_generator.h" |
| 6 | #include "audio_core/renderer/performance/entry_aspect.h" | 6 | #include "audio_core/renderer/performance/entry_aspect.h" |
| 7 | 7 | ||
| 8 | namespace AudioCore::AudioRenderer { | 8 | namespace AudioCore::Renderer { |
| 9 | 9 | ||
| 10 | EntryAspect::EntryAspect(CommandGenerator& command_generator_, const PerformanceEntryType type, | 10 | EntryAspect::EntryAspect(CommandGenerator& command_generator_, const PerformanceEntryType type, |
| 11 | const s32 node_id_) | 11 | const s32 node_id_) |
| @@ -20,4 +20,4 @@ EntryAspect::EntryAspect(CommandGenerator& command_generator_, const Performance | |||
| 20 | } | 20 | } |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | } // namespace AudioCore::AudioRenderer | 23 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/performance/entry_aspect.h b/src/audio_core/renderer/performance/entry_aspect.h index 14c9e3baf..f99287d68 100644 --- a/src/audio_core/renderer/performance/entry_aspect.h +++ b/src/audio_core/renderer/performance/entry_aspect.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | #include "audio_core/renderer/performance/performance_manager.h" | 7 | #include "audio_core/renderer/performance/performance_manager.h" |
| 8 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | 9 | ||
| 10 | namespace AudioCore::AudioRenderer { | 10 | namespace AudioCore::Renderer { |
| 11 | class CommandGenerator; | 11 | class CommandGenerator; |
| 12 | 12 | ||
| 13 | /** | 13 | /** |
| @@ -28,4 +28,4 @@ public: | |||
| 28 | s32 node_id; | 28 | s32 node_id; |
| 29 | }; | 29 | }; |
| 30 | 30 | ||
| 31 | } // namespace AudioCore::AudioRenderer | 31 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/performance/performance_detail.h b/src/audio_core/renderer/performance/performance_detail.h index f603b9026..2b0cf9422 100644 --- a/src/audio_core/renderer/performance/performance_detail.h +++ b/src/audio_core/renderer/performance/performance_detail.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include "audio_core/renderer/performance/performance_entry.h" | 6 | #include "audio_core/renderer/performance/performance_entry.h" |
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | 8 | ||
| 9 | namespace AudioCore::AudioRenderer { | 9 | namespace AudioCore::Renderer { |
| 10 | 10 | ||
| 11 | enum class PerformanceDetailType : u8 { | 11 | enum class PerformanceDetailType : u8 { |
| 12 | Invalid, | 12 | Invalid, |
| @@ -47,4 +47,4 @@ struct PerformanceDetailVersion2 { | |||
| 47 | static_assert(sizeof(PerformanceDetailVersion2) == 0x18, | 47 | static_assert(sizeof(PerformanceDetailVersion2) == 0x18, |
| 48 | "PerformanceDetailVersion2 has the wrong size!"); | 48 | "PerformanceDetailVersion2 has the wrong size!"); |
| 49 | 49 | ||
| 50 | } // namespace AudioCore::AudioRenderer | 50 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/performance/performance_entry.h b/src/audio_core/renderer/performance/performance_entry.h index d6b1158db..dbd6053a5 100644 --- a/src/audio_core/renderer/performance/performance_entry.h +++ b/src/audio_core/renderer/performance/performance_entry.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | #include "common/common_types.h" | 6 | #include "common/common_types.h" |
| 7 | 7 | ||
| 8 | namespace AudioCore::AudioRenderer { | 8 | namespace AudioCore::Renderer { |
| 9 | 9 | ||
| 10 | enum class PerformanceEntryType : u8 { | 10 | enum class PerformanceEntryType : u8 { |
| 11 | Invalid, | 11 | Invalid, |
| @@ -34,4 +34,4 @@ struct PerformanceEntryVersion2 { | |||
| 34 | static_assert(sizeof(PerformanceEntryVersion2) == 0x18, | 34 | static_assert(sizeof(PerformanceEntryVersion2) == 0x18, |
| 35 | "PerformanceEntryVersion2 has the wrong size!"); | 35 | "PerformanceEntryVersion2 has the wrong size!"); |
| 36 | 36 | ||
| 37 | } // namespace AudioCore::AudioRenderer | 37 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/performance/performance_entry_addresses.h b/src/audio_core/renderer/performance/performance_entry_addresses.h index e381d765c..51eee975f 100644 --- a/src/audio_core/renderer/performance/performance_entry_addresses.h +++ b/src/audio_core/renderer/performance/performance_entry_addresses.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | #include "audio_core/common/common.h" | 6 | #include "audio_core/common/common.h" |
| 7 | 7 | ||
| 8 | namespace AudioCore::AudioRenderer { | 8 | namespace AudioCore::Renderer { |
| 9 | 9 | ||
| 10 | struct PerformanceEntryAddresses { | 10 | struct PerformanceEntryAddresses { |
| 11 | CpuAddr translated_address; | 11 | CpuAddr translated_address; |
| @@ -14,4 +14,4 @@ struct PerformanceEntryAddresses { | |||
| 14 | CpuAddr entry_processed_time_offset; | 14 | CpuAddr entry_processed_time_offset; |
| 15 | }; | 15 | }; |
| 16 | 16 | ||
| 17 | } // namespace AudioCore::AudioRenderer | 17 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/performance/performance_frame_header.h b/src/audio_core/renderer/performance/performance_frame_header.h index b1848284e..24e4989f8 100644 --- a/src/audio_core/renderer/performance/performance_frame_header.h +++ b/src/audio_core/renderer/performance/performance_frame_header.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | #include "common/common_types.h" | 6 | #include "common/common_types.h" |
| 7 | 7 | ||
| 8 | namespace AudioCore::AudioRenderer { | 8 | namespace AudioCore::Renderer { |
| 9 | 9 | ||
| 10 | struct PerformanceFrameHeaderVersion1 { | 10 | struct PerformanceFrameHeaderVersion1 { |
| 11 | /* 0x00 */ u32 magic; // "PERF" | 11 | /* 0x00 */ u32 magic; // "PERF" |
| @@ -33,4 +33,4 @@ struct PerformanceFrameHeaderVersion2 { | |||
| 33 | static_assert(sizeof(PerformanceFrameHeaderVersion2) == 0x30, | 33 | static_assert(sizeof(PerformanceFrameHeaderVersion2) == 0x30, |
| 34 | "PerformanceFrameHeaderVersion2 has the wrong size!"); | 34 | "PerformanceFrameHeaderVersion2 has the wrong size!"); |
| 35 | 35 | ||
| 36 | } // namespace AudioCore::AudioRenderer | 36 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/performance/performance_manager.cpp b/src/audio_core/renderer/performance/performance_manager.cpp index 8aa0f5ed0..ce736db71 100644 --- a/src/audio_core/renderer/performance/performance_manager.cpp +++ b/src/audio_core/renderer/performance/performance_manager.cpp | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include "audio_core/renderer/performance/performance_manager.h" | 6 | #include "audio_core/renderer/performance/performance_manager.h" |
| 7 | #include "common/common_funcs.h" | 7 | #include "common/common_funcs.h" |
| 8 | 8 | ||
| 9 | namespace AudioCore::AudioRenderer { | 9 | namespace AudioCore::Renderer { |
| 10 | 10 | ||
| 11 | void PerformanceManager::CreateImpl(const size_t version) { | 11 | void PerformanceManager::CreateImpl(const size_t version) { |
| 12 | switch (version) { | 12 | switch (version) { |
| @@ -643,4 +643,4 @@ void PerformanceManagerImpl<PerformanceVersion::Version2, PerformanceFrameHeader | |||
| 643 | target_node_id = target_node_id_; | 643 | target_node_id = target_node_id_; |
| 644 | } | 644 | } |
| 645 | 645 | ||
| 646 | } // namespace AudioCore::AudioRenderer | 646 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/performance/performance_manager.h b/src/audio_core/renderer/performance/performance_manager.h index b65caa9b6..ffd0fa1fb 100644 --- a/src/audio_core/renderer/performance/performance_manager.h +++ b/src/audio_core/renderer/performance/performance_manager.h | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | #include "audio_core/renderer/performance/performance_frame_header.h" | 14 | #include "audio_core/renderer/performance/performance_frame_header.h" |
| 15 | #include "common/common_types.h" | 15 | #include "common/common_types.h" |
| 16 | 16 | ||
| 17 | namespace AudioCore::AudioRenderer { | 17 | namespace AudioCore::Renderer { |
| 18 | class BehaviorInfo; | 18 | class BehaviorInfo; |
| 19 | class MemoryPoolInfo; | 19 | class MemoryPoolInfo; |
| 20 | 20 | ||
| @@ -272,4 +272,4 @@ private: | |||
| 272 | PerformanceVersion version{}; | 272 | PerformanceVersion version{}; |
| 273 | }; | 273 | }; |
| 274 | 274 | ||
| 275 | } // namespace AudioCore::AudioRenderer | 275 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/sink/circular_buffer_sink_info.cpp b/src/audio_core/renderer/sink/circular_buffer_sink_info.cpp index d91f10402..0ede02b6b 100644 --- a/src/audio_core/renderer/sink/circular_buffer_sink_info.cpp +++ b/src/audio_core/renderer/sink/circular_buffer_sink_info.cpp | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | #include "audio_core/renderer/sink/circular_buffer_sink_info.h" | 5 | #include "audio_core/renderer/sink/circular_buffer_sink_info.h" |
| 6 | #include "audio_core/renderer/upsampler/upsampler_manager.h" | 6 | #include "audio_core/renderer/upsampler/upsampler_manager.h" |
| 7 | 7 | ||
| 8 | namespace AudioCore::AudioRenderer { | 8 | namespace AudioCore::Renderer { |
| 9 | 9 | ||
| 10 | CircularBufferSinkInfo::CircularBufferSinkInfo() { | 10 | CircularBufferSinkInfo::CircularBufferSinkInfo() { |
| 11 | state.fill(0); | 11 | state.fill(0); |
| @@ -73,4 +73,4 @@ void CircularBufferSinkInfo::UpdateForCommandGeneration() { | |||
| 73 | } | 73 | } |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | } // namespace AudioCore::AudioRenderer | 76 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/sink/circular_buffer_sink_info.h b/src/audio_core/renderer/sink/circular_buffer_sink_info.h index 3356213ea..d4e61d641 100644 --- a/src/audio_core/renderer/sink/circular_buffer_sink_info.h +++ b/src/audio_core/renderer/sink/circular_buffer_sink_info.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include "audio_core/renderer/sink/sink_info_base.h" | 6 | #include "audio_core/renderer/sink/sink_info_base.h" |
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | 8 | ||
| 9 | namespace AudioCore::AudioRenderer { | 9 | namespace AudioCore::Renderer { |
| 10 | /** | 10 | /** |
| 11 | * Info for a circular buffer sink. | 11 | * Info for a circular buffer sink. |
| 12 | */ | 12 | */ |
| @@ -38,4 +38,4 @@ public: | |||
| 38 | static_assert(sizeof(CircularBufferSinkInfo) <= sizeof(SinkInfoBase), | 38 | static_assert(sizeof(CircularBufferSinkInfo) <= sizeof(SinkInfoBase), |
| 39 | "CircularBufferSinkInfo is too large!"); | 39 | "CircularBufferSinkInfo is too large!"); |
| 40 | 40 | ||
| 41 | } // namespace AudioCore::AudioRenderer | 41 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/sink/device_sink_info.cpp b/src/audio_core/renderer/sink/device_sink_info.cpp index b7b3d6f1d..2de05e38e 100644 --- a/src/audio_core/renderer/sink/device_sink_info.cpp +++ b/src/audio_core/renderer/sink/device_sink_info.cpp | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | #include "audio_core/renderer/sink/device_sink_info.h" | 4 | #include "audio_core/renderer/sink/device_sink_info.h" |
| 5 | #include "audio_core/renderer/upsampler/upsampler_manager.h" | 5 | #include "audio_core/renderer/upsampler/upsampler_manager.h" |
| 6 | 6 | ||
| 7 | namespace AudioCore::AudioRenderer { | 7 | namespace AudioCore::Renderer { |
| 8 | 8 | ||
| 9 | DeviceSinkInfo::DeviceSinkInfo() { | 9 | DeviceSinkInfo::DeviceSinkInfo() { |
| 10 | state.fill(0); | 10 | state.fill(0); |
| @@ -54,4 +54,4 @@ void DeviceSinkInfo::Update(BehaviorInfo::ErrorInfo& error_info, OutStatus& out_ | |||
| 54 | 54 | ||
| 55 | void DeviceSinkInfo::UpdateForCommandGeneration() {} | 55 | void DeviceSinkInfo::UpdateForCommandGeneration() {} |
| 56 | 56 | ||
| 57 | } // namespace AudioCore::AudioRenderer | 57 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/sink/device_sink_info.h b/src/audio_core/renderer/sink/device_sink_info.h index a1c441454..7974ae820 100644 --- a/src/audio_core/renderer/sink/device_sink_info.h +++ b/src/audio_core/renderer/sink/device_sink_info.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include "audio_core/renderer/sink/sink_info_base.h" | 6 | #include "audio_core/renderer/sink/sink_info_base.h" |
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | 8 | ||
| 9 | namespace AudioCore::AudioRenderer { | 9 | namespace AudioCore::Renderer { |
| 10 | /** | 10 | /** |
| 11 | * Info for a device sink. | 11 | * Info for a device sink. |
| 12 | */ | 12 | */ |
| @@ -37,4 +37,4 @@ public: | |||
| 37 | }; | 37 | }; |
| 38 | static_assert(sizeof(DeviceSinkInfo) <= sizeof(SinkInfoBase), "DeviceSinkInfo is too large!"); | 38 | static_assert(sizeof(DeviceSinkInfo) <= sizeof(SinkInfoBase), "DeviceSinkInfo is too large!"); |
| 39 | 39 | ||
| 40 | } // namespace AudioCore::AudioRenderer | 40 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/sink/sink_context.cpp b/src/audio_core/renderer/sink/sink_context.cpp index 634bc1cf9..a4f9cac21 100644 --- a/src/audio_core/renderer/sink/sink_context.cpp +++ b/src/audio_core/renderer/sink/sink_context.cpp | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/sink/sink_context.h" | 4 | #include "audio_core/renderer/sink/sink_context.h" |
| 5 | 5 | ||
| 6 | namespace AudioCore::AudioRenderer { | 6 | namespace AudioCore::Renderer { |
| 7 | 7 | ||
| 8 | void SinkContext::Initialize(std::span<SinkInfoBase> sink_infos_, const u32 sink_count_) { | 8 | void SinkContext::Initialize(std::span<SinkInfoBase> sink_infos_, const u32 sink_count_) { |
| 9 | sink_infos = sink_infos_; | 9 | sink_infos = sink_infos_; |
| @@ -18,4 +18,4 @@ u32 SinkContext::GetCount() const { | |||
| 18 | return sink_count; | 18 | return sink_count; |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | } // namespace AudioCore::AudioRenderer | 21 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/sink/sink_context.h b/src/audio_core/renderer/sink/sink_context.h index 185572e29..66925b48e 100644 --- a/src/audio_core/renderer/sink/sink_context.h +++ b/src/audio_core/renderer/sink/sink_context.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #include "audio_core/renderer/sink/sink_info_base.h" | 8 | #include "audio_core/renderer/sink/sink_info_base.h" |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | 10 | ||
| 11 | namespace AudioCore::AudioRenderer { | 11 | namespace AudioCore::Renderer { |
| 12 | /** | 12 | /** |
| 13 | * Manages output sinks. | 13 | * Manages output sinks. |
| 14 | */ | 14 | */ |
| @@ -44,4 +44,4 @@ private: | |||
| 44 | u32 sink_count{}; | 44 | u32 sink_count{}; |
| 45 | }; | 45 | }; |
| 46 | 46 | ||
| 47 | } // namespace AudioCore::AudioRenderer | 47 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/sink/sink_info_base.cpp b/src/audio_core/renderer/sink/sink_info_base.cpp index 4279beaa0..8a064f15a 100644 --- a/src/audio_core/renderer/sink/sink_info_base.cpp +++ b/src/audio_core/renderer/sink/sink_info_base.cpp | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | #include "audio_core/renderer/memory/pool_mapper.h" | 4 | #include "audio_core/renderer/memory/pool_mapper.h" |
| 5 | #include "audio_core/renderer/sink/sink_info_base.h" | 5 | #include "audio_core/renderer/sink/sink_info_base.h" |
| 6 | 6 | ||
| 7 | namespace AudioCore::AudioRenderer { | 7 | namespace AudioCore::Renderer { |
| 8 | 8 | ||
| 9 | void SinkInfoBase::CleanUp() { | 9 | void SinkInfoBase::CleanUp() { |
| 10 | type = Type::Invalid; | 10 | type = Type::Invalid; |
| @@ -48,4 +48,4 @@ u8* SinkInfoBase::GetParameter() { | |||
| 48 | return parameter.data(); | 48 | return parameter.data(); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | } // namespace AudioCore::AudioRenderer | 51 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/sink/sink_info_base.h b/src/audio_core/renderer/sink/sink_info_base.h index a1b855f20..e10d1cb38 100644 --- a/src/audio_core/renderer/sink/sink_info_base.h +++ b/src/audio_core/renderer/sink/sink_info_base.h | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | #include "common/fixed_point.h" | 12 | #include "common/fixed_point.h" |
| 13 | 13 | ||
| 14 | namespace AudioCore::AudioRenderer { | 14 | namespace AudioCore::Renderer { |
| 15 | struct UpsamplerInfo; | 15 | struct UpsamplerInfo; |
| 16 | class PoolMapper; | 16 | class PoolMapper; |
| 17 | 17 | ||
| @@ -174,4 +174,4 @@ protected: | |||
| 174 | parameter{}; | 174 | parameter{}; |
| 175 | }; | 175 | }; |
| 176 | 176 | ||
| 177 | } // namespace AudioCore::AudioRenderer | 177 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/splitter/splitter_context.cpp b/src/audio_core/renderer/splitter/splitter_context.cpp index 7a23ba43f..686150ea6 100644 --- a/src/audio_core/renderer/splitter/splitter_context.cpp +++ b/src/audio_core/renderer/splitter/splitter_context.cpp | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | #include "audio_core/renderer/splitter/splitter_context.h" | 7 | #include "audio_core/renderer/splitter/splitter_context.h" |
| 8 | #include "common/alignment.h" | 8 | #include "common/alignment.h" |
| 9 | 9 | ||
| 10 | namespace AudioCore::AudioRenderer { | 10 | namespace AudioCore::Renderer { |
| 11 | 11 | ||
| 12 | SplitterDestinationData* SplitterContext::GetDesintationData(const s32 splitter_id, | 12 | SplitterDestinationData* SplitterContext::GetDesintationData(const s32 splitter_id, |
| 13 | const s32 destination_id) { | 13 | const s32 destination_id) { |
| @@ -214,4 +214,4 @@ u64 SplitterContext::CalcWorkBufferSize(const BehaviorInfo& behavior, | |||
| 214 | return size; | 214 | return size; |
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | } // namespace AudioCore::AudioRenderer | 217 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/splitter/splitter_context.h b/src/audio_core/renderer/splitter/splitter_context.h index 1a63db1d3..556e6dcc3 100644 --- a/src/audio_core/renderer/splitter/splitter_context.h +++ b/src/audio_core/renderer/splitter/splitter_context.h | |||
| @@ -13,7 +13,7 @@ namespace AudioCore { | |||
| 13 | struct AudioRendererParameterInternal; | 13 | struct AudioRendererParameterInternal; |
| 14 | class WorkbufferAllocator; | 14 | class WorkbufferAllocator; |
| 15 | 15 | ||
| 16 | namespace AudioRenderer { | 16 | namespace Renderer { |
| 17 | class BehaviorInfo; | 17 | class BehaviorInfo; |
| 18 | 18 | ||
| 19 | /** | 19 | /** |
| @@ -185,5 +185,5 @@ private: | |||
| 185 | bool splitter_bug_fixed{}; | 185 | bool splitter_bug_fixed{}; |
| 186 | }; | 186 | }; |
| 187 | 187 | ||
| 188 | } // namespace AudioRenderer | 188 | } // namespace Renderer |
| 189 | } // namespace AudioCore | 189 | } // namespace AudioCore |
diff --git a/src/audio_core/renderer/splitter/splitter_destinations_data.cpp b/src/audio_core/renderer/splitter/splitter_destinations_data.cpp index b27d44896..5ec37e48e 100644 --- a/src/audio_core/renderer/splitter/splitter_destinations_data.cpp +++ b/src/audio_core/renderer/splitter/splitter_destinations_data.cpp | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/splitter/splitter_destinations_data.h" | 4 | #include "audio_core/renderer/splitter/splitter_destinations_data.h" |
| 5 | 5 | ||
| 6 | namespace AudioCore::AudioRenderer { | 6 | namespace AudioCore::Renderer { |
| 7 | 7 | ||
| 8 | SplitterDestinationData::SplitterDestinationData(const s32 id_) : id{id_} {} | 8 | SplitterDestinationData::SplitterDestinationData(const s32 id_) : id{id_} {} |
| 9 | 9 | ||
| @@ -84,4 +84,4 @@ void SplitterDestinationData::SetNext(SplitterDestinationData* next_) { | |||
| 84 | next = next_; | 84 | next = next_; |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | } // namespace AudioCore::AudioRenderer | 87 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/splitter/splitter_destinations_data.h b/src/audio_core/renderer/splitter/splitter_destinations_data.h index d55ce0ad3..90edfc667 100644 --- a/src/audio_core/renderer/splitter/splitter_destinations_data.h +++ b/src/audio_core/renderer/splitter/splitter_destinations_data.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include "audio_core/common/common.h" | 9 | #include "audio_core/common/common.h" |
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | 11 | ||
| 12 | namespace AudioCore::AudioRenderer { | 12 | namespace AudioCore::Renderer { |
| 13 | /** | 13 | /** |
| 14 | * Represents a mixing node, can be connected to a previous and next destination forming a chain | 14 | * Represents a mixing node, can be connected to a previous and next destination forming a chain |
| 15 | * that a certain mix buffer will pass through to output. | 15 | * that a certain mix buffer will pass through to output. |
| @@ -132,4 +132,4 @@ private: | |||
| 132 | bool need_update{}; | 132 | bool need_update{}; |
| 133 | }; | 133 | }; |
| 134 | 134 | ||
| 135 | } // namespace AudioCore::AudioRenderer | 135 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/splitter/splitter_info.cpp b/src/audio_core/renderer/splitter/splitter_info.cpp index 1aee6720b..beb5b7f19 100644 --- a/src/audio_core/renderer/splitter/splitter_info.cpp +++ b/src/audio_core/renderer/splitter/splitter_info.cpp | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/splitter/splitter_info.h" | 4 | #include "audio_core/renderer/splitter/splitter_info.h" |
| 5 | 5 | ||
| 6 | namespace AudioCore::AudioRenderer { | 6 | namespace AudioCore::Renderer { |
| 7 | 7 | ||
| 8 | SplitterInfo::SplitterInfo(const s32 id_) : id{id_} {} | 8 | SplitterInfo::SplitterInfo(const s32 id_) : id{id_} {} |
| 9 | 9 | ||
| @@ -76,4 +76,4 @@ void SplitterInfo::SetDestinations(SplitterDestinationData* destinations_) { | |||
| 76 | destinations = destinations_; | 76 | destinations = destinations_; |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | } // namespace AudioCore::AudioRenderer | 79 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/splitter/splitter_info.h b/src/audio_core/renderer/splitter/splitter_info.h index b0ad01fe0..c1e4c2df1 100644 --- a/src/audio_core/renderer/splitter/splitter_info.h +++ b/src/audio_core/renderer/splitter/splitter_info.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include "audio_core/renderer/splitter/splitter_destinations_data.h" | 6 | #include "audio_core/renderer/splitter/splitter_destinations_data.h" |
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | 8 | ||
| 9 | namespace AudioCore::AudioRenderer { | 9 | namespace AudioCore::Renderer { |
| 10 | /** | 10 | /** |
| 11 | * Represents a splitter, wraps multiple output destinations to split an input mix into. | 11 | * Represents a splitter, wraps multiple output destinations to split an input mix into. |
| 12 | */ | 12 | */ |
| @@ -104,4 +104,4 @@ private: | |||
| 104 | u32 channel_count{}; | 104 | u32 channel_count{}; |
| 105 | }; | 105 | }; |
| 106 | 106 | ||
| 107 | } // namespace AudioCore::AudioRenderer | 107 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/system.cpp b/src/audio_core/renderer/system.cpp index 6e07baa54..d29754634 100644 --- a/src/audio_core/renderer/system.cpp +++ b/src/audio_core/renderer/system.cpp | |||
| @@ -4,12 +4,13 @@ | |||
| 4 | #include <chrono> | 4 | #include <chrono> |
| 5 | #include <span> | 5 | #include <span> |
| 6 | 6 | ||
| 7 | #include "audio_core/adsp/apps/audio_renderer/audio_renderer.h" | ||
| 8 | #include "audio_core/adsp/apps/audio_renderer/command_buffer.h" | ||
| 7 | #include "audio_core/audio_core.h" | 9 | #include "audio_core/audio_core.h" |
| 8 | #include "audio_core/common/audio_renderer_parameter.h" | 10 | #include "audio_core/common/audio_renderer_parameter.h" |
| 9 | #include "audio_core/common/common.h" | 11 | #include "audio_core/common/common.h" |
| 10 | #include "audio_core/common/feature_support.h" | 12 | #include "audio_core/common/feature_support.h" |
| 11 | #include "audio_core/common/workbuffer_allocator.h" | 13 | #include "audio_core/common/workbuffer_allocator.h" |
| 12 | #include "audio_core/renderer/adsp/adsp.h" | ||
| 13 | #include "audio_core/renderer/behavior/info_updater.h" | 14 | #include "audio_core/renderer/behavior/info_updater.h" |
| 14 | #include "audio_core/renderer/command/command_buffer.h" | 15 | #include "audio_core/renderer/command/command_buffer.h" |
| 15 | #include "audio_core/renderer/command/command_generator.h" | 16 | #include "audio_core/renderer/command/command_generator.h" |
| @@ -34,7 +35,7 @@ | |||
| 34 | #include "core/hle/kernel/k_transfer_memory.h" | 35 | #include "core/hle/kernel/k_transfer_memory.h" |
| 35 | #include "core/memory.h" | 36 | #include "core/memory.h" |
| 36 | 37 | ||
| 37 | namespace AudioCore::AudioRenderer { | 38 | namespace AudioCore::Renderer { |
| 38 | 39 | ||
| 39 | u64 System::GetWorkBufferSize(const AudioRendererParameterInternal& params) { | 40 | u64 System::GetWorkBufferSize(const AudioRendererParameterInternal& params) { |
| 40 | BehaviorInfo behavior; | 41 | BehaviorInfo behavior; |
| @@ -95,7 +96,8 @@ u64 System::GetWorkBufferSize(const AudioRendererParameterInternal& params) { | |||
| 95 | } | 96 | } |
| 96 | 97 | ||
| 97 | System::System(Core::System& core_, Kernel::KEvent* adsp_rendered_event_) | 98 | System::System(Core::System& core_, Kernel::KEvent* adsp_rendered_event_) |
| 98 | : core{core_}, adsp{core.AudioCore().GetADSP()}, adsp_rendered_event{adsp_rendered_event_} {} | 99 | : core{core_}, audio_renderer{core.AudioCore().ADSP().AudioRenderer()}, |
| 100 | adsp_rendered_event{adsp_rendered_event_} {} | ||
| 99 | 101 | ||
| 100 | Result System::Initialize(const AudioRendererParameterInternal& params, | 102 | Result System::Initialize(const AudioRendererParameterInternal& params, |
| 101 | Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size, | 103 | Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size, |
| @@ -443,7 +445,7 @@ void System::Stop() { | |||
| 443 | Result System::Update(std::span<const u8> input, std::span<u8> performance, std::span<u8> output) { | 445 | Result System::Update(std::span<const u8> input, std::span<u8> performance, std::span<u8> output) { |
| 444 | std::scoped_lock l{lock}; | 446 | std::scoped_lock l{lock}; |
| 445 | 447 | ||
| 446 | const auto start_time{core.CoreTiming().GetClockTicks()}; | 448 | const auto start_time{core.CoreTiming().GetGlobalTimeNs().count()}; |
| 447 | std::memset(output.data(), 0, output.size()); | 449 | std::memset(output.data(), 0, output.size()); |
| 448 | 450 | ||
| 449 | InfoUpdater info_updater(input, output, process_handle, behavior); | 451 | InfoUpdater info_updater(input, output, process_handle, behavior); |
| @@ -535,7 +537,7 @@ Result System::Update(std::span<const u8> input, std::span<u8> performance, std: | |||
| 535 | adsp_rendered_event->Clear(); | 537 | adsp_rendered_event->Clear(); |
| 536 | num_times_updated++; | 538 | num_times_updated++; |
| 537 | 539 | ||
| 538 | const auto end_time{core.CoreTiming().GetClockTicks()}; | 540 | const auto end_time{core.CoreTiming().GetGlobalTimeNs().count()}; |
| 539 | ticks_spent_updating += end_time - start_time; | 541 | ticks_spent_updating += end_time - start_time; |
| 540 | 542 | ||
| 541 | return ResultSuccess; | 543 | return ResultSuccess; |
| @@ -583,7 +585,7 @@ void System::SendCommandToDsp() { | |||
| 583 | if (initialized) { | 585 | if (initialized) { |
| 584 | if (active) { | 586 | if (active) { |
| 585 | terminate_event.Reset(); | 587 | terminate_event.Reset(); |
| 586 | const auto remaining_command_count{adsp.GetRemainCommandCount(session_id)}; | 588 | const auto remaining_command_count{audio_renderer.GetRemainCommandCount(session_id)}; |
| 587 | u64 command_size{0}; | 589 | u64 command_size{0}; |
| 588 | 590 | ||
| 589 | if (remaining_command_count) { | 591 | if (remaining_command_count) { |
| @@ -607,26 +609,18 @@ void System::SendCommandToDsp() { | |||
| 607 | time_limit_percent = 70.0f; | 609 | time_limit_percent = 70.0f; |
| 608 | } | 610 | } |
| 609 | 611 | ||
| 610 | ADSP::CommandBuffer command_buffer{ | 612 | auto time_limit{ |
| 611 | .buffer{translated_addr}, | 613 | static_cast<u64>((time_limit_percent / 100) * 2'880'000.0 * |
| 612 | .size{command_size}, | 614 | (static_cast<f32>(render_time_limit_percent) / 100.0f))}; |
| 613 | .time_limit{ | 615 | audio_renderer.SetCommandBuffer(session_id, translated_addr, command_size, time_limit, |
| 614 | static_cast<u64>((time_limit_percent / 100) * 2'880'000.0 * | 616 | applet_resource_user_id, reset_command_buffers); |
| 615 | (static_cast<f32>(render_time_limit_percent) / 100.0f))}, | ||
| 616 | .remaining_command_count{remaining_command_count}, | ||
| 617 | .reset_buffers{reset_command_buffers}, | ||
| 618 | .applet_resource_user_id{applet_resource_user_id}, | ||
| 619 | .render_time_taken{adsp.GetRenderTimeTaken(session_id)}, | ||
| 620 | }; | ||
| 621 | |||
| 622 | adsp.SendCommandBuffer(session_id, command_buffer); | ||
| 623 | reset_command_buffers = false; | 617 | reset_command_buffers = false; |
| 624 | command_buffer_size = command_size; | 618 | command_buffer_size = command_size; |
| 625 | if (remaining_command_count == 0) { | 619 | if (remaining_command_count == 0) { |
| 626 | adsp_rendered_event->Signal(); | 620 | adsp_rendered_event->Signal(); |
| 627 | } | 621 | } |
| 628 | } else { | 622 | } else { |
| 629 | adsp.ClearRemainCount(session_id); | 623 | audio_renderer.ClearRemainCommandCount(session_id); |
| 630 | terminate_event.Set(); | 624 | terminate_event.Set(); |
| 631 | } | 625 | } |
| 632 | } | 626 | } |
| @@ -635,7 +629,7 @@ void System::SendCommandToDsp() { | |||
| 635 | u64 System::GenerateCommand(std::span<u8> in_command_buffer, | 629 | u64 System::GenerateCommand(std::span<u8> in_command_buffer, |
| 636 | [[maybe_unused]] u64 command_buffer_size_) { | 630 | [[maybe_unused]] u64 command_buffer_size_) { |
| 637 | PoolMapper::ClearUseState(memory_pool_workbuffer, memory_pool_count); | 631 | PoolMapper::ClearUseState(memory_pool_workbuffer, memory_pool_count); |
| 638 | const auto start_time{core.CoreTiming().GetClockTicks()}; | 632 | const auto start_time{core.CoreTiming().GetGlobalTimeNs().count()}; |
| 639 | 633 | ||
| 640 | auto command_list_header{reinterpret_cast<CommandListHeader*>(in_command_buffer.data())}; | 634 | auto command_list_header{reinterpret_cast<CommandListHeader*>(in_command_buffer.data())}; |
| 641 | 635 | ||
| @@ -732,10 +726,10 @@ u64 System::GenerateCommand(std::span<u8> in_command_buffer, | |||
| 732 | effect_context.UpdateStateByDspShared(); | 726 | effect_context.UpdateStateByDspShared(); |
| 733 | } | 727 | } |
| 734 | 728 | ||
| 735 | const auto end_time{core.CoreTiming().GetClockTicks()}; | 729 | const auto end_time{core.CoreTiming().GetGlobalTimeNs().count()}; |
| 736 | total_ticks_elapsed += end_time - start_time; | 730 | total_ticks_elapsed += end_time - start_time; |
| 737 | num_command_lists_generated++; | 731 | num_command_lists_generated++; |
| 738 | render_start_tick = adsp.GetRenderingStartTick(session_id); | 732 | render_start_tick = audio_renderer.GetRenderingStartTick(session_id); |
| 739 | frames_elapsed++; | 733 | frames_elapsed++; |
| 740 | 734 | ||
| 741 | return command_buffer.size; | 735 | return command_buffer.size; |
| @@ -819,4 +813,4 @@ u32 System::DropVoices(CommandBuffer& command_buffer, u32 estimated_process_time | |||
| 819 | return voices_dropped; | 813 | return voices_dropped; |
| 820 | } | 814 | } |
| 821 | 815 | ||
| 822 | } // namespace AudioCore::AudioRenderer | 816 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/system.h b/src/audio_core/renderer/system.h index e328783b6..8a8341710 100644 --- a/src/audio_core/renderer/system.h +++ b/src/audio_core/renderer/system.h | |||
| @@ -34,12 +34,16 @@ class KTransferMemory; | |||
| 34 | 34 | ||
| 35 | namespace AudioCore { | 35 | namespace AudioCore { |
| 36 | struct AudioRendererParameterInternal; | 36 | struct AudioRendererParameterInternal; |
| 37 | |||
| 38 | namespace AudioRenderer { | ||
| 39 | class CommandBuffer; | ||
| 40 | namespace ADSP { | 37 | namespace ADSP { |
| 41 | class ADSP; | 38 | class ADSP; |
| 39 | namespace AudioRenderer { | ||
| 40 | class AudioRenderer; | ||
| 42 | } | 41 | } |
| 42 | } // namespace ADSP | ||
| 43 | |||
| 44 | namespace Renderer { | ||
| 45 | using namespace ::AudioCore::ADSP; | ||
| 46 | class CommandBuffer; | ||
| 43 | 47 | ||
| 44 | /** | 48 | /** |
| 45 | * Audio Renderer System, the main worker for audio rendering. | 49 | * Audio Renderer System, the main worker for audio rendering. |
| @@ -213,8 +217,8 @@ public: | |||
| 213 | private: | 217 | private: |
| 214 | /// Core system | 218 | /// Core system |
| 215 | Core::System& core; | 219 | Core::System& core; |
| 216 | /// Reference to the ADSP for communication | 220 | /// Reference to the ADSP's AudioRenderer for communication |
| 217 | ADSP::ADSP& adsp; | 221 | ::AudioCore::ADSP::AudioRenderer::AudioRenderer& audio_renderer; |
| 218 | /// Is this system initialized? | 222 | /// Is this system initialized? |
| 219 | bool initialized{}; | 223 | bool initialized{}; |
| 220 | /// Is this system currently active? | 224 | /// Is this system currently active? |
| @@ -319,5 +323,5 @@ private: | |||
| 319 | f32 drop_voice_param{1.0f}; | 323 | f32 drop_voice_param{1.0f}; |
| 320 | }; | 324 | }; |
| 321 | 325 | ||
| 322 | } // namespace AudioRenderer | 326 | } // namespace Renderer |
| 323 | } // namespace AudioCore | 327 | } // namespace AudioCore |
diff --git a/src/audio_core/renderer/system_manager.cpp b/src/audio_core/renderer/system_manager.cpp index 300ecdbf1..a0b8ef29e 100644 --- a/src/audio_core/renderer/system_manager.cpp +++ b/src/audio_core/renderer/system_manager.cpp | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | 3 | ||
| 4 | #include <chrono> | 4 | #include <chrono> |
| 5 | 5 | ||
| 6 | #include "audio_core/adsp/adsp.h" | ||
| 6 | #include "audio_core/audio_core.h" | 7 | #include "audio_core/audio_core.h" |
| 7 | #include "audio_core/renderer/adsp/adsp.h" | ||
| 8 | #include "audio_core/renderer/system_manager.h" | 8 | #include "audio_core/renderer/system_manager.h" |
| 9 | #include "common/microprofile.h" | 9 | #include "common/microprofile.h" |
| 10 | #include "common/thread.h" | 10 | #include "common/thread.h" |
| @@ -14,24 +14,21 @@ | |||
| 14 | MICROPROFILE_DEFINE(Audio_RenderSystemManager, "Audio", "Render System Manager", | 14 | MICROPROFILE_DEFINE(Audio_RenderSystemManager, "Audio", "Render System Manager", |
| 15 | MP_RGB(60, 19, 97)); | 15 | MP_RGB(60, 19, 97)); |
| 16 | 16 | ||
| 17 | namespace AudioCore::AudioRenderer { | 17 | namespace AudioCore::Renderer { |
| 18 | 18 | ||
| 19 | SystemManager::SystemManager(Core::System& core_) | 19 | SystemManager::SystemManager(Core::System& core_) |
| 20 | : core{core_}, adsp{core.AudioCore().GetADSP()}, mailbox{adsp.GetRenderMailbox()} {} | 20 | : core{core_}, audio_renderer{core.AudioCore().ADSP().AudioRenderer()} {} |
| 21 | 21 | ||
| 22 | SystemManager::~SystemManager() { | 22 | SystemManager::~SystemManager() { |
| 23 | Stop(); | 23 | Stop(); |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | bool SystemManager::InitializeUnsafe() { | 26 | void SystemManager::InitializeUnsafe() { |
| 27 | if (!active) { | 27 | if (!active) { |
| 28 | if (adsp.Start()) { | 28 | active = true; |
| 29 | active = true; | 29 | audio_renderer.Start(); |
| 30 | thread = std::jthread([this](std::stop_token stop_token) { ThreadFunc(stop_token); }); | 30 | thread = std::jthread([this](std::stop_token stop_token) { ThreadFunc(stop_token); }); |
| 31 | } | ||
| 32 | } | 31 | } |
| 33 | |||
| 34 | return adsp.GetState() == ADSP::State::Started; | ||
| 35 | } | 32 | } |
| 36 | 33 | ||
| 37 | void SystemManager::Stop() { | 34 | void SystemManager::Stop() { |
| @@ -41,7 +38,7 @@ void SystemManager::Stop() { | |||
| 41 | active = false; | 38 | active = false; |
| 42 | thread.request_stop(); | 39 | thread.request_stop(); |
| 43 | thread.join(); | 40 | thread.join(); |
| 44 | adsp.Stop(); | 41 | audio_renderer.Stop(); |
| 45 | } | 42 | } |
| 46 | 43 | ||
| 47 | bool SystemManager::Add(System& system_) { | 44 | bool SystemManager::Add(System& system_) { |
| @@ -55,10 +52,7 @@ bool SystemManager::Add(System& system_) { | |||
| 55 | { | 52 | { |
| 56 | std::scoped_lock l{mutex1}; | 53 | std::scoped_lock l{mutex1}; |
| 57 | if (systems.empty()) { | 54 | if (systems.empty()) { |
| 58 | if (!InitializeUnsafe()) { | 55 | InitializeUnsafe(); |
| 59 | LOG_ERROR(Service_Audio, "Failed to start the AudioRenderer SystemManager"); | ||
| 60 | return false; | ||
| 61 | } | ||
| 62 | } | 56 | } |
| 63 | } | 57 | } |
| 64 | 58 | ||
| @@ -100,9 +94,9 @@ void SystemManager::ThreadFunc(std::stop_token stop_token) { | |||
| 100 | } | 94 | } |
| 101 | } | 95 | } |
| 102 | 96 | ||
| 103 | adsp.Signal(); | 97 | audio_renderer.Signal(); |
| 104 | adsp.Wait(); | 98 | audio_renderer.Wait(); |
| 105 | } | 99 | } |
| 106 | } | 100 | } |
| 107 | 101 | ||
| 108 | } // namespace AudioCore::AudioRenderer | 102 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/system_manager.h b/src/audio_core/renderer/system_manager.h index 9681fd121..62e8e5f15 100644 --- a/src/audio_core/renderer/system_manager.h +++ b/src/audio_core/renderer/system_manager.h | |||
| @@ -18,11 +18,14 @@ struct EventType; | |||
| 18 | class System; | 18 | class System; |
| 19 | } // namespace Core | 19 | } // namespace Core |
| 20 | 20 | ||
| 21 | namespace AudioCore::AudioRenderer { | 21 | namespace AudioCore::ADSP { |
| 22 | namespace ADSP { | ||
| 23 | class ADSP; | 22 | class ADSP; |
| 24 | class AudioRenderer_Mailbox; | 23 | namespace AudioRenderer { |
| 25 | } // namespace ADSP | 24 | class AudioRenderer; |
| 25 | } // namespace AudioRenderer | ||
| 26 | } // namespace AudioCore::ADSP | ||
| 27 | |||
| 28 | namespace AudioCore::Renderer { | ||
| 26 | 29 | ||
| 27 | /** | 30 | /** |
| 28 | * Manages all audio renderers, responsible for triggering command list generation and signalling | 31 | * Manages all audio renderers, responsible for triggering command list generation and signalling |
| @@ -38,7 +41,7 @@ public: | |||
| 38 | * | 41 | * |
| 39 | * @return True if successfully initialized, otherwise false. | 42 | * @return True if successfully initialized, otherwise false. |
| 40 | */ | 43 | */ |
| 41 | bool InitializeUnsafe(); | 44 | void InitializeUnsafe(); |
| 42 | 45 | ||
| 43 | /** | 46 | /** |
| 44 | * Stop the system manager. | 47 | * Stop the system manager. |
| @@ -80,10 +83,8 @@ private: | |||
| 80 | std::mutex mutex2{}; | 83 | std::mutex mutex2{}; |
| 81 | /// Is the system manager thread active? | 84 | /// Is the system manager thread active? |
| 82 | std::atomic<bool> active{}; | 85 | std::atomic<bool> active{}; |
| 83 | /// Reference to the ADSP for communication | 86 | /// Reference to the ADSP's AudioRenderer for communication |
| 84 | ADSP::ADSP& adsp; | 87 | ::AudioCore::ADSP::AudioRenderer::AudioRenderer& audio_renderer; |
| 85 | /// AudioRenderer mailbox for communication | ||
| 86 | ADSP::AudioRenderer_Mailbox* mailbox{}; | ||
| 87 | }; | 88 | }; |
| 88 | 89 | ||
| 89 | } // namespace AudioCore::AudioRenderer | 90 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/upsampler/upsampler_info.h b/src/audio_core/renderer/upsampler/upsampler_info.h index a43c15af3..85c87f137 100644 --- a/src/audio_core/renderer/upsampler/upsampler_info.h +++ b/src/audio_core/renderer/upsampler/upsampler_info.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include "audio_core/renderer/upsampler/upsampler_state.h" | 9 | #include "audio_core/renderer/upsampler/upsampler_state.h" |
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | 11 | ||
| 12 | namespace AudioCore::AudioRenderer { | 12 | namespace AudioCore::Renderer { |
| 13 | class UpsamplerManager; | 13 | class UpsamplerManager; |
| 14 | 14 | ||
| 15 | /** | 15 | /** |
| @@ -32,4 +32,4 @@ struct UpsamplerInfo { | |||
| 32 | std::array<s16, MaxChannels> inputs{}; | 32 | std::array<s16, MaxChannels> inputs{}; |
| 33 | }; | 33 | }; |
| 34 | 34 | ||
| 35 | } // namespace AudioCore::AudioRenderer | 35 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/upsampler/upsampler_manager.cpp b/src/audio_core/renderer/upsampler/upsampler_manager.cpp index 4c76a5066..ef740f6c9 100644 --- a/src/audio_core/renderer/upsampler/upsampler_manager.cpp +++ b/src/audio_core/renderer/upsampler/upsampler_manager.cpp | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include "audio_core/renderer/upsampler/upsampler_manager.h" | 4 | #include "audio_core/renderer/upsampler/upsampler_manager.h" |
| 5 | 5 | ||
| 6 | namespace AudioCore::AudioRenderer { | 6 | namespace AudioCore::Renderer { |
| 7 | 7 | ||
| 8 | UpsamplerManager::UpsamplerManager(const u32 count_, std::span<UpsamplerInfo> infos_, | 8 | UpsamplerManager::UpsamplerManager(const u32 count_, std::span<UpsamplerInfo> infos_, |
| 9 | std::span<s32> workbuffer_) | 9 | std::span<s32> workbuffer_) |
| @@ -41,4 +41,4 @@ void UpsamplerManager::Free(UpsamplerInfo* info) { | |||
| 41 | info->enabled = false; | 41 | info->enabled = false; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | } // namespace AudioCore::AudioRenderer | 44 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/upsampler/upsampler_manager.h b/src/audio_core/renderer/upsampler/upsampler_manager.h index 83c697c0c..263e5718b 100644 --- a/src/audio_core/renderer/upsampler/upsampler_manager.h +++ b/src/audio_core/renderer/upsampler/upsampler_manager.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include "audio_core/renderer/upsampler/upsampler_info.h" | 9 | #include "audio_core/renderer/upsampler/upsampler_info.h" |
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | 11 | ||
| 12 | namespace AudioCore::AudioRenderer { | 12 | namespace AudioCore::Renderer { |
| 13 | /** | 13 | /** |
| 14 | * Manages and has utility functions for upsampler infos. | 14 | * Manages and has utility functions for upsampler infos. |
| 15 | */ | 15 | */ |
| @@ -42,4 +42,4 @@ private: | |||
| 42 | std::mutex lock{}; | 42 | std::mutex lock{}; |
| 43 | }; | 43 | }; |
| 44 | 44 | ||
| 45 | } // namespace AudioCore::AudioRenderer | 45 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/upsampler/upsampler_state.h b/src/audio_core/renderer/upsampler/upsampler_state.h index 28cebe200..dc7b31d42 100644 --- a/src/audio_core/renderer/upsampler/upsampler_state.h +++ b/src/audio_core/renderer/upsampler/upsampler_state.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | #include "common/fixed_point.h" | 9 | #include "common/fixed_point.h" |
| 10 | 10 | ||
| 11 | namespace AudioCore::AudioRenderer { | 11 | namespace AudioCore::Renderer { |
| 12 | /** | 12 | /** |
| 13 | * Upsampling state used by the AudioRenderer across calls. | 13 | * Upsampling state used by the AudioRenderer across calls. |
| 14 | */ | 14 | */ |
| @@ -37,4 +37,4 @@ struct UpsamplerState { | |||
| 37 | u8 sample_index; | 37 | u8 sample_index; |
| 38 | }; | 38 | }; |
| 39 | 39 | ||
| 40 | } // namespace AudioCore::AudioRenderer | 40 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/voice/voice_channel_resource.h b/src/audio_core/renderer/voice/voice_channel_resource.h index 26ab4ccce..4f19c2fcc 100644 --- a/src/audio_core/renderer/voice/voice_channel_resource.h +++ b/src/audio_core/renderer/voice/voice_channel_resource.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #include "audio_core/common/common.h" | 8 | #include "audio_core/common/common.h" |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | 10 | ||
| 11 | namespace AudioCore::AudioRenderer { | 11 | namespace AudioCore::Renderer { |
| 12 | /** | 12 | /** |
| 13 | * Represents one channel for mixing a voice. | 13 | * Represents one channel for mixing a voice. |
| 14 | */ | 14 | */ |
| @@ -35,4 +35,4 @@ public: | |||
| 35 | bool in_use{}; | 35 | bool in_use{}; |
| 36 | }; | 36 | }; |
| 37 | 37 | ||
| 38 | } // namespace AudioCore::AudioRenderer | 38 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/voice/voice_context.cpp b/src/audio_core/renderer/voice/voice_context.cpp index 16a3e839d..c3644e38b 100644 --- a/src/audio_core/renderer/voice/voice_context.cpp +++ b/src/audio_core/renderer/voice/voice_context.cpp | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include "audio_core/renderer/voice/voice_context.h" | 6 | #include "audio_core/renderer/voice/voice_context.h" |
| 7 | #include "common/polyfill_ranges.h" | 7 | #include "common/polyfill_ranges.h" |
| 8 | 8 | ||
| 9 | namespace AudioCore::AudioRenderer { | 9 | namespace AudioCore::Renderer { |
| 10 | 10 | ||
| 11 | VoiceState& VoiceContext::GetDspSharedState(const u32 index) { | 11 | VoiceState& VoiceContext::GetDspSharedState(const u32 index) { |
| 12 | if (index >= dsp_states.size()) { | 12 | if (index >= dsp_states.size()) { |
| @@ -84,4 +84,4 @@ void VoiceContext::UpdateStateByDspShared() { | |||
| 84 | std::memcpy(cpu_states.data(), dsp_states.data(), voice_count * sizeof(VoiceState)); | 84 | std::memcpy(cpu_states.data(), dsp_states.data(), voice_count * sizeof(VoiceState)); |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | } // namespace AudioCore::AudioRenderer | 87 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/voice/voice_context.h b/src/audio_core/renderer/voice/voice_context.h index 43b677154..138ab2773 100644 --- a/src/audio_core/renderer/voice/voice_context.h +++ b/src/audio_core/renderer/voice/voice_context.h | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | #include "audio_core/renderer/voice/voice_state.h" | 10 | #include "audio_core/renderer/voice/voice_state.h" |
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | 12 | ||
| 13 | namespace AudioCore::AudioRenderer { | 13 | namespace AudioCore::Renderer { |
| 14 | /** | 14 | /** |
| 15 | * Contains all voices, with utility functions for managing them. | 15 | * Contains all voices, with utility functions for managing them. |
| 16 | */ | 16 | */ |
| @@ -123,4 +123,4 @@ private: | |||
| 123 | u32 active_count{}; | 123 | u32 active_count{}; |
| 124 | }; | 124 | }; |
| 125 | 125 | ||
| 126 | } // namespace AudioCore::AudioRenderer | 126 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/voice/voice_info.cpp b/src/audio_core/renderer/voice/voice_info.cpp index c0bfb23fc..6239cfab7 100644 --- a/src/audio_core/renderer/voice/voice_info.cpp +++ b/src/audio_core/renderer/voice/voice_info.cpp | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include "audio_core/renderer/voice/voice_info.h" | 6 | #include "audio_core/renderer/voice/voice_info.h" |
| 7 | #include "audio_core/renderer/voice/voice_state.h" | 7 | #include "audio_core/renderer/voice/voice_state.h" |
| 8 | 8 | ||
| 9 | namespace AudioCore::AudioRenderer { | 9 | namespace AudioCore::Renderer { |
| 10 | 10 | ||
| 11 | VoiceInfo::VoiceInfo() { | 11 | VoiceInfo::VoiceInfo() { |
| 12 | Initialize(); | 12 | Initialize(); |
| @@ -405,4 +405,4 @@ void VoiceInfo::ResetResources(VoiceContext& voice_context) const { | |||
| 405 | } | 405 | } |
| 406 | } | 406 | } |
| 407 | 407 | ||
| 408 | } // namespace AudioCore::AudioRenderer | 408 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/voice/voice_info.h b/src/audio_core/renderer/voice/voice_info.h index 3c5d3e04f..14a687dcb 100644 --- a/src/audio_core/renderer/voice/voice_info.h +++ b/src/audio_core/renderer/voice/voice_info.h | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | #include "audio_core/renderer/memory/address_info.h" | 12 | #include "audio_core/renderer/memory/address_info.h" |
| 13 | #include "common/common_types.h" | 13 | #include "common/common_types.h" |
| 14 | 14 | ||
| 15 | namespace AudioCore::AudioRenderer { | 15 | namespace AudioCore::Renderer { |
| 16 | class PoolMapper; | 16 | class PoolMapper; |
| 17 | class VoiceContext; | 17 | class VoiceContext; |
| 18 | struct VoiceState; | 18 | struct VoiceState; |
| @@ -377,4 +377,4 @@ public: | |||
| 377 | u8 flush_buffer_count{}; | 377 | u8 flush_buffer_count{}; |
| 378 | }; | 378 | }; |
| 379 | 379 | ||
| 380 | } // namespace AudioCore::AudioRenderer | 380 | } // namespace AudioCore::Renderer |
diff --git a/src/audio_core/renderer/voice/voice_state.h b/src/audio_core/renderer/voice/voice_state.h index ce947233f..c7aee167b 100644 --- a/src/audio_core/renderer/voice/voice_state.h +++ b/src/audio_core/renderer/voice/voice_state.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | #include "common/fixed_point.h" | 10 | #include "common/fixed_point.h" |
| 11 | 11 | ||
| 12 | namespace AudioCore::AudioRenderer { | 12 | namespace AudioCore::Renderer { |
| 13 | /** | 13 | /** |
| 14 | * Holds a state for a voice. One is kept host-side, and one is used by the AudioRenderer, | 14 | * Holds a state for a voice. One is kept host-side, and one is used by the AudioRenderer, |
| 15 | * host-side is updated on the next iteration. | 15 | * host-side is updated on the next iteration. |
| @@ -67,4 +67,4 @@ struct VoiceState { | |||
| 67 | s32 loop_count; | 67 | s32 loop_count; |
| 68 | }; | 68 | }; |
| 69 | 69 | ||
| 70 | } // namespace AudioCore::AudioRenderer | 70 | } // namespace AudioCore::Renderer |
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 8b420873a..34877b461 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt | |||
| @@ -195,8 +195,6 @@ if (MSVC) | |||
| 195 | _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING | 195 | _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING |
| 196 | ) | 196 | ) |
| 197 | target_compile_options(common PRIVATE | 197 | target_compile_options(common PRIVATE |
| 198 | /W4 | ||
| 199 | |||
| 200 | /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data | 198 | /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data |
| 201 | /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data | 199 | /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data |
| 202 | /we4800 # Implicit conversion from 'type' to bool. Possible information loss | 200 | /we4800 # Implicit conversion from 'type' to bool. Possible information loss |
diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp index 4ff2c50e5..e13c5cdc7 100644 --- a/src/core/crypto/key_manager.cpp +++ b/src/core/crypto/key_manager.cpp | |||
| @@ -35,7 +35,6 @@ namespace Core::Crypto { | |||
| 35 | namespace { | 35 | namespace { |
| 36 | 36 | ||
| 37 | constexpr u64 CURRENT_CRYPTO_REVISION = 0x5; | 37 | constexpr u64 CURRENT_CRYPTO_REVISION = 0x5; |
| 38 | constexpr u64 FULL_TICKET_SIZE = 0x400; | ||
| 39 | 38 | ||
| 40 | using Common::AsArray; | 39 | using Common::AsArray; |
| 41 | 40 | ||
| @@ -156,6 +155,10 @@ u64 GetSignatureTypePaddingSize(SignatureType type) { | |||
| 156 | UNREACHABLE(); | 155 | UNREACHABLE(); |
| 157 | } | 156 | } |
| 158 | 157 | ||
| 158 | bool Ticket::IsValid() const { | ||
| 159 | return !std::holds_alternative<std::monostate>(data); | ||
| 160 | } | ||
| 161 | |||
| 159 | SignatureType Ticket::GetSignatureType() const { | 162 | SignatureType Ticket::GetSignatureType() const { |
| 160 | if (const auto* ticket = std::get_if<RSA4096Ticket>(&data)) { | 163 | if (const auto* ticket = std::get_if<RSA4096Ticket>(&data)) { |
| 161 | return ticket->sig_type; | 164 | return ticket->sig_type; |
| @@ -210,6 +213,54 @@ Ticket Ticket::SynthesizeCommon(Key128 title_key, const std::array<u8, 16>& righ | |||
| 210 | return Ticket{out}; | 213 | return Ticket{out}; |
| 211 | } | 214 | } |
| 212 | 215 | ||
| 216 | Ticket Ticket::Read(const FileSys::VirtualFile& file) { | ||
| 217 | // Attempt to read up to the largest ticket size, and make sure we read at least a signature | ||
| 218 | // type. | ||
| 219 | std::array<u8, sizeof(RSA4096Ticket)> raw_data{}; | ||
| 220 | auto read_size = file->Read(raw_data.data(), raw_data.size(), 0); | ||
| 221 | if (read_size < sizeof(SignatureType)) { | ||
| 222 | LOG_WARNING(Crypto, "Attempted to read ticket file with invalid size {}.", read_size); | ||
| 223 | return Ticket{std::monostate()}; | ||
| 224 | } | ||
| 225 | return Read(std::span{raw_data}); | ||
| 226 | } | ||
| 227 | |||
| 228 | Ticket Ticket::Read(std::span<const u8> raw_data) { | ||
| 229 | // Some tools read only 0x180 bytes of ticket data instead of 0x2C0, so | ||
| 230 | // just make sure we have at least the bare minimum of data to work with. | ||
| 231 | SignatureType sig_type; | ||
| 232 | if (raw_data.size() < sizeof(SignatureType)) { | ||
| 233 | LOG_WARNING(Crypto, "Attempted to parse ticket buffer with invalid size {}.", | ||
| 234 | raw_data.size()); | ||
| 235 | return Ticket{std::monostate()}; | ||
| 236 | } | ||
| 237 | std::memcpy(&sig_type, raw_data.data(), sizeof(sig_type)); | ||
| 238 | |||
| 239 | switch (sig_type) { | ||
| 240 | case SignatureType::RSA_4096_SHA1: | ||
| 241 | case SignatureType::RSA_4096_SHA256: { | ||
| 242 | RSA4096Ticket ticket{}; | ||
| 243 | std::memcpy(&ticket, raw_data.data(), sizeof(ticket)); | ||
| 244 | return Ticket{ticket}; | ||
| 245 | } | ||
| 246 | case SignatureType::RSA_2048_SHA1: | ||
| 247 | case SignatureType::RSA_2048_SHA256: { | ||
| 248 | RSA2048Ticket ticket{}; | ||
| 249 | std::memcpy(&ticket, raw_data.data(), sizeof(ticket)); | ||
| 250 | return Ticket{ticket}; | ||
| 251 | } | ||
| 252 | case SignatureType::ECDSA_SHA1: | ||
| 253 | case SignatureType::ECDSA_SHA256: { | ||
| 254 | ECDSATicket ticket{}; | ||
| 255 | std::memcpy(&ticket, raw_data.data(), sizeof(ticket)); | ||
| 256 | return Ticket{ticket}; | ||
| 257 | } | ||
| 258 | default: | ||
| 259 | LOG_WARNING(Crypto, "Attempted to parse ticket buffer with invalid type {}.", sig_type); | ||
| 260 | return Ticket{std::monostate()}; | ||
| 261 | } | ||
| 262 | } | ||
| 263 | |||
| 213 | Key128 GenerateKeyEncryptionKey(Key128 source, Key128 master, Key128 kek_seed, Key128 key_seed) { | 264 | Key128 GenerateKeyEncryptionKey(Key128 source, Key128 master, Key128 kek_seed, Key128 key_seed) { |
| 214 | Key128 out{}; | 265 | Key128 out{}; |
| 215 | 266 | ||
| @@ -290,9 +341,9 @@ void KeyManager::DeriveGeneralPurposeKeys(std::size_t crypto_revision) { | |||
| 290 | } | 341 | } |
| 291 | } | 342 | } |
| 292 | 343 | ||
| 293 | RSAKeyPair<2048> KeyManager::GetETicketRSAKey() const { | 344 | void KeyManager::DeriveETicketRSAKey() { |
| 294 | if (IsAllZeroArray(eticket_extended_kek) || !HasKey(S128KeyType::ETicketRSAKek)) { | 345 | if (IsAllZeroArray(eticket_extended_kek) || !HasKey(S128KeyType::ETicketRSAKek)) { |
| 295 | return {}; | 346 | return; |
| 296 | } | 347 | } |
| 297 | 348 | ||
| 298 | const auto eticket_final = GetKey(S128KeyType::ETicketRSAKek); | 349 | const auto eticket_final = GetKey(S128KeyType::ETicketRSAKek); |
| @@ -304,12 +355,12 @@ RSAKeyPair<2048> KeyManager::GetETicketRSAKey() const { | |||
| 304 | rsa_1.Transcode(eticket_extended_kek.data() + 0x10, eticket_extended_kek.size() - 0x10, | 355 | rsa_1.Transcode(eticket_extended_kek.data() + 0x10, eticket_extended_kek.size() - 0x10, |
| 305 | extended_dec.data(), Op::Decrypt); | 356 | extended_dec.data(), Op::Decrypt); |
| 306 | 357 | ||
| 307 | RSAKeyPair<2048> rsa_key{}; | 358 | std::memcpy(eticket_rsa_keypair.decryption_key.data(), extended_dec.data(), |
| 308 | std::memcpy(rsa_key.decryption_key.data(), extended_dec.data(), rsa_key.decryption_key.size()); | 359 | eticket_rsa_keypair.decryption_key.size()); |
| 309 | std::memcpy(rsa_key.modulus.data(), extended_dec.data() + 0x100, rsa_key.modulus.size()); | 360 | std::memcpy(eticket_rsa_keypair.modulus.data(), extended_dec.data() + 0x100, |
| 310 | std::memcpy(rsa_key.exponent.data(), extended_dec.data() + 0x200, rsa_key.exponent.size()); | 361 | eticket_rsa_keypair.modulus.size()); |
| 311 | 362 | std::memcpy(eticket_rsa_keypair.exponent.data(), extended_dec.data() + 0x200, | |
| 312 | return rsa_key; | 363 | eticket_rsa_keypair.exponent.size()); |
| 313 | } | 364 | } |
| 314 | 365 | ||
| 315 | Key128 DeriveKeyblobMACKey(const Key128& keyblob_key, const Key128& mac_source) { | 366 | Key128 DeriveKeyblobMACKey(const Key128& keyblob_key, const Key128& mac_source) { |
| @@ -447,10 +498,12 @@ std::vector<Ticket> GetTicketblob(const Common::FS::IOFile& ticket_save) { | |||
| 447 | for (std::size_t offset = 0; offset + 0x4 < buffer.size(); ++offset) { | 498 | for (std::size_t offset = 0; offset + 0x4 < buffer.size(); ++offset) { |
| 448 | if (buffer[offset] == 0x4 && buffer[offset + 1] == 0x0 && buffer[offset + 2] == 0x1 && | 499 | if (buffer[offset] == 0x4 && buffer[offset + 1] == 0x0 && buffer[offset + 2] == 0x1 && |
| 449 | buffer[offset + 3] == 0x0) { | 500 | buffer[offset + 3] == 0x0) { |
| 450 | out.emplace_back(); | 501 | // NOTE: Assumes ticket blob will only contain RSA-2048 tickets. |
| 451 | auto& next = out.back(); | 502 | auto ticket = Ticket::Read(std::span{buffer.data() + offset, sizeof(RSA2048Ticket)}); |
| 452 | std::memcpy(&next, buffer.data() + offset, sizeof(Ticket)); | 503 | offset += sizeof(RSA2048Ticket); |
| 453 | offset += FULL_TICKET_SIZE; | 504 | if (ticket.IsValid()) { |
| 505 | out.push_back(ticket); | ||
| 506 | } | ||
| 454 | } | 507 | } |
| 455 | } | 508 | } |
| 456 | 509 | ||
| @@ -503,25 +556,36 @@ static std::optional<u64> FindTicketOffset(const std::array<u8, size>& data) { | |||
| 503 | return offset; | 556 | return offset; |
| 504 | } | 557 | } |
| 505 | 558 | ||
| 506 | std::optional<std::pair<Key128, Key128>> ParseTicket(const Ticket& ticket, | 559 | std::optional<Key128> KeyManager::ParseTicketTitleKey(const Ticket& ticket) { |
| 507 | const RSAKeyPair<2048>& key) { | 560 | if (!ticket.IsValid()) { |
| 561 | LOG_WARNING(Crypto, "Attempted to parse title key of invalid ticket."); | ||
| 562 | return std::nullopt; | ||
| 563 | } | ||
| 564 | |||
| 565 | if (ticket.GetData().rights_id == Key128{}) { | ||
| 566 | LOG_WARNING(Crypto, "Attempted to parse title key of ticket with no rights ID."); | ||
| 567 | return std::nullopt; | ||
| 568 | } | ||
| 569 | |||
| 508 | const auto issuer = ticket.GetData().issuer; | 570 | const auto issuer = ticket.GetData().issuer; |
| 509 | if (IsAllZeroArray(issuer)) { | 571 | if (IsAllZeroArray(issuer)) { |
| 572 | LOG_WARNING(Crypto, "Attempted to parse title key of ticket with invalid issuer."); | ||
| 510 | return std::nullopt; | 573 | return std::nullopt; |
| 511 | } | 574 | } |
| 575 | |||
| 512 | if (issuer[0] != 'R' || issuer[1] != 'o' || issuer[2] != 'o' || issuer[3] != 't') { | 576 | if (issuer[0] != 'R' || issuer[1] != 'o' || issuer[2] != 'o' || issuer[3] != 't') { |
| 513 | LOG_INFO(Crypto, "Attempting to parse ticket with non-standard certificate authority."); | 577 | LOG_WARNING(Crypto, "Parsing ticket with non-standard certificate authority."); |
| 514 | } | 578 | } |
| 515 | 579 | ||
| 516 | Key128 rights_id = ticket.GetData().rights_id; | 580 | if (ticket.GetData().type == TitleKeyType::Common) { |
| 517 | 581 | return ticket.GetData().title_key_common; | |
| 518 | if (rights_id == Key128{}) { | ||
| 519 | return std::nullopt; | ||
| 520 | } | 582 | } |
| 521 | 583 | ||
| 522 | if (!std::any_of(ticket.GetData().title_key_common_pad.begin(), | 584 | if (eticket_rsa_keypair == RSAKeyPair<2048>{}) { |
| 523 | ticket.GetData().title_key_common_pad.end(), [](u8 b) { return b != 0; })) { | 585 | LOG_WARNING( |
| 524 | return std::make_pair(rights_id, ticket.GetData().title_key_common); | 586 | Crypto, |
| 587 | "Skipping personalized ticket title key parsing due to missing ETicket RSA key-pair."); | ||
| 588 | return std::nullopt; | ||
| 525 | } | 589 | } |
| 526 | 590 | ||
| 527 | mbedtls_mpi D; // RSA Private Exponent | 591 | mbedtls_mpi D; // RSA Private Exponent |
| @@ -534,9 +598,12 @@ std::optional<std::pair<Key128, Key128>> ParseTicket(const Ticket& ticket, | |||
| 534 | mbedtls_mpi_init(&S); | 598 | mbedtls_mpi_init(&S); |
| 535 | mbedtls_mpi_init(&M); | 599 | mbedtls_mpi_init(&M); |
| 536 | 600 | ||
| 537 | mbedtls_mpi_read_binary(&D, key.decryption_key.data(), key.decryption_key.size()); | 601 | const auto& title_key_block = ticket.GetData().title_key_block; |
| 538 | mbedtls_mpi_read_binary(&N, key.modulus.data(), key.modulus.size()); | 602 | mbedtls_mpi_read_binary(&D, eticket_rsa_keypair.decryption_key.data(), |
| 539 | mbedtls_mpi_read_binary(&S, ticket.GetData().title_key_block.data(), 0x100); | 603 | eticket_rsa_keypair.decryption_key.size()); |
| 604 | mbedtls_mpi_read_binary(&N, eticket_rsa_keypair.modulus.data(), | ||
| 605 | eticket_rsa_keypair.modulus.size()); | ||
| 606 | mbedtls_mpi_read_binary(&S, title_key_block.data(), title_key_block.size()); | ||
| 540 | 607 | ||
| 541 | mbedtls_mpi_exp_mod(&M, &S, &D, &N, nullptr); | 608 | mbedtls_mpi_exp_mod(&M, &S, &D, &N, nullptr); |
| 542 | 609 | ||
| @@ -564,8 +631,7 @@ std::optional<std::pair<Key128, Key128>> ParseTicket(const Ticket& ticket, | |||
| 564 | 631 | ||
| 565 | Key128 key_temp{}; | 632 | Key128 key_temp{}; |
| 566 | std::memcpy(key_temp.data(), m_2.data() + *offset, key_temp.size()); | 633 | std::memcpy(key_temp.data(), m_2.data() + *offset, key_temp.size()); |
| 567 | 634 | return key_temp; | |
| 568 | return std::make_pair(rights_id, key_temp); | ||
| 569 | } | 635 | } |
| 570 | 636 | ||
| 571 | KeyManager::KeyManager() { | 637 | KeyManager::KeyManager() { |
| @@ -669,6 +735,14 @@ void KeyManager::LoadFromFile(const std::filesystem::path& file_path, bool is_ti | |||
| 669 | encrypted_keyblobs[index] = Common::HexStringToArray<0xB0>(out[1]); | 735 | encrypted_keyblobs[index] = Common::HexStringToArray<0xB0>(out[1]); |
| 670 | } else if (out[0].compare(0, 20, "eticket_extended_kek") == 0) { | 736 | } else if (out[0].compare(0, 20, "eticket_extended_kek") == 0) { |
| 671 | eticket_extended_kek = Common::HexStringToArray<576>(out[1]); | 737 | eticket_extended_kek = Common::HexStringToArray<576>(out[1]); |
| 738 | } else if (out[0].compare(0, 19, "eticket_rsa_keypair") == 0) { | ||
| 739 | const auto key_data = Common::HexStringToArray<528>(out[1]); | ||
| 740 | std::memcpy(eticket_rsa_keypair.decryption_key.data(), key_data.data(), | ||
| 741 | eticket_rsa_keypair.decryption_key.size()); | ||
| 742 | std::memcpy(eticket_rsa_keypair.modulus.data(), key_data.data() + 0x100, | ||
| 743 | eticket_rsa_keypair.modulus.size()); | ||
| 744 | std::memcpy(eticket_rsa_keypair.exponent.data(), key_data.data() + 0x200, | ||
| 745 | eticket_rsa_keypair.exponent.size()); | ||
| 672 | } else { | 746 | } else { |
| 673 | for (const auto& kv : KEYS_VARIABLE_LENGTH) { | 747 | for (const auto& kv : KEYS_VARIABLE_LENGTH) { |
| 674 | if (!ValidCryptoRevisionString(out[0], kv.second.size(), 2)) { | 748 | if (!ValidCryptoRevisionString(out[0], kv.second.size(), 2)) { |
| @@ -1110,56 +1184,38 @@ void KeyManager::DeriveETicket(PartitionDataManager& data, | |||
| 1110 | 1184 | ||
| 1111 | eticket_extended_kek = data.GetETicketExtendedKek(); | 1185 | eticket_extended_kek = data.GetETicketExtendedKek(); |
| 1112 | WriteKeyToFile(KeyCategory::Console, "eticket_extended_kek", eticket_extended_kek); | 1186 | WriteKeyToFile(KeyCategory::Console, "eticket_extended_kek", eticket_extended_kek); |
| 1187 | DeriveETicketRSAKey(); | ||
| 1113 | PopulateTickets(); | 1188 | PopulateTickets(); |
| 1114 | } | 1189 | } |
| 1115 | 1190 | ||
| 1116 | void KeyManager::PopulateTickets() { | 1191 | void KeyManager::PopulateTickets() { |
| 1117 | const auto rsa_key = GetETicketRSAKey(); | 1192 | if (ticket_databases_loaded) { |
| 1118 | |||
| 1119 | if (rsa_key == RSAKeyPair<2048>{}) { | ||
| 1120 | return; | 1193 | return; |
| 1121 | } | 1194 | } |
| 1195 | ticket_databases_loaded = true; | ||
| 1122 | 1196 | ||
| 1123 | if (!common_tickets.empty() && !personal_tickets.empty()) { | 1197 | std::vector<Ticket> tickets; |
| 1124 | return; | ||
| 1125 | } | ||
| 1126 | 1198 | ||
| 1127 | const auto system_save_e1_path = | 1199 | const auto system_save_e1_path = |
| 1128 | Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / "system/save/80000000000000e1"; | 1200 | Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / "system/save/80000000000000e1"; |
| 1129 | 1201 | if (Common::FS::Exists(system_save_e1_path)) { | |
| 1130 | const Common::FS::IOFile save_e1{system_save_e1_path, Common::FS::FileAccessMode::Read, | 1202 | const Common::FS::IOFile save_e1{system_save_e1_path, Common::FS::FileAccessMode::Read, |
| 1131 | Common::FS::FileType::BinaryFile}; | 1203 | Common::FS::FileType::BinaryFile}; |
| 1204 | const auto blob1 = GetTicketblob(save_e1); | ||
| 1205 | tickets.insert(tickets.end(), blob1.begin(), blob1.end()); | ||
| 1206 | } | ||
| 1132 | 1207 | ||
| 1133 | const auto system_save_e2_path = | 1208 | const auto system_save_e2_path = |
| 1134 | Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / "system/save/80000000000000e2"; | 1209 | Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / "system/save/80000000000000e2"; |
| 1210 | if (Common::FS::Exists(system_save_e2_path)) { | ||
| 1211 | const Common::FS::IOFile save_e2{system_save_e2_path, Common::FS::FileAccessMode::Read, | ||
| 1212 | Common::FS::FileType::BinaryFile}; | ||
| 1213 | const auto blob2 = GetTicketblob(save_e2); | ||
| 1214 | tickets.insert(tickets.end(), blob2.begin(), blob2.end()); | ||
| 1215 | } | ||
| 1135 | 1216 | ||
| 1136 | const Common::FS::IOFile save_e2{system_save_e2_path, Common::FS::FileAccessMode::Read, | 1217 | for (const auto& ticket : tickets) { |
| 1137 | Common::FS::FileType::BinaryFile}; | 1218 | AddTicket(ticket); |
| 1138 | |||
| 1139 | const auto blob2 = GetTicketblob(save_e2); | ||
| 1140 | auto res = GetTicketblob(save_e1); | ||
| 1141 | |||
| 1142 | const auto idx = res.size(); | ||
| 1143 | res.insert(res.end(), blob2.begin(), blob2.end()); | ||
| 1144 | |||
| 1145 | for (std::size_t i = 0; i < res.size(); ++i) { | ||
| 1146 | const auto common = i < idx; | ||
| 1147 | const auto pair = ParseTicket(res[i], rsa_key); | ||
| 1148 | if (!pair) { | ||
| 1149 | continue; | ||
| 1150 | } | ||
| 1151 | |||
| 1152 | const auto& [rid, key] = *pair; | ||
| 1153 | u128 rights_id; | ||
| 1154 | std::memcpy(rights_id.data(), rid.data(), rid.size()); | ||
| 1155 | |||
| 1156 | if (common) { | ||
| 1157 | common_tickets[rights_id] = res[i]; | ||
| 1158 | } else { | ||
| 1159 | personal_tickets[rights_id] = res[i]; | ||
| 1160 | } | ||
| 1161 | |||
| 1162 | SetKey(S128KeyType::Titlekey, key, rights_id[1], rights_id[0]); | ||
| 1163 | } | 1219 | } |
| 1164 | } | 1220 | } |
| 1165 | 1221 | ||
| @@ -1291,41 +1347,33 @@ const std::map<u128, Ticket>& KeyManager::GetPersonalizedTickets() const { | |||
| 1291 | return personal_tickets; | 1347 | return personal_tickets; |
| 1292 | } | 1348 | } |
| 1293 | 1349 | ||
| 1294 | bool KeyManager::AddTicketCommon(Ticket raw) { | 1350 | bool KeyManager::AddTicket(const Ticket& ticket) { |
| 1295 | const auto rsa_key = GetETicketRSAKey(); | 1351 | if (!ticket.IsValid()) { |
| 1296 | if (rsa_key == RSAKeyPair<2048>{}) { | 1352 | LOG_WARNING(Crypto, "Attempted to add invalid ticket."); |
| 1297 | return false; | ||
| 1298 | } | ||
| 1299 | |||
| 1300 | const auto pair = ParseTicket(raw, rsa_key); | ||
| 1301 | if (!pair) { | ||
| 1302 | return false; | 1353 | return false; |
| 1303 | } | 1354 | } |
| 1304 | 1355 | ||
| 1305 | const auto& [rid, key] = *pair; | 1356 | const auto& rid = ticket.GetData().rights_id; |
| 1306 | u128 rights_id; | 1357 | u128 rights_id; |
| 1307 | std::memcpy(rights_id.data(), rid.data(), rid.size()); | 1358 | std::memcpy(rights_id.data(), rid.data(), rid.size()); |
| 1308 | common_tickets[rights_id] = raw; | 1359 | if (ticket.GetData().type == Core::Crypto::TitleKeyType::Common) { |
| 1309 | SetKey(S128KeyType::Titlekey, key, rights_id[1], rights_id[0]); | 1360 | common_tickets[rights_id] = ticket; |
| 1310 | return true; | 1361 | } else { |
| 1311 | } | 1362 | personal_tickets[rights_id] = ticket; |
| 1363 | } | ||
| 1312 | 1364 | ||
| 1313 | bool KeyManager::AddTicketPersonalized(Ticket raw) { | 1365 | if (HasKey(S128KeyType::Titlekey, rights_id[1], rights_id[0])) { |
| 1314 | const auto rsa_key = GetETicketRSAKey(); | 1366 | LOG_DEBUG(Crypto, |
| 1315 | if (rsa_key == RSAKeyPair<2048>{}) { | 1367 | "Skipping parsing title key from ticket for known rights ID {:016X}{:016X}.", |
| 1316 | return false; | 1368 | rights_id[1], rights_id[0]); |
| 1369 | return true; | ||
| 1317 | } | 1370 | } |
| 1318 | 1371 | ||
| 1319 | const auto pair = ParseTicket(raw, rsa_key); | 1372 | const auto key = ParseTicketTitleKey(ticket); |
| 1320 | if (!pair) { | 1373 | if (!key) { |
| 1321 | return false; | 1374 | return false; |
| 1322 | } | 1375 | } |
| 1323 | 1376 | SetKey(S128KeyType::Titlekey, key.value(), rights_id[1], rights_id[0]); | |
| 1324 | const auto& [rid, key] = *pair; | ||
| 1325 | u128 rights_id; | ||
| 1326 | std::memcpy(rights_id.data(), rid.data(), rid.size()); | ||
| 1327 | common_tickets[rights_id] = raw; | ||
| 1328 | SetKey(S128KeyType::Titlekey, key, rights_id[1], rights_id[0]); | ||
| 1329 | return true; | 1377 | return true; |
| 1330 | } | 1378 | } |
| 1331 | } // namespace Core::Crypto | 1379 | } // namespace Core::Crypto |
diff --git a/src/core/crypto/key_manager.h b/src/core/crypto/key_manager.h index 8c864503b..2250eccec 100644 --- a/src/core/crypto/key_manager.h +++ b/src/core/crypto/key_manager.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include <filesystem> | 7 | #include <filesystem> |
| 8 | #include <map> | 8 | #include <map> |
| 9 | #include <optional> | 9 | #include <optional> |
| 10 | #include <span> | ||
| 10 | #include <string> | 11 | #include <string> |
| 11 | 12 | ||
| 12 | #include <variant> | 13 | #include <variant> |
| @@ -29,8 +30,6 @@ enum class ResultStatus : u16; | |||
| 29 | 30 | ||
| 30 | namespace Core::Crypto { | 31 | namespace Core::Crypto { |
| 31 | 32 | ||
| 32 | constexpr u64 TICKET_FILE_TITLEKEY_OFFSET = 0x180; | ||
| 33 | |||
| 34 | using Key128 = std::array<u8, 0x10>; | 33 | using Key128 = std::array<u8, 0x10>; |
| 35 | using Key256 = std::array<u8, 0x20>; | 34 | using Key256 = std::array<u8, 0x20>; |
| 36 | using SHA256Hash = std::array<u8, 0x20>; | 35 | using SHA256Hash = std::array<u8, 0x20>; |
| @@ -82,6 +81,7 @@ struct RSA4096Ticket { | |||
| 82 | INSERT_PADDING_BYTES(0x3C); | 81 | INSERT_PADDING_BYTES(0x3C); |
| 83 | TicketData data; | 82 | TicketData data; |
| 84 | }; | 83 | }; |
| 84 | static_assert(sizeof(RSA4096Ticket) == 0x500, "RSA4096Ticket has incorrect size."); | ||
| 85 | 85 | ||
| 86 | struct RSA2048Ticket { | 86 | struct RSA2048Ticket { |
| 87 | SignatureType sig_type; | 87 | SignatureType sig_type; |
| @@ -89,6 +89,7 @@ struct RSA2048Ticket { | |||
| 89 | INSERT_PADDING_BYTES(0x3C); | 89 | INSERT_PADDING_BYTES(0x3C); |
| 90 | TicketData data; | 90 | TicketData data; |
| 91 | }; | 91 | }; |
| 92 | static_assert(sizeof(RSA2048Ticket) == 0x400, "RSA2048Ticket has incorrect size."); | ||
| 92 | 93 | ||
| 93 | struct ECDSATicket { | 94 | struct ECDSATicket { |
| 94 | SignatureType sig_type; | 95 | SignatureType sig_type; |
| @@ -96,16 +97,41 @@ struct ECDSATicket { | |||
| 96 | INSERT_PADDING_BYTES(0x40); | 97 | INSERT_PADDING_BYTES(0x40); |
| 97 | TicketData data; | 98 | TicketData data; |
| 98 | }; | 99 | }; |
| 100 | static_assert(sizeof(ECDSATicket) == 0x340, "ECDSATicket has incorrect size."); | ||
| 99 | 101 | ||
| 100 | struct Ticket { | 102 | struct Ticket { |
| 101 | std::variant<RSA4096Ticket, RSA2048Ticket, ECDSATicket> data; | 103 | std::variant<std::monostate, RSA4096Ticket, RSA2048Ticket, ECDSATicket> data; |
| 102 | 104 | ||
| 103 | SignatureType GetSignatureType() const; | 105 | [[nodiscard]] bool IsValid() const; |
| 104 | TicketData& GetData(); | 106 | [[nodiscard]] SignatureType GetSignatureType() const; |
| 105 | const TicketData& GetData() const; | 107 | [[nodiscard]] TicketData& GetData(); |
| 106 | u64 GetSize() const; | 108 | [[nodiscard]] const TicketData& GetData() const; |
| 107 | 109 | [[nodiscard]] u64 GetSize() const; | |
| 110 | |||
| 111 | /** | ||
| 112 | * Synthesizes a common ticket given a title key and rights ID. | ||
| 113 | * | ||
| 114 | * @param title_key Title key to store in the ticket. | ||
| 115 | * @param rights_id Rights ID the ticket is for. | ||
| 116 | * @return The synthesized common ticket. | ||
| 117 | */ | ||
| 108 | static Ticket SynthesizeCommon(Key128 title_key, const std::array<u8, 0x10>& rights_id); | 118 | static Ticket SynthesizeCommon(Key128 title_key, const std::array<u8, 0x10>& rights_id); |
| 119 | |||
| 120 | /** | ||
| 121 | * Reads a ticket from a file. | ||
| 122 | * | ||
| 123 | * @param file File to read the ticket from. | ||
| 124 | * @return The read ticket. If the ticket data is invalid, Ticket::IsValid() will be false. | ||
| 125 | */ | ||
| 126 | static Ticket Read(const FileSys::VirtualFile& file); | ||
| 127 | |||
| 128 | /** | ||
| 129 | * Reads a ticket from a memory buffer. | ||
| 130 | * | ||
| 131 | * @param raw_data Buffer to read the ticket from. | ||
| 132 | * @return The read ticket. If the ticket data is invalid, Ticket::IsValid() will be false. | ||
| 133 | */ | ||
| 134 | static Ticket Read(std::span<const u8> raw_data); | ||
| 109 | }; | 135 | }; |
| 110 | 136 | ||
| 111 | static_assert(sizeof(Key128) == 16, "Key128 must be 128 bytes big."); | 137 | static_assert(sizeof(Key128) == 16, "Key128 must be 128 bytes big."); |
| @@ -264,8 +290,7 @@ public: | |||
| 264 | const std::map<u128, Ticket>& GetCommonTickets() const; | 290 | const std::map<u128, Ticket>& GetCommonTickets() const; |
| 265 | const std::map<u128, Ticket>& GetPersonalizedTickets() const; | 291 | const std::map<u128, Ticket>& GetPersonalizedTickets() const; |
| 266 | 292 | ||
| 267 | bool AddTicketCommon(Ticket raw); | 293 | bool AddTicket(const Ticket& ticket); |
| 268 | bool AddTicketPersonalized(Ticket raw); | ||
| 269 | 294 | ||
| 270 | void ReloadKeys(); | 295 | void ReloadKeys(); |
| 271 | bool AreKeysLoaded() const; | 296 | bool AreKeysLoaded() const; |
| @@ -279,10 +304,12 @@ private: | |||
| 279 | // Map from rights ID to ticket | 304 | // Map from rights ID to ticket |
| 280 | std::map<u128, Ticket> common_tickets; | 305 | std::map<u128, Ticket> common_tickets; |
| 281 | std::map<u128, Ticket> personal_tickets; | 306 | std::map<u128, Ticket> personal_tickets; |
| 307 | bool ticket_databases_loaded = false; | ||
| 282 | 308 | ||
| 283 | std::array<std::array<u8, 0xB0>, 0x20> encrypted_keyblobs{}; | 309 | std::array<std::array<u8, 0xB0>, 0x20> encrypted_keyblobs{}; |
| 284 | std::array<std::array<u8, 0x90>, 0x20> keyblobs{}; | 310 | std::array<std::array<u8, 0x90>, 0x20> keyblobs{}; |
| 285 | std::array<u8, 576> eticket_extended_kek{}; | 311 | std::array<u8, 576> eticket_extended_kek{}; |
| 312 | RSAKeyPair<2048> eticket_rsa_keypair{}; | ||
| 286 | 313 | ||
| 287 | bool dev_mode; | 314 | bool dev_mode; |
| 288 | void LoadFromFile(const std::filesystem::path& file_path, bool is_title_keys); | 315 | void LoadFromFile(const std::filesystem::path& file_path, bool is_title_keys); |
| @@ -293,10 +320,13 @@ private: | |||
| 293 | 320 | ||
| 294 | void DeriveGeneralPurposeKeys(std::size_t crypto_revision); | 321 | void DeriveGeneralPurposeKeys(std::size_t crypto_revision); |
| 295 | 322 | ||
| 296 | RSAKeyPair<2048> GetETicketRSAKey() const; | 323 | void DeriveETicketRSAKey(); |
| 297 | 324 | ||
| 298 | void SetKeyWrapped(S128KeyType id, Key128 key, u64 field1 = 0, u64 field2 = 0); | 325 | void SetKeyWrapped(S128KeyType id, Key128 key, u64 field1 = 0, u64 field2 = 0); |
| 299 | void SetKeyWrapped(S256KeyType id, Key256 key, u64 field1 = 0, u64 field2 = 0); | 326 | void SetKeyWrapped(S256KeyType id, Key256 key, u64 field1 = 0, u64 field2 = 0); |
| 327 | |||
| 328 | /// Parses the title key section of a ticket. | ||
| 329 | std::optional<Key128> ParseTicketTitleKey(const Ticket& ticket); | ||
| 300 | }; | 330 | }; |
| 301 | 331 | ||
| 302 | Key128 GenerateKeyEncryptionKey(Key128 source, Key128 master, Key128 kek_seed, Key128 key_seed); | 332 | Key128 GenerateKeyEncryptionKey(Key128 source, Key128 master, Key128 kek_seed, Key128 key_seed); |
| @@ -311,9 +341,4 @@ Loader::ResultStatus DeriveSDKeys(std::array<Key256, 2>& sd_keys, KeyManager& ke | |||
| 311 | 341 | ||
| 312 | std::vector<Ticket> GetTicketblob(const Common::FS::IOFile& ticket_save); | 342 | std::vector<Ticket> GetTicketblob(const Common::FS::IOFile& ticket_save); |
| 313 | 343 | ||
| 314 | // Returns a pair of {rights_id, titlekey}. Fails if the ticket has no certificate authority | ||
| 315 | // (offset 0x140-0x144 is zero) | ||
| 316 | std::optional<std::pair<Key128, Key128>> ParseTicket(const Ticket& ticket, | ||
| 317 | const RSAKeyPair<2048>& eticket_extended_key); | ||
| 318 | |||
| 319 | } // namespace Core::Crypto | 344 | } // namespace Core::Crypto |
diff --git a/src/core/file_sys/submission_package.cpp b/src/core/file_sys/submission_package.cpp index e1e89ce2d..68e8ec22f 100644 --- a/src/core/file_sys/submission_package.cpp +++ b/src/core/file_sys/submission_package.cpp | |||
| @@ -164,24 +164,6 @@ VirtualFile NSP::GetNCAFile(u64 title_id, ContentRecordType type, TitleType titl | |||
| 164 | return nullptr; | 164 | return nullptr; |
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | std::vector<Core::Crypto::Key128> NSP::GetTitlekey() const { | ||
| 168 | if (extracted) | ||
| 169 | LOG_WARNING(Service_FS, "called on an NSP that is of type extracted."); | ||
| 170 | std::vector<Core::Crypto::Key128> out; | ||
| 171 | for (const auto& ticket_file : ticket_files) { | ||
| 172 | if (ticket_file == nullptr || | ||
| 173 | ticket_file->GetSize() < | ||
| 174 | Core::Crypto::TICKET_FILE_TITLEKEY_OFFSET + sizeof(Core::Crypto::Key128)) { | ||
| 175 | continue; | ||
| 176 | } | ||
| 177 | |||
| 178 | out.emplace_back(); | ||
| 179 | ticket_file->Read(out.back().data(), out.back().size(), | ||
| 180 | Core::Crypto::TICKET_FILE_TITLEKEY_OFFSET); | ||
| 181 | } | ||
| 182 | return out; | ||
| 183 | } | ||
| 184 | |||
| 185 | std::vector<VirtualFile> NSP::GetFiles() const { | 167 | std::vector<VirtualFile> NSP::GetFiles() const { |
| 186 | return pfs->GetFiles(); | 168 | return pfs->GetFiles(); |
| 187 | } | 169 | } |
| @@ -208,22 +190,11 @@ void NSP::SetTicketKeys(const std::vector<VirtualFile>& files) { | |||
| 208 | continue; | 190 | continue; |
| 209 | } | 191 | } |
| 210 | 192 | ||
| 211 | if (ticket_file->GetSize() < | 193 | auto ticket = Core::Crypto::Ticket::Read(ticket_file); |
| 212 | Core::Crypto::TICKET_FILE_TITLEKEY_OFFSET + sizeof(Core::Crypto::Key128)) { | 194 | if (!keys.AddTicket(ticket)) { |
| 195 | LOG_WARNING(Common_Filesystem, "Could not load NSP ticket {}", ticket_file->GetName()); | ||
| 213 | continue; | 196 | continue; |
| 214 | } | 197 | } |
| 215 | |||
| 216 | Core::Crypto::Key128 key{}; | ||
| 217 | ticket_file->Read(key.data(), key.size(), Core::Crypto::TICKET_FILE_TITLEKEY_OFFSET); | ||
| 218 | |||
| 219 | // We get the name without the extension in order to create the rights ID. | ||
| 220 | std::string name_only(ticket_file->GetName()); | ||
| 221 | name_only.erase(name_only.size() - 4); | ||
| 222 | |||
| 223 | const auto rights_id_raw = Common::HexStringToArray<16>(name_only); | ||
| 224 | u128 rights_id; | ||
| 225 | std::memcpy(rights_id.data(), rights_id_raw.data(), sizeof(u128)); | ||
| 226 | keys.SetKey(Core::Crypto::S128KeyType::Titlekey, key, rights_id[1], rights_id[0]); | ||
| 227 | } | 198 | } |
| 228 | } | 199 | } |
| 229 | 200 | ||
diff --git a/src/core/file_sys/submission_package.h b/src/core/file_sys/submission_package.h index 27f97c725..915bffca9 100644 --- a/src/core/file_sys/submission_package.h +++ b/src/core/file_sys/submission_package.h | |||
| @@ -53,7 +53,6 @@ public: | |||
| 53 | TitleType title_type = TitleType::Application) const; | 53 | TitleType title_type = TitleType::Application) const; |
| 54 | VirtualFile GetNCAFile(u64 title_id, ContentRecordType type, | 54 | VirtualFile GetNCAFile(u64 title_id, ContentRecordType type, |
| 55 | TitleType title_type = TitleType::Application) const; | 55 | TitleType title_type = TitleType::Application) const; |
| 56 | std::vector<Core::Crypto::Key128> GetTitlekey() const; | ||
| 57 | 56 | ||
| 58 | std::vector<VirtualFile> GetFiles() const override; | 57 | std::vector<VirtualFile> GetFiles() const override; |
| 59 | 58 | ||
diff --git a/src/core/hle/kernel/k_capabilities.cpp b/src/core/hle/kernel/k_capabilities.cpp index 90e4e8fb0..e7da7a21d 100644 --- a/src/core/hle/kernel/k_capabilities.cpp +++ b/src/core/hle/kernel/k_capabilities.cpp | |||
| @@ -156,7 +156,6 @@ Result KCapabilities::MapIoPage_(const u32 cap, KPageTable* page_table) { | |||
| 156 | const u64 phys_addr = MapIoPage{cap}.address.Value() * PageSize; | 156 | const u64 phys_addr = MapIoPage{cap}.address.Value() * PageSize; |
| 157 | const size_t num_pages = 1; | 157 | const size_t num_pages = 1; |
| 158 | const size_t size = num_pages * PageSize; | 158 | const size_t size = num_pages * PageSize; |
| 159 | R_UNLESS(num_pages != 0, ResultInvalidSize); | ||
| 160 | R_UNLESS(phys_addr < phys_addr + size, ResultInvalidAddress); | 159 | R_UNLESS(phys_addr < phys_addr + size, ResultInvalidAddress); |
| 161 | R_UNLESS(((phys_addr + size - 1) & ~PhysicalMapAllowedMask) == 0, ResultInvalidAddress); | 160 | R_UNLESS(((phys_addr + size - 1) & ~PhysicalMapAllowedMask) == 0, ResultInvalidAddress); |
| 162 | 161 | ||
diff --git a/src/core/hle/service/am/applets/applet_mii_edit.cpp b/src/core/hle/service/am/applets/applet_mii_edit.cpp index d1f652c09..f8e2bac32 100644 --- a/src/core/hle/service/am/applets/applet_mii_edit.cpp +++ b/src/core/hle/service/am/applets/applet_mii_edit.cpp | |||
| @@ -90,7 +90,7 @@ void MiiEdit::Execute() { | |||
| 90 | const MiiEditCharInfo char_info{ | 90 | const MiiEditCharInfo char_info{ |
| 91 | .mii_info{applet_input_common.applet_mode == MiiEditAppletMode::EditMii | 91 | .mii_info{applet_input_common.applet_mode == MiiEditAppletMode::EditMii |
| 92 | ? applet_input_v4.char_info.mii_info | 92 | ? applet_input_v4.char_info.mii_info |
| 93 | : mii_manager.BuildDefault(0)}, | 93 | : mii_manager.BuildBase(Mii::Gender::Male)}, |
| 94 | }; | 94 | }; |
| 95 | 95 | ||
| 96 | MiiEditOutputForCharInfoEditing(MiiEditResult::Success, char_info); | 96 | MiiEditOutputForCharInfoEditing(MiiEditResult::Success, char_info); |
diff --git a/src/core/hle/service/audio/audin_u.cpp b/src/core/hle/service/audio/audin_u.cpp index 526a39130..56fee4591 100644 --- a/src/core/hle/service/audio/audin_u.cpp +++ b/src/core/hle/service/audio/audin_u.cpp | |||
| @@ -220,7 +220,7 @@ AudInU::AudInU(Core::System& system_) | |||
| 220 | AudInU::~AudInU() = default; | 220 | AudInU::~AudInU() = default; |
| 221 | 221 | ||
| 222 | void AudInU::ListAudioIns(HLERequestContext& ctx) { | 222 | void AudInU::ListAudioIns(HLERequestContext& ctx) { |
| 223 | using namespace AudioCore::AudioRenderer; | 223 | using namespace AudioCore::Renderer; |
| 224 | 224 | ||
| 225 | LOG_DEBUG(Service_Audio, "called"); | 225 | LOG_DEBUG(Service_Audio, "called"); |
| 226 | 226 | ||
| @@ -240,7 +240,7 @@ void AudInU::ListAudioIns(HLERequestContext& ctx) { | |||
| 240 | } | 240 | } |
| 241 | 241 | ||
| 242 | void AudInU::ListAudioInsAutoFiltered(HLERequestContext& ctx) { | 242 | void AudInU::ListAudioInsAutoFiltered(HLERequestContext& ctx) { |
| 243 | using namespace AudioCore::AudioRenderer; | 243 | using namespace AudioCore::Renderer; |
| 244 | 244 | ||
| 245 | LOG_DEBUG(Service_Audio, "called"); | 245 | LOG_DEBUG(Service_Audio, "called"); |
| 246 | 246 | ||
diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp index 23f84a29f..ca683d72c 100644 --- a/src/core/hle/service/audio/audout_u.cpp +++ b/src/core/hle/service/audio/audout_u.cpp | |||
| @@ -228,7 +228,7 @@ AudOutU::AudOutU(Core::System& system_) | |||
| 228 | AudOutU::~AudOutU() = default; | 228 | AudOutU::~AudOutU() = default; |
| 229 | 229 | ||
| 230 | void AudOutU::ListAudioOuts(HLERequestContext& ctx) { | 230 | void AudOutU::ListAudioOuts(HLERequestContext& ctx) { |
| 231 | using namespace AudioCore::AudioRenderer; | 231 | using namespace AudioCore::Renderer; |
| 232 | 232 | ||
| 233 | std::scoped_lock l{impl->mutex}; | 233 | std::scoped_lock l{impl->mutex}; |
| 234 | 234 | ||
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index b723b65c8..2f09cade5 100644 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | #include "core/hle/service/ipc_helpers.h" | 26 | #include "core/hle/service/ipc_helpers.h" |
| 27 | #include "core/memory.h" | 27 | #include "core/memory.h" |
| 28 | 28 | ||
| 29 | using namespace AudioCore::AudioRenderer; | 29 | using namespace AudioCore::Renderer; |
| 30 | 30 | ||
| 31 | namespace Service::Audio { | 31 | namespace Service::Audio { |
| 32 | 32 | ||
diff --git a/src/core/hle/service/audio/audren_u.h b/src/core/hle/service/audio/audren_u.h index d8e9c8719..3d7993a16 100644 --- a/src/core/hle/service/audio/audren_u.h +++ b/src/core/hle/service/audio/audren_u.h | |||
| @@ -28,7 +28,7 @@ private: | |||
| 28 | void GetAudioDeviceServiceWithRevisionInfo(HLERequestContext& ctx); | 28 | void GetAudioDeviceServiceWithRevisionInfo(HLERequestContext& ctx); |
| 29 | 29 | ||
| 30 | KernelHelpers::ServiceContext service_context; | 30 | KernelHelpers::ServiceContext service_context; |
| 31 | std::unique_ptr<AudioCore::AudioRenderer::Manager> impl; | 31 | std::unique_ptr<AudioCore::Renderer::Manager> impl; |
| 32 | u32 num_audio_devices{0}; | 32 | u32 num_audio_devices{0}; |
| 33 | }; | 33 | }; |
| 34 | 34 | ||
diff --git a/src/core/hle/service/es/es.cpp b/src/core/hle/service/es/es.cpp index 446f46b3c..9eaae4c4b 100644 --- a/src/core/hle/service/es/es.cpp +++ b/src/core/hle/service/es/es.cpp | |||
| @@ -122,20 +122,18 @@ private: | |||
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | void ImportTicket(HLERequestContext& ctx) { | 124 | void ImportTicket(HLERequestContext& ctx) { |
| 125 | const auto ticket = ctx.ReadBuffer(); | 125 | const auto raw_ticket = ctx.ReadBuffer(); |
| 126 | [[maybe_unused]] const auto cert = ctx.ReadBuffer(1); | 126 | [[maybe_unused]] const auto cert = ctx.ReadBuffer(1); |
| 127 | 127 | ||
| 128 | if (ticket.size() < sizeof(Core::Crypto::Ticket)) { | 128 | if (raw_ticket.size() < sizeof(Core::Crypto::Ticket)) { |
| 129 | LOG_ERROR(Service_ETicket, "The input buffer is not large enough!"); | 129 | LOG_ERROR(Service_ETicket, "The input buffer is not large enough!"); |
| 130 | IPC::ResponseBuilder rb{ctx, 2}; | 130 | IPC::ResponseBuilder rb{ctx, 2}; |
| 131 | rb.Push(ERROR_INVALID_ARGUMENT); | 131 | rb.Push(ERROR_INVALID_ARGUMENT); |
| 132 | return; | 132 | return; |
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | Core::Crypto::Ticket raw{}; | 135 | Core::Crypto::Ticket ticket = Core::Crypto::Ticket::Read(raw_ticket); |
| 136 | std::memcpy(&raw, ticket.data(), sizeof(Core::Crypto::Ticket)); | 136 | if (!keys.AddTicket(ticket)) { |
| 137 | |||
| 138 | if (!keys.AddTicketPersonalized(raw)) { | ||
| 139 | LOG_ERROR(Service_ETicket, "The ticket could not be imported!"); | 137 | LOG_ERROR(Service_ETicket, "The ticket could not be imported!"); |
| 140 | IPC::ResponseBuilder rb{ctx, 2}; | 138 | IPC::ResponseBuilder rb{ctx, 2}; |
| 141 | rb.Push(ERROR_INVALID_ARGUMENT); | 139 | rb.Push(ERROR_INVALID_ARGUMENT); |
diff --git a/src/core/hle/service/mii/mii_manager.cpp b/src/core/hle/service/mii/mii_manager.cpp index 46125d473..dd632df50 100644 --- a/src/core/hle/service/mii/mii_manager.cpp +++ b/src/core/hle/service/mii/mii_manager.cpp | |||
| @@ -18,10 +18,9 @@ namespace { | |||
| 18 | 18 | ||
| 19 | constexpr Result ERROR_CANNOT_FIND_ENTRY{ErrorModule::Mii, 4}; | 19 | constexpr Result ERROR_CANNOT_FIND_ENTRY{ErrorModule::Mii, 4}; |
| 20 | 20 | ||
| 21 | constexpr std::size_t BaseMiiCount{2}; | ||
| 22 | constexpr std::size_t DefaultMiiCount{RawData::DefaultMii.size()}; | 21 | constexpr std::size_t DefaultMiiCount{RawData::DefaultMii.size()}; |
| 23 | 22 | ||
| 24 | constexpr MiiStoreData::Name DefaultMiiName{u'y', u'u', u'z', u'u'}; | 23 | constexpr MiiStoreData::Name DefaultMiiName{u'n', u'o', u' ', u'n', u'a', u'm', u'e'}; |
| 25 | constexpr std::array<u8, 8> HairColorLookup{8, 1, 2, 3, 4, 5, 6, 7}; | 24 | constexpr std::array<u8, 8> HairColorLookup{8, 1, 2, 3, 4, 5, 6, 7}; |
| 26 | constexpr std::array<u8, 6> EyeColorLookup{8, 9, 10, 11, 12, 13}; | 25 | constexpr std::array<u8, 6> EyeColorLookup{8, 9, 10, 11, 12, 13}; |
| 27 | constexpr std::array<u8, 5> MouthColorLookup{19, 20, 21, 22, 23}; | 26 | constexpr std::array<u8, 5> MouthColorLookup{19, 20, 21, 22, 23}; |
| @@ -404,7 +403,7 @@ u32 MiiManager::GetCount(SourceFlag source_flag) const { | |||
| 404 | count += 0; | 403 | count += 0; |
| 405 | } | 404 | } |
| 406 | if ((source_flag & SourceFlag::Default) != SourceFlag::None) { | 405 | if ((source_flag & SourceFlag::Default) != SourceFlag::None) { |
| 407 | count += (DefaultMiiCount - BaseMiiCount); | 406 | count += DefaultMiiCount; |
| 408 | } | 407 | } |
| 409 | return static_cast<u32>(count); | 408 | return static_cast<u32>(count); |
| 410 | } | 409 | } |
| @@ -422,13 +421,18 @@ CharInfo MiiManager::BuildRandom(Age age, Gender gender, Race race) { | |||
| 422 | return ConvertStoreDataToInfo(BuildRandomStoreData(age, gender, race, user_id)); | 421 | return ConvertStoreDataToInfo(BuildRandomStoreData(age, gender, race, user_id)); |
| 423 | } | 422 | } |
| 424 | 423 | ||
| 424 | CharInfo MiiManager::BuildBase(Gender gender) { | ||
| 425 | const std::size_t index = gender == Gender::Female ? 1 : 0; | ||
| 426 | return ConvertStoreDataToInfo(BuildDefaultStoreData(RawData::BaseMii.at(index), user_id)); | ||
| 427 | } | ||
| 428 | |||
| 425 | CharInfo MiiManager::BuildDefault(std::size_t index) { | 429 | CharInfo MiiManager::BuildDefault(std::size_t index) { |
| 426 | return ConvertStoreDataToInfo(BuildDefaultStoreData(RawData::DefaultMii.at(index), user_id)); | 430 | return ConvertStoreDataToInfo(BuildDefaultStoreData(RawData::DefaultMii.at(index), user_id)); |
| 427 | } | 431 | } |
| 428 | 432 | ||
| 429 | CharInfo MiiManager::ConvertV3ToCharInfo(const Ver3StoreData& mii_v3) const { | 433 | CharInfo MiiManager::ConvertV3ToCharInfo(const Ver3StoreData& mii_v3) const { |
| 430 | Service::Mii::MiiManager manager; | 434 | Service::Mii::MiiManager manager; |
| 431 | auto mii = manager.BuildDefault(0); | 435 | auto mii = manager.BuildBase(Mii::Gender::Male); |
| 432 | 436 | ||
| 433 | if (!ValidateV3Info(mii_v3)) { | 437 | if (!ValidateV3Info(mii_v3)) { |
| 434 | return mii; | 438 | return mii; |
| @@ -678,7 +682,7 @@ std::vector<MiiInfoElement> MiiManager::GetDefault(SourceFlag source_flag) { | |||
| 678 | return result; | 682 | return result; |
| 679 | } | 683 | } |
| 680 | 684 | ||
| 681 | for (std::size_t index = BaseMiiCount; index < DefaultMiiCount; index++) { | 685 | for (std::size_t index = 0; index < DefaultMiiCount; index++) { |
| 682 | result.emplace_back(BuildDefault(index), Source::Default); | 686 | result.emplace_back(BuildDefault(index), Source::Default); |
| 683 | } | 687 | } |
| 684 | 688 | ||
diff --git a/src/core/hle/service/mii/mii_manager.h b/src/core/hle/service/mii/mii_manager.h index 45c2be3c8..0c8295ebe 100644 --- a/src/core/hle/service/mii/mii_manager.h +++ b/src/core/hle/service/mii/mii_manager.h | |||
| @@ -21,6 +21,7 @@ public: | |||
| 21 | u32 GetCount(SourceFlag source_flag) const; | 21 | u32 GetCount(SourceFlag source_flag) const; |
| 22 | Result UpdateLatest(CharInfo* out_info, const CharInfo& info, SourceFlag source_flag); | 22 | Result UpdateLatest(CharInfo* out_info, const CharInfo& info, SourceFlag source_flag); |
| 23 | CharInfo BuildRandom(Age age, Gender gender, Race race); | 23 | CharInfo BuildRandom(Age age, Gender gender, Race race); |
| 24 | CharInfo BuildBase(Gender gender); | ||
| 24 | CharInfo BuildDefault(std::size_t index); | 25 | CharInfo BuildDefault(std::size_t index); |
| 25 | CharInfo ConvertV3ToCharInfo(const Ver3StoreData& mii_v3) const; | 26 | CharInfo ConvertV3ToCharInfo(const Ver3StoreData& mii_v3) const; |
| 26 | bool ValidateV3Info(const Ver3StoreData& mii_v3) const; | 27 | bool ValidateV3Info(const Ver3StoreData& mii_v3) const; |
diff --git a/src/core/hle/service/mii/raw_data.cpp b/src/core/hle/service/mii/raw_data.cpp index 1442280c8..e5245b791 100644 --- a/src/core/hle/service/mii/raw_data.cpp +++ b/src/core/hle/service/mii/raw_data.cpp | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | namespace Service::Mii::RawData { | 6 | namespace Service::Mii::RawData { |
| 7 | 7 | ||
| 8 | const std::array<Service::Mii::DefaultMii, 8> DefaultMii{ | 8 | const std::array<Service::Mii::DefaultMii, 2> BaseMii{ |
| 9 | Service::Mii::DefaultMii{ | 9 | Service::Mii::DefaultMii{ |
| 10 | .face_type = 0, | 10 | .face_type = 0, |
| 11 | .face_color = 0, | 11 | .face_color = 0, |
| @@ -108,6 +108,9 @@ const std::array<Service::Mii::DefaultMii, 8> DefaultMii{ | |||
| 108 | .font_region = FontRegion::Standard, | 108 | .font_region = FontRegion::Standard, |
| 109 | .type = 0, | 109 | .type = 0, |
| 110 | }, | 110 | }, |
| 111 | }; | ||
| 112 | |||
| 113 | const std::array<Service::Mii::DefaultMii, 6> DefaultMii{ | ||
| 111 | Service::Mii::DefaultMii{ | 114 | Service::Mii::DefaultMii{ |
| 112 | .face_type = 0, | 115 | .face_type = 0, |
| 113 | .face_color = 4, | 116 | .face_color = 4, |
diff --git a/src/core/hle/service/mii/raw_data.h b/src/core/hle/service/mii/raw_data.h index c2bec68d4..cdd2337d6 100644 --- a/src/core/hle/service/mii/raw_data.h +++ b/src/core/hle/service/mii/raw_data.h | |||
| @@ -9,7 +9,8 @@ | |||
| 9 | 9 | ||
| 10 | namespace Service::Mii::RawData { | 10 | namespace Service::Mii::RawData { |
| 11 | 11 | ||
| 12 | extern const std::array<Service::Mii::DefaultMii, 8> DefaultMii; | 12 | extern const std::array<Service::Mii::DefaultMii, 2> BaseMii; |
| 13 | extern const std::array<Service::Mii::DefaultMii, 6> DefaultMii; | ||
| 13 | extern const std::array<Service::Mii::RandomMiiData4, 18> RandomMiiFaceline; | 14 | extern const std::array<Service::Mii::RandomMiiData4, 18> RandomMiiFaceline; |
| 14 | extern const std::array<Service::Mii::RandomMiiData3, 6> RandomMiiFacelineColor; | 15 | extern const std::array<Service::Mii::RandomMiiData3, 6> RandomMiiFacelineColor; |
| 15 | extern const std::array<Service::Mii::RandomMiiData4, 18> RandomMiiFacelineWrinkle; | 16 | extern const std::array<Service::Mii::RandomMiiData4, 18> RandomMiiFacelineWrinkle; |
diff --git a/src/core/hle/service/nfc/common/device.cpp b/src/core/hle/service/nfc/common/device.cpp index 49446bc42..5df40f9a0 100644 --- a/src/core/hle/service/nfc/common/device.cpp +++ b/src/core/hle/service/nfc/common/device.cpp | |||
| @@ -826,7 +826,7 @@ Result NfcDevice::SetRegisterInfoPrivate(const NFP::RegisterInfoPrivate& registe | |||
| 826 | } | 826 | } |
| 827 | 827 | ||
| 828 | Service::Mii::MiiManager manager; | 828 | Service::Mii::MiiManager manager; |
| 829 | const auto mii = manager.BuildDefault(0); | 829 | const auto mii = manager.BuildBase(Mii::Gender::Male); |
| 830 | auto& settings = tag_data.settings; | 830 | auto& settings = tag_data.settings; |
| 831 | 831 | ||
| 832 | if (tag_data.settings.settings.amiibo_initialized == 0) { | 832 | if (tag_data.settings.settings.amiibo_initialized == 0) { |
| @@ -1467,7 +1467,7 @@ void NfcDevice::BuildAmiiboWithoutKeys(NFP::NTAG215File& stubbed_tag_data, | |||
| 1467 | SetAmiiboName(settings, {'y', 'u', 'z', 'u', 'A', 'm', 'i', 'i', 'b', 'o'}); | 1467 | SetAmiiboName(settings, {'y', 'u', 'z', 'u', 'A', 'm', 'i', 'i', 'b', 'o'}); |
| 1468 | settings.settings.font_region.Assign(0); | 1468 | settings.settings.font_region.Assign(0); |
| 1469 | settings.init_date = GetAmiiboDate(GetCurrentPosixTime()); | 1469 | settings.init_date = GetAmiiboDate(GetCurrentPosixTime()); |
| 1470 | stubbed_tag_data.owner_mii = manager.BuildFromStoreData(manager.BuildDefault(0)); | 1470 | stubbed_tag_data.owner_mii = manager.BuildFromStoreData(manager.BuildBase(Mii::Gender::Male)); |
| 1471 | 1471 | ||
| 1472 | // Admin info | 1472 | // Admin info |
| 1473 | settings.settings.amiibo_initialized.Assign(1); | 1473 | settings.settings.amiibo_initialized.Assign(1); |
diff --git a/src/core/hle/service/nvdrv/core/nvmap.cpp b/src/core/hle/service/nvdrv/core/nvmap.cpp index a51ca5444..0ca05257e 100644 --- a/src/core/hle/service/nvdrv/core/nvmap.cpp +++ b/src/core/hle/service/nvdrv/core/nvmap.cpp | |||
| @@ -160,8 +160,8 @@ u32 NvMap::PinHandle(NvMap::Handle::Id handle) { | |||
| 160 | u32 address{}; | 160 | u32 address{}; |
| 161 | auto& smmu_allocator = host1x.Allocator(); | 161 | auto& smmu_allocator = host1x.Allocator(); |
| 162 | auto& smmu_memory_manager = host1x.MemoryManager(); | 162 | auto& smmu_memory_manager = host1x.MemoryManager(); |
| 163 | while (!(address = | 163 | while ((address = smmu_allocator.Allocate( |
| 164 | smmu_allocator.Allocate(static_cast<u32>(handle_description->aligned_size)))) { | 164 | static_cast<u32>(handle_description->aligned_size))) == 0) { |
| 165 | // Free handles until the allocation succeeds | 165 | // Free handles until the allocation succeeds |
| 166 | std::scoped_lock queueLock(unmap_queue_lock); | 166 | std::scoped_lock queueLock(unmap_queue_lock); |
| 167 | if (auto freeHandleDesc{unmap_queue.front()}) { | 167 | if (auto freeHandleDesc{unmap_queue.front()}) { |
diff --git a/src/core/hle/service/ssl/ssl_backend_schannel.cpp b/src/core/hle/service/ssl/ssl_backend_schannel.cpp index d834a0c1f..212057cfc 100644 --- a/src/core/hle/service/ssl/ssl_backend_schannel.cpp +++ b/src/core/hle/service/ssl/ssl_backend_schannel.cpp | |||
| @@ -477,7 +477,8 @@ public: | |||
| 477 | return ResultInternalError; | 477 | return ResultInternalError; |
| 478 | } | 478 | } |
| 479 | PCCERT_CONTEXT some_cert = nullptr; | 479 | PCCERT_CONTEXT some_cert = nullptr; |
| 480 | while ((some_cert = CertEnumCertificatesInStore(returned_cert->hCertStore, some_cert))) { | 480 | while ((some_cert = CertEnumCertificatesInStore(returned_cert->hCertStore, some_cert)) != |
| 481 | nullptr) { | ||
| 481 | out_certs->emplace_back(static_cast<u8*>(some_cert->pbCertEncoded), | 482 | out_certs->emplace_back(static_cast<u8*>(some_cert->pbCertEncoded), |
| 482 | static_cast<u8*>(some_cert->pbCertEncoded) + | 483 | static_cast<u8*>(some_cert->pbCertEncoded) + |
| 483 | some_cert->cbCertEncoded); | 484 | some_cert->cbCertEncoded); |
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp index 07c65dc1a..b6e355622 100644 --- a/src/core/loader/loader.cpp +++ b/src/core/loader/loader.cpp | |||
| @@ -108,7 +108,7 @@ std::string GetFileTypeString(FileType type) { | |||
| 108 | return "unknown"; | 108 | return "unknown"; |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | constexpr std::array<const char*, 66> RESULT_MESSAGES{ | 111 | constexpr std::array<const char*, 68> RESULT_MESSAGES{ |
| 112 | "The operation completed successfully.", | 112 | "The operation completed successfully.", |
| 113 | "The loader requested to load is already loaded.", | 113 | "The loader requested to load is already loaded.", |
| 114 | "The operation is not implemented.", | 114 | "The operation is not implemented.", |
| @@ -175,6 +175,8 @@ constexpr std::array<const char*, 66> RESULT_MESSAGES{ | |||
| 175 | "The KIP BLZ decompression of the section failed unexpectedly.", | 175 | "The KIP BLZ decompression of the section failed unexpectedly.", |
| 176 | "The INI file has a bad header.", | 176 | "The INI file has a bad header.", |
| 177 | "The INI file contains more than the maximum allowable number of KIP files.", | 177 | "The INI file contains more than the maximum allowable number of KIP files.", |
| 178 | "Integrity verification could not be performed for this file.", | ||
| 179 | "Integrity verification failed.", | ||
| 178 | }; | 180 | }; |
| 179 | 181 | ||
| 180 | std::string GetResultStatusString(ResultStatus status) { | 182 | std::string GetResultStatusString(ResultStatus status) { |
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h index 721eb8e8c..b4828f7cd 100644 --- a/src/core/loader/loader.h +++ b/src/core/loader/loader.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include <functional> | ||
| 6 | #include <iosfwd> | 7 | #include <iosfwd> |
| 7 | #include <memory> | 8 | #include <memory> |
| 8 | #include <optional> | 9 | #include <optional> |
| @@ -132,6 +133,8 @@ enum class ResultStatus : u16 { | |||
| 132 | ErrorBLZDecompressionFailed, | 133 | ErrorBLZDecompressionFailed, |
| 133 | ErrorBadINIHeader, | 134 | ErrorBadINIHeader, |
| 134 | ErrorINITooManyKIPs, | 135 | ErrorINITooManyKIPs, |
| 136 | ErrorIntegrityVerificationNotImplemented, | ||
| 137 | ErrorIntegrityVerificationFailed, | ||
| 135 | }; | 138 | }; |
| 136 | 139 | ||
| 137 | std::string GetResultStatusString(ResultStatus status); | 140 | std::string GetResultStatusString(ResultStatus status); |
| @@ -170,6 +173,13 @@ public: | |||
| 170 | virtual LoadResult Load(Kernel::KProcess& process, Core::System& system) = 0; | 173 | virtual LoadResult Load(Kernel::KProcess& process, Core::System& system) = 0; |
| 171 | 174 | ||
| 172 | /** | 175 | /** |
| 176 | * Try to verify the integrity of the file. | ||
| 177 | */ | ||
| 178 | virtual ResultStatus VerifyIntegrity(std::function<bool(size_t, size_t)> progress_callback) { | ||
| 179 | return ResultStatus::ErrorIntegrityVerificationNotImplemented; | ||
| 180 | } | ||
| 181 | |||
| 182 | /** | ||
| 173 | * Get the code (typically .code section) of the application | 183 | * Get the code (typically .code section) of the application |
| 174 | * | 184 | * |
| 175 | * @param[out] buffer Reference to buffer to store data | 185 | * @param[out] buffer Reference to buffer to store data |
diff --git a/src/core/loader/nca.cpp b/src/core/loader/nca.cpp index 09d40e695..4feb6968a 100644 --- a/src/core/loader/nca.cpp +++ b/src/core/loader/nca.cpp | |||
| @@ -3,6 +3,8 @@ | |||
| 3 | 3 | ||
| 4 | #include <utility> | 4 | #include <utility> |
| 5 | 5 | ||
| 6 | #include "common/hex_util.h" | ||
| 7 | #include "common/scope_exit.h" | ||
| 6 | #include "core/core.h" | 8 | #include "core/core.h" |
| 7 | #include "core/file_sys/content_archive.h" | 9 | #include "core/file_sys/content_archive.h" |
| 8 | #include "core/file_sys/nca_metadata.h" | 10 | #include "core/file_sys/nca_metadata.h" |
| @@ -12,6 +14,7 @@ | |||
| 12 | #include "core/hle/service/filesystem/filesystem.h" | 14 | #include "core/hle/service/filesystem/filesystem.h" |
| 13 | #include "core/loader/deconstructed_rom_directory.h" | 15 | #include "core/loader/deconstructed_rom_directory.h" |
| 14 | #include "core/loader/nca.h" | 16 | #include "core/loader/nca.h" |
| 17 | #include "mbedtls/sha256.h" | ||
| 15 | 18 | ||
| 16 | namespace Loader { | 19 | namespace Loader { |
| 17 | 20 | ||
| @@ -80,6 +83,79 @@ AppLoader_NCA::LoadResult AppLoader_NCA::Load(Kernel::KProcess& process, Core::S | |||
| 80 | return load_result; | 83 | return load_result; |
| 81 | } | 84 | } |
| 82 | 85 | ||
| 86 | ResultStatus AppLoader_NCA::VerifyIntegrity(std::function<bool(size_t, size_t)> progress_callback) { | ||
| 87 | using namespace Common::Literals; | ||
| 88 | |||
| 89 | constexpr size_t NcaFileNameWithHashLength = 36; | ||
| 90 | constexpr size_t NcaFileNameHashLength = 32; | ||
| 91 | constexpr size_t NcaSha256HashLength = 32; | ||
| 92 | constexpr size_t NcaSha256HalfHashLength = NcaSha256HashLength / 2; | ||
| 93 | |||
| 94 | // Get the file name. | ||
| 95 | const auto name = file->GetName(); | ||
| 96 | |||
| 97 | // We won't try to verify meta NCAs. | ||
| 98 | if (name.ends_with(".cnmt.nca")) { | ||
| 99 | return ResultStatus::Success; | ||
| 100 | } | ||
| 101 | |||
| 102 | // Check if we can verify this file. NCAs should be named after their hashes. | ||
| 103 | if (!name.ends_with(".nca") || name.size() != NcaFileNameWithHashLength) { | ||
| 104 | LOG_WARNING(Loader, "Unable to validate NCA with name {}", name); | ||
| 105 | return ResultStatus::ErrorIntegrityVerificationNotImplemented; | ||
| 106 | } | ||
| 107 | |||
| 108 | // Get the expected truncated hash of the NCA. | ||
| 109 | const auto input_hash = | ||
| 110 | Common::HexStringToVector(file->GetName().substr(0, NcaFileNameHashLength), false); | ||
| 111 | |||
| 112 | // Declare buffer to read into. | ||
| 113 | std::vector<u8> buffer(4_MiB); | ||
| 114 | |||
| 115 | // Initialize sha256 verification context. | ||
| 116 | mbedtls_sha256_context ctx; | ||
| 117 | mbedtls_sha256_init(&ctx); | ||
| 118 | mbedtls_sha256_starts_ret(&ctx, 0); | ||
| 119 | |||
| 120 | // Ensure we maintain a clean state on exit. | ||
| 121 | SCOPE_EXIT({ mbedtls_sha256_free(&ctx); }); | ||
| 122 | |||
| 123 | // Declare counters. | ||
| 124 | const size_t total_size = file->GetSize(); | ||
| 125 | size_t processed_size = 0; | ||
| 126 | |||
| 127 | // Begin iterating the file. | ||
| 128 | while (processed_size < total_size) { | ||
| 129 | // Refill the buffer. | ||
| 130 | const size_t intended_read_size = std::min(buffer.size(), total_size - processed_size); | ||
| 131 | const size_t read_size = file->Read(buffer.data(), intended_read_size, processed_size); | ||
| 132 | |||
| 133 | // Update the hash function with the buffer contents. | ||
| 134 | mbedtls_sha256_update_ret(&ctx, buffer.data(), read_size); | ||
| 135 | |||
| 136 | // Update counters. | ||
| 137 | processed_size += read_size; | ||
| 138 | |||
| 139 | // Call the progress function. | ||
| 140 | if (!progress_callback(processed_size, total_size)) { | ||
| 141 | return ResultStatus::ErrorIntegrityVerificationFailed; | ||
| 142 | } | ||
| 143 | } | ||
| 144 | |||
| 145 | // Finalize context and compute the output hash. | ||
| 146 | std::array<u8, NcaSha256HashLength> output_hash; | ||
| 147 | mbedtls_sha256_finish_ret(&ctx, output_hash.data()); | ||
| 148 | |||
| 149 | // Compare to expected. | ||
| 150 | if (std::memcmp(input_hash.data(), output_hash.data(), NcaSha256HalfHashLength) != 0) { | ||
| 151 | LOG_ERROR(Loader, "NCA hash mismatch detected for file {}", name); | ||
| 152 | return ResultStatus::ErrorIntegrityVerificationFailed; | ||
| 153 | } | ||
| 154 | |||
| 155 | // File verified. | ||
| 156 | return ResultStatus::Success; | ||
| 157 | } | ||
| 158 | |||
| 83 | ResultStatus AppLoader_NCA::ReadRomFS(FileSys::VirtualFile& dir) { | 159 | ResultStatus AppLoader_NCA::ReadRomFS(FileSys::VirtualFile& dir) { |
| 84 | if (nca == nullptr) { | 160 | if (nca == nullptr) { |
| 85 | return ResultStatus::ErrorNotInitialized; | 161 | return ResultStatus::ErrorNotInitialized; |
diff --git a/src/core/loader/nca.h b/src/core/loader/nca.h index cf356ce63..96779e27f 100644 --- a/src/core/loader/nca.h +++ b/src/core/loader/nca.h | |||
| @@ -39,6 +39,8 @@ public: | |||
| 39 | 39 | ||
| 40 | LoadResult Load(Kernel::KProcess& process, Core::System& system) override; | 40 | LoadResult Load(Kernel::KProcess& process, Core::System& system) override; |
| 41 | 41 | ||
| 42 | ResultStatus VerifyIntegrity(std::function<bool(size_t, size_t)> progress_callback) override; | ||
| 43 | |||
| 42 | ResultStatus ReadRomFS(FileSys::VirtualFile& dir) override; | 44 | ResultStatus ReadRomFS(FileSys::VirtualFile& dir) override; |
| 43 | ResultStatus ReadProgramId(u64& out_program_id) override; | 45 | ResultStatus ReadProgramId(u64& out_program_id) override; |
| 44 | 46 | ||
diff --git a/src/core/loader/nsp.cpp b/src/core/loader/nsp.cpp index f9b2549a3..fe2af1ae6 100644 --- a/src/core/loader/nsp.cpp +++ b/src/core/loader/nsp.cpp | |||
| @@ -117,6 +117,42 @@ AppLoader_NSP::LoadResult AppLoader_NSP::Load(Kernel::KProcess& process, Core::S | |||
| 117 | return result; | 117 | return result; |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | ResultStatus AppLoader_NSP::VerifyIntegrity(std::function<bool(size_t, size_t)> progress_callback) { | ||
| 121 | // Extracted-type NSPs can't be verified. | ||
| 122 | if (nsp->IsExtractedType()) { | ||
| 123 | return ResultStatus::ErrorIntegrityVerificationNotImplemented; | ||
| 124 | } | ||
| 125 | |||
| 126 | // Get list of all NCAs. | ||
| 127 | const auto ncas = nsp->GetNCAsCollapsed(); | ||
| 128 | |||
| 129 | size_t total_size = 0; | ||
| 130 | size_t processed_size = 0; | ||
| 131 | |||
| 132 | // Loop over NCAs, collecting the total size to verify. | ||
| 133 | for (const auto& nca : ncas) { | ||
| 134 | total_size += nca->GetBaseFile()->GetSize(); | ||
| 135 | } | ||
| 136 | |||
| 137 | // Loop over NCAs again, verifying each. | ||
| 138 | for (const auto& nca : ncas) { | ||
| 139 | AppLoader_NCA loader_nca(nca->GetBaseFile()); | ||
| 140 | |||
| 141 | const auto NcaProgressCallback = [&](size_t nca_processed_size, size_t nca_total_size) { | ||
| 142 | return progress_callback(processed_size + nca_processed_size, total_size); | ||
| 143 | }; | ||
| 144 | |||
| 145 | const auto verification_result = loader_nca.VerifyIntegrity(NcaProgressCallback); | ||
| 146 | if (verification_result != ResultStatus::Success) { | ||
| 147 | return verification_result; | ||
| 148 | } | ||
| 149 | |||
| 150 | processed_size += nca->GetBaseFile()->GetSize(); | ||
| 151 | } | ||
| 152 | |||
| 153 | return ResultStatus::Success; | ||
| 154 | } | ||
| 155 | |||
| 120 | ResultStatus AppLoader_NSP::ReadRomFS(FileSys::VirtualFile& out_file) { | 156 | ResultStatus AppLoader_NSP::ReadRomFS(FileSys::VirtualFile& out_file) { |
| 121 | return secondary_loader->ReadRomFS(out_file); | 157 | return secondary_loader->ReadRomFS(out_file); |
| 122 | } | 158 | } |
diff --git a/src/core/loader/nsp.h b/src/core/loader/nsp.h index 79df4586a..7ce436c67 100644 --- a/src/core/loader/nsp.h +++ b/src/core/loader/nsp.h | |||
| @@ -45,6 +45,8 @@ public: | |||
| 45 | 45 | ||
| 46 | LoadResult Load(Kernel::KProcess& process, Core::System& system) override; | 46 | LoadResult Load(Kernel::KProcess& process, Core::System& system) override; |
| 47 | 47 | ||
| 48 | ResultStatus VerifyIntegrity(std::function<bool(size_t, size_t)> progress_callback) override; | ||
| 49 | |||
| 48 | ResultStatus ReadRomFS(FileSys::VirtualFile& out_file) override; | 50 | ResultStatus ReadRomFS(FileSys::VirtualFile& out_file) override; |
| 49 | ResultStatus ReadUpdateRaw(FileSys::VirtualFile& out_file) override; | 51 | ResultStatus ReadUpdateRaw(FileSys::VirtualFile& out_file) override; |
| 50 | ResultStatus ReadProgramId(u64& out_program_id) override; | 52 | ResultStatus ReadProgramId(u64& out_program_id) override; |
diff --git a/src/core/loader/xci.cpp b/src/core/loader/xci.cpp index 3a76bc788..12d72c380 100644 --- a/src/core/loader/xci.cpp +++ b/src/core/loader/xci.cpp | |||
| @@ -85,6 +85,40 @@ AppLoader_XCI::LoadResult AppLoader_XCI::Load(Kernel::KProcess& process, Core::S | |||
| 85 | return result; | 85 | return result; |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | ResultStatus AppLoader_XCI::VerifyIntegrity(std::function<bool(size_t, size_t)> progress_callback) { | ||
| 89 | // Verify secure partition, as it is the only thing we can process. | ||
| 90 | auto secure_partition = xci->GetSecurePartitionNSP(); | ||
| 91 | |||
| 92 | // Get list of all NCAs. | ||
| 93 | const auto ncas = secure_partition->GetNCAsCollapsed(); | ||
| 94 | |||
| 95 | size_t total_size = 0; | ||
| 96 | size_t processed_size = 0; | ||
| 97 | |||
| 98 | // Loop over NCAs, collecting the total size to verify. | ||
| 99 | for (const auto& nca : ncas) { | ||
| 100 | total_size += nca->GetBaseFile()->GetSize(); | ||
| 101 | } | ||
| 102 | |||
| 103 | // Loop over NCAs again, verifying each. | ||
| 104 | for (const auto& nca : ncas) { | ||
| 105 | AppLoader_NCA loader_nca(nca->GetBaseFile()); | ||
| 106 | |||
| 107 | const auto NcaProgressCallback = [&](size_t nca_processed_size, size_t nca_total_size) { | ||
| 108 | return progress_callback(processed_size + nca_processed_size, total_size); | ||
| 109 | }; | ||
| 110 | |||
| 111 | const auto verification_result = loader_nca.VerifyIntegrity(NcaProgressCallback); | ||
| 112 | if (verification_result != ResultStatus::Success) { | ||
| 113 | return verification_result; | ||
| 114 | } | ||
| 115 | |||
| 116 | processed_size += nca->GetBaseFile()->GetSize(); | ||
| 117 | } | ||
| 118 | |||
| 119 | return ResultStatus::Success; | ||
| 120 | } | ||
| 121 | |||
| 88 | ResultStatus AppLoader_XCI::ReadRomFS(FileSys::VirtualFile& out_file) { | 122 | ResultStatus AppLoader_XCI::ReadRomFS(FileSys::VirtualFile& out_file) { |
| 89 | return nca_loader->ReadRomFS(out_file); | 123 | return nca_loader->ReadRomFS(out_file); |
| 90 | } | 124 | } |
diff --git a/src/core/loader/xci.h b/src/core/loader/xci.h index ff05e6f62..b02e136d3 100644 --- a/src/core/loader/xci.h +++ b/src/core/loader/xci.h | |||
| @@ -45,6 +45,8 @@ public: | |||
| 45 | 45 | ||
| 46 | LoadResult Load(Kernel::KProcess& process, Core::System& system) override; | 46 | LoadResult Load(Kernel::KProcess& process, Core::System& system) override; |
| 47 | 47 | ||
| 48 | ResultStatus VerifyIntegrity(std::function<bool(size_t, size_t)> progress_callback) override; | ||
| 49 | |||
| 48 | ResultStatus ReadRomFS(FileSys::VirtualFile& out_file) override; | 50 | ResultStatus ReadRomFS(FileSys::VirtualFile& out_file) override; |
| 49 | ResultStatus ReadUpdateRaw(FileSys::VirtualFile& out_file) override; | 51 | ResultStatus ReadUpdateRaw(FileSys::VirtualFile& out_file) override; |
| 50 | ResultStatus ReadProgramId(u64& out_program_id) override; | 52 | ResultStatus ReadProgramId(u64& out_program_id) override; |
diff --git a/src/dedicated_room/yuzu_room.cpp b/src/dedicated_room/yuzu_room.cpp index d707dabe2..93038f161 100644 --- a/src/dedicated_room/yuzu_room.cpp +++ b/src/dedicated_room/yuzu_room.cpp | |||
| @@ -368,9 +368,9 @@ int main(int argc, char** argv) { | |||
| 368 | if (auto room = network.GetRoom().lock()) { | 368 | if (auto room = network.GetRoom().lock()) { |
| 369 | AnnounceMultiplayerRoom::GameInfo preferred_game_info{.name = preferred_game, | 369 | AnnounceMultiplayerRoom::GameInfo preferred_game_info{.name = preferred_game, |
| 370 | .id = preferred_game_id}; | 370 | .id = preferred_game_id}; |
| 371 | if (!room->Create(room_name, room_description, bind_address, port, password, max_members, | 371 | if (!room->Create(room_name, room_description, bind_address, static_cast<u16>(port), |
| 372 | username, preferred_game_info, std::move(verify_backend), ban_list, | 372 | password, max_members, username, preferred_game_info, |
| 373 | enable_yuzu_mods)) { | 373 | std::move(verify_backend), ban_list, enable_yuzu_mods)) { |
| 374 | LOG_INFO(Network, "Failed to create room: "); | 374 | LOG_INFO(Network, "Failed to create room: "); |
| 375 | return -1; | 375 | return -1; |
| 376 | } | 376 | } |
diff --git a/src/input_common/CMakeLists.txt b/src/input_common/CMakeLists.txt index 322c29065..5c127c8ef 100644 --- a/src/input_common/CMakeLists.txt +++ b/src/input_common/CMakeLists.txt | |||
| @@ -37,8 +37,6 @@ add_library(input_common STATIC | |||
| 37 | 37 | ||
| 38 | if (MSVC) | 38 | if (MSVC) |
| 39 | target_compile_options(input_common PRIVATE | 39 | target_compile_options(input_common PRIVATE |
| 40 | /W4 | ||
| 41 | |||
| 42 | /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data | 40 | /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data |
| 43 | /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data | 41 | /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data |
| 44 | /we4800 # Implicit conversion from 'type' to bool. Possible information loss | 42 | /we4800 # Implicit conversion from 'type' to bool. Possible information loss |
diff --git a/src/network/room.cpp b/src/network/room.cpp index e456ea09c..d87db37de 100644 --- a/src/network/room.cpp +++ b/src/network/room.cpp | |||
| @@ -805,7 +805,7 @@ IPv4Address Room::RoomImpl::GenerateFakeIPAddress() { | |||
| 805 | std::uniform_int_distribution<> dis(0x01, 0xFE); // Random byte between 1 and 0xFE | 805 | std::uniform_int_distribution<> dis(0x01, 0xFE); // Random byte between 1 and 0xFE |
| 806 | do { | 806 | do { |
| 807 | for (std::size_t i = 2; i < result_ip.size(); ++i) { | 807 | for (std::size_t i = 2; i < result_ip.size(); ++i) { |
| 808 | result_ip[i] = dis(random_gen); | 808 | result_ip[i] = static_cast<u8>(dis(random_gen)); |
| 809 | } | 809 | } |
| 810 | } while (!IsValidFakeIPAddress(result_ip)); | 810 | } while (!IsValidFakeIPAddress(result_ip)); |
| 811 | 811 | ||
diff --git a/src/shader_recompiler/CMakeLists.txt b/src/shader_recompiler/CMakeLists.txt index 07e75f9d8..83b763447 100644 --- a/src/shader_recompiler/CMakeLists.txt +++ b/src/shader_recompiler/CMakeLists.txt | |||
| @@ -245,8 +245,6 @@ target_link_libraries(shader_recompiler PUBLIC common fmt::fmt sirit) | |||
| 245 | 245 | ||
| 246 | if (MSVC) | 246 | if (MSVC) |
| 247 | target_compile_options(shader_recompiler PRIVATE | 247 | target_compile_options(shader_recompiler PRIVATE |
| 248 | /W4 | ||
| 249 | |||
| 250 | /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data | 248 | /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data |
| 251 | /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data | 249 | /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data |
| 252 | /we4800 # Implicit conversion from 'type' to bool. Possible information loss | 250 | /we4800 # Implicit conversion from 'type' to bool. Possible information loss |
diff --git a/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp b/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp index bec5db173..238fb40e3 100644 --- a/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp +++ b/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp | |||
| @@ -74,6 +74,11 @@ spv::ImageFormat GetImageFormat(ImageFormat format) { | |||
| 74 | throw InvalidArgument("Invalid image format {}", format); | 74 | throw InvalidArgument("Invalid image format {}", format); |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | spv::ImageFormat GetImageFormatForBuffer(ImageFormat format) { | ||
| 78 | const auto spv_format = GetImageFormat(format); | ||
| 79 | return spv_format == spv::ImageFormat::Unknown ? spv::ImageFormat::R32ui : spv_format; | ||
| 80 | } | ||
| 81 | |||
| 77 | Id ImageType(EmitContext& ctx, const ImageDescriptor& desc) { | 82 | Id ImageType(EmitContext& ctx, const ImageDescriptor& desc) { |
| 78 | const spv::ImageFormat format{GetImageFormat(desc.format)}; | 83 | const spv::ImageFormat format{GetImageFormat(desc.format)}; |
| 79 | const Id type{ctx.U32[1]}; | 84 | const Id type{ctx.U32[1]}; |
| @@ -1271,7 +1276,7 @@ void EmitContext::DefineImageBuffers(const Info& info, u32& binding) { | |||
| 1271 | if (desc.count != 1) { | 1276 | if (desc.count != 1) { |
| 1272 | throw NotImplementedException("Array of image buffers"); | 1277 | throw NotImplementedException("Array of image buffers"); |
| 1273 | } | 1278 | } |
| 1274 | const spv::ImageFormat format{GetImageFormat(desc.format)}; | 1279 | const spv::ImageFormat format{GetImageFormatForBuffer(desc.format)}; |
| 1275 | const Id image_type{TypeImage(U32[1], spv::Dim::Buffer, false, false, false, 2, format)}; | 1280 | const Id image_type{TypeImage(U32[1], spv::Dim::Buffer, false, false, false, 2, format)}; |
| 1276 | const Id pointer_type{TypePointer(spv::StorageClass::UniformConstant, image_type)}; | 1281 | const Id pointer_type{TypePointer(spv::StorageClass::UniformConstant, image_type)}; |
| 1277 | const Id id{AddGlobalVariable(pointer_type, spv::StorageClass::UniformConstant)}; | 1282 | const Id id{AddGlobalVariable(pointer_type, spv::StorageClass::UniformConstant)}; |
diff --git a/src/tests/common/ring_buffer.cpp b/src/tests/common/ring_buffer.cpp index e85f9977b..b6e3bc875 100644 --- a/src/tests/common/ring_buffer.cpp +++ b/src/tests/common/ring_buffer.cpp | |||
| @@ -55,7 +55,7 @@ TEST_CASE("RingBuffer: Basic Tests", "[common]") { | |||
| 55 | // Pushing more values than space available should partially succeed. | 55 | // Pushing more values than space available should partially succeed. |
| 56 | { | 56 | { |
| 57 | std::vector<char> to_push(6); | 57 | std::vector<char> to_push(6); |
| 58 | std::iota(to_push.begin(), to_push.end(), 88); | 58 | std::iota(to_push.begin(), to_push.end(), static_cast<char>(88)); |
| 59 | const std::size_t count = buf.Push(to_push); | 59 | const std::size_t count = buf.Push(to_push); |
| 60 | REQUIRE(count == 3U); | 60 | REQUIRE(count == 3U); |
| 61 | } | 61 | } |
diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.cpp b/src/video_core/renderer_vulkan/renderer_vulkan.cpp index 454bb66a4..c4c30d807 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.cpp +++ b/src/video_core/renderer_vulkan/renderer_vulkan.cpp | |||
| @@ -66,21 +66,6 @@ std::string BuildCommaSeparatedExtensions( | |||
| 66 | return fmt::format("{}", fmt::join(available_extensions, ",")); | 66 | return fmt::format("{}", fmt::join(available_extensions, ",")); |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | DebugCallback MakeDebugCallback(const vk::Instance& instance, const vk::InstanceDispatch& dld) { | ||
| 70 | if (!Settings::values.renderer_debug) { | ||
| 71 | return DebugCallback{}; | ||
| 72 | } | ||
| 73 | const std::optional properties = vk::EnumerateInstanceExtensionProperties(dld); | ||
| 74 | const auto it = std::ranges::find_if(*properties, [](const auto& prop) { | ||
| 75 | return std::strcmp(VK_EXT_DEBUG_UTILS_EXTENSION_NAME, prop.extensionName) == 0; | ||
| 76 | }); | ||
| 77 | if (it != properties->end()) { | ||
| 78 | return CreateDebugUtilsCallback(instance); | ||
| 79 | } else { | ||
| 80 | return CreateDebugReportCallback(instance); | ||
| 81 | } | ||
| 82 | } | ||
| 83 | |||
| 84 | } // Anonymous namespace | 69 | } // Anonymous namespace |
| 85 | 70 | ||
| 86 | Device CreateDevice(const vk::Instance& instance, const vk::InstanceDispatch& dld, | 71 | Device CreateDevice(const vk::Instance& instance, const vk::InstanceDispatch& dld, |
| @@ -103,7 +88,8 @@ RendererVulkan::RendererVulkan(Core::TelemetrySession& telemetry_session_, | |||
| 103 | cpu_memory(cpu_memory_), gpu(gpu_), library(OpenLibrary(context.get())), | 88 | cpu_memory(cpu_memory_), gpu(gpu_), library(OpenLibrary(context.get())), |
| 104 | instance(CreateInstance(*library, dld, VK_API_VERSION_1_1, render_window.GetWindowInfo().type, | 89 | instance(CreateInstance(*library, dld, VK_API_VERSION_1_1, render_window.GetWindowInfo().type, |
| 105 | Settings::values.renderer_debug.GetValue())), | 90 | Settings::values.renderer_debug.GetValue())), |
| 106 | debug_callback(MakeDebugCallback(instance, dld)), | 91 | debug_messenger(Settings::values.renderer_debug ? CreateDebugUtilsCallback(instance) |
| 92 | : vk::DebugUtilsMessenger{}), | ||
| 107 | surface(CreateSurface(instance, render_window.GetWindowInfo())), | 93 | surface(CreateSurface(instance, render_window.GetWindowInfo())), |
| 108 | device(CreateDevice(instance, dld, *surface)), memory_allocator(device), state_tracker(), | 94 | device(CreateDevice(instance, dld, *surface)), memory_allocator(device), state_tracker(), |
| 109 | scheduler(device, state_tracker), | 95 | scheduler(device, state_tracker), |
diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.h b/src/video_core/renderer_vulkan/renderer_vulkan.h index 89e98425e..590bc1c64 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.h +++ b/src/video_core/renderer_vulkan/renderer_vulkan.h | |||
| @@ -35,8 +35,6 @@ class GPU; | |||
| 35 | 35 | ||
| 36 | namespace Vulkan { | 36 | namespace Vulkan { |
| 37 | 37 | ||
| 38 | using DebugCallback = std::variant<vk::DebugUtilsMessenger, vk::DebugReportCallback>; | ||
| 39 | |||
| 40 | Device CreateDevice(const vk::Instance& instance, const vk::InstanceDispatch& dld, | 38 | Device CreateDevice(const vk::Instance& instance, const vk::InstanceDispatch& dld, |
| 41 | VkSurfaceKHR surface); | 39 | VkSurfaceKHR surface); |
| 42 | 40 | ||
| @@ -75,7 +73,7 @@ private: | |||
| 75 | vk::InstanceDispatch dld; | 73 | vk::InstanceDispatch dld; |
| 76 | 74 | ||
| 77 | vk::Instance instance; | 75 | vk::Instance instance; |
| 78 | DebugCallback debug_callback; | 76 | vk::DebugUtilsMessenger debug_messenger; |
| 79 | vk::SurfaceKHR surface; | 77 | vk::SurfaceKHR surface; |
| 80 | 78 | ||
| 81 | ScreenInfo screen_info; | 79 | ScreenInfo screen_info; |
diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp index 60a6ac651..e15865d16 100644 --- a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp | |||
| @@ -529,17 +529,20 @@ void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bi | |||
| 529 | buffer_handles.push_back(handle); | 529 | buffer_handles.push_back(handle); |
| 530 | } | 530 | } |
| 531 | if (device.IsExtExtendedDynamicStateSupported()) { | 531 | if (device.IsExtExtendedDynamicStateSupported()) { |
| 532 | scheduler.Record([bindings_ = std::move(bindings), | 532 | scheduler.Record([this, bindings_ = std::move(bindings), |
| 533 | buffer_handles_ = std::move(buffer_handles)](vk::CommandBuffer cmdbuf) { | 533 | buffer_handles_ = std::move(buffer_handles)](vk::CommandBuffer cmdbuf) { |
| 534 | cmdbuf.BindVertexBuffers2EXT(bindings_.min_index, | 534 | cmdbuf.BindVertexBuffers2EXT(bindings_.min_index, |
| 535 | bindings_.max_index - bindings_.min_index, | 535 | std::min(bindings_.max_index - bindings_.min_index, |
| 536 | device.GetMaxVertexInputBindings()), | ||
| 536 | buffer_handles_.data(), bindings_.offsets.data(), | 537 | buffer_handles_.data(), bindings_.offsets.data(), |
| 537 | bindings_.sizes.data(), bindings_.strides.data()); | 538 | bindings_.sizes.data(), bindings_.strides.data()); |
| 538 | }); | 539 | }); |
| 539 | } else { | 540 | } else { |
| 540 | scheduler.Record([bindings_ = std::move(bindings), | 541 | scheduler.Record([this, bindings_ = std::move(bindings), |
| 541 | buffer_handles_ = std::move(buffer_handles)](vk::CommandBuffer cmdbuf) { | 542 | buffer_handles_ = std::move(buffer_handles)](vk::CommandBuffer cmdbuf) { |
| 542 | cmdbuf.BindVertexBuffers(bindings_.min_index, bindings_.max_index - bindings_.min_index, | 543 | cmdbuf.BindVertexBuffers(bindings_.min_index, |
| 544 | std::min(bindings_.max_index - bindings_.min_index, | ||
| 545 | device.GetMaxVertexInputBindings()), | ||
| 543 | buffer_handles_.data(), bindings_.offsets.data()); | 546 | buffer_handles_.data(), bindings_.offsets.data()); |
| 544 | }); | 547 | }); |
| 545 | } | 548 | } |
diff --git a/src/video_core/vulkan_common/vulkan_debug_callback.cpp b/src/video_core/vulkan_common/vulkan_debug_callback.cpp index 67e8065a4..448df2d3a 100644 --- a/src/video_core/vulkan_common/vulkan_debug_callback.cpp +++ b/src/video_core/vulkan_common/vulkan_debug_callback.cpp | |||
| @@ -63,22 +63,6 @@ VkBool32 DebugUtilCallback(VkDebugUtilsMessageSeverityFlagBitsEXT severity, | |||
| 63 | return VK_FALSE; | 63 | return VK_FALSE; |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | VkBool32 DebugReportCallback(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, | ||
| 67 | uint64_t object, size_t location, int32_t messageCode, | ||
| 68 | const char* pLayerPrefix, const char* pMessage, void* pUserData) { | ||
| 69 | const VkDebugReportFlagBitsEXT severity = static_cast<VkDebugReportFlagBitsEXT>(flags); | ||
| 70 | const std::string_view message{pMessage}; | ||
| 71 | if (severity & VK_DEBUG_REPORT_ERROR_BIT_EXT) { | ||
| 72 | LOG_CRITICAL(Render_Vulkan, "{}", message); | ||
| 73 | } else if (severity & VK_DEBUG_REPORT_WARNING_BIT_EXT) { | ||
| 74 | LOG_WARNING(Render_Vulkan, "{}", message); | ||
| 75 | } else if (severity & VK_DEBUG_REPORT_INFORMATION_BIT_EXT) { | ||
| 76 | LOG_INFO(Render_Vulkan, "{}", message); | ||
| 77 | } else if (severity & VK_DEBUG_REPORT_DEBUG_BIT_EXT) { | ||
| 78 | LOG_DEBUG(Render_Vulkan, "{}", message); | ||
| 79 | } | ||
| 80 | return VK_FALSE; | ||
| 81 | } | ||
| 82 | } // Anonymous namespace | 66 | } // Anonymous namespace |
| 83 | 67 | ||
| 84 | vk::DebugUtilsMessenger CreateDebugUtilsCallback(const vk::Instance& instance) { | 68 | vk::DebugUtilsMessenger CreateDebugUtilsCallback(const vk::Instance& instance) { |
| @@ -98,15 +82,4 @@ vk::DebugUtilsMessenger CreateDebugUtilsCallback(const vk::Instance& instance) { | |||
| 98 | }); | 82 | }); |
| 99 | } | 83 | } |
| 100 | 84 | ||
| 101 | vk::DebugReportCallback CreateDebugReportCallback(const vk::Instance& instance) { | ||
| 102 | return instance.CreateDebugReportCallback({ | ||
| 103 | .sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT, | ||
| 104 | .pNext = nullptr, | ||
| 105 | .flags = VK_DEBUG_REPORT_DEBUG_BIT_EXT | VK_DEBUG_REPORT_INFORMATION_BIT_EXT | | ||
| 106 | VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARNING_BIT_EXT, | ||
| 107 | .pfnCallback = DebugReportCallback, | ||
| 108 | .pUserData = nullptr, | ||
| 109 | }); | ||
| 110 | } | ||
| 111 | |||
| 112 | } // namespace Vulkan | 85 | } // namespace Vulkan |
diff --git a/src/video_core/vulkan_common/vulkan_debug_callback.h b/src/video_core/vulkan_common/vulkan_debug_callback.h index a8af7b406..5e940782f 100644 --- a/src/video_core/vulkan_common/vulkan_debug_callback.h +++ b/src/video_core/vulkan_common/vulkan_debug_callback.h | |||
| @@ -9,6 +9,4 @@ namespace Vulkan { | |||
| 9 | 9 | ||
| 10 | vk::DebugUtilsMessenger CreateDebugUtilsCallback(const vk::Instance& instance); | 10 | vk::DebugUtilsMessenger CreateDebugUtilsCallback(const vk::Instance& instance); |
| 11 | 11 | ||
| 12 | vk::DebugReportCallback CreateDebugReportCallback(const vk::Instance& instance); | ||
| 13 | |||
| 14 | } // namespace Vulkan | 12 | } // namespace Vulkan |
diff --git a/src/video_core/vulkan_common/vulkan_instance.cpp b/src/video_core/vulkan_common/vulkan_instance.cpp index bc16145be..180657a75 100644 --- a/src/video_core/vulkan_common/vulkan_instance.cpp +++ b/src/video_core/vulkan_common/vulkan_instance.cpp | |||
| @@ -76,11 +76,9 @@ namespace { | |||
| 76 | extensions.push_back(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME); | 76 | extensions.push_back(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME); |
| 77 | } | 77 | } |
| 78 | #endif | 78 | #endif |
| 79 | if (enable_validation) { | 79 | if (enable_validation && |
| 80 | const bool debug_utils = | 80 | AreExtensionsSupported(dld, std::array{VK_EXT_DEBUG_UTILS_EXTENSION_NAME})) { |
| 81 | AreExtensionsSupported(dld, std::array{VK_EXT_DEBUG_UTILS_EXTENSION_NAME}); | 81 | extensions.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); |
| 82 | extensions.push_back(debug_utils ? VK_EXT_DEBUG_UTILS_EXTENSION_NAME | ||
| 83 | : VK_EXT_DEBUG_REPORT_EXTENSION_NAME); | ||
| 84 | } | 82 | } |
| 85 | return extensions; | 83 | return extensions; |
| 86 | } | 84 | } |
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index 8622dc184..fd6bebf0f 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp | |||
| @@ -193,14 +193,10 @@ void ConfigureGraphics::PopulateVSyncModeSelection() { | |||
| 193 | : vsync_mode_combobox_enum_map[current_index]; | 193 | : vsync_mode_combobox_enum_map[current_index]; |
| 194 | int index{}; | 194 | int index{}; |
| 195 | const int device{vulkan_device_combobox->currentIndex()}; //< current selected Vulkan device | 195 | const int device{vulkan_device_combobox->currentIndex()}; //< current selected Vulkan device |
| 196 | if (device == -1) { | ||
| 197 | // Invalid device | ||
| 198 | return; | ||
| 199 | } | ||
| 200 | 196 | ||
| 201 | const auto& present_modes = //< relevant vector of present modes for the selected device or API | 197 | const auto& present_modes = //< relevant vector of present modes for the selected device or API |
| 202 | backend == Settings::RendererBackend::Vulkan ? device_present_modes[device] | 198 | backend == Settings::RendererBackend::Vulkan && device > -1 ? device_present_modes[device] |
| 203 | : default_present_modes; | 199 | : default_present_modes; |
| 204 | 200 | ||
| 205 | vsync_mode_combobox->clear(); | 201 | vsync_mode_combobox->clear(); |
| 206 | vsync_mode_combobox_enum_map.clear(); | 202 | vsync_mode_combobox_enum_map.clear(); |
| @@ -497,11 +493,19 @@ void ConfigureGraphics::RetrieveVulkanDevices() { | |||
| 497 | } | 493 | } |
| 498 | 494 | ||
| 499 | Settings::RendererBackend ConfigureGraphics::GetCurrentGraphicsBackend() const { | 495 | Settings::RendererBackend ConfigureGraphics::GetCurrentGraphicsBackend() const { |
| 500 | if (!Settings::IsConfiguringGlobal() && !api_restore_global_button->isEnabled()) { | 496 | const auto selected_backend = [&]() { |
| 501 | return Settings::values.renderer_backend.GetValue(true); | 497 | if (!Settings::IsConfiguringGlobal() && !api_restore_global_button->isEnabled()) { |
| 498 | return Settings::values.renderer_backend.GetValue(true); | ||
| 499 | } | ||
| 500 | return static_cast<Settings::RendererBackend>( | ||
| 501 | combobox_translations.at(Settings::EnumMetadata<Settings::RendererBackend>::Index()) | ||
| 502 | .at(api_combobox->currentIndex()) | ||
| 503 | .first); | ||
| 504 | }(); | ||
| 505 | |||
| 506 | if (selected_backend == Settings::RendererBackend::Vulkan && | ||
| 507 | UISettings::values.has_broken_vulkan) { | ||
| 508 | return Settings::RendererBackend::OpenGL; | ||
| 502 | } | 509 | } |
| 503 | return static_cast<Settings::RendererBackend>( | 510 | return selected_backend; |
| 504 | combobox_translations.at(Settings::EnumMetadata<Settings::RendererBackend>::Index()) | ||
| 505 | .at(api_combobox->currentIndex()) | ||
| 506 | .first); | ||
| 507 | } | 511 | } |
diff --git a/src/yuzu/configuration/shared_widget.cpp b/src/yuzu/configuration/shared_widget.cpp index 7721e58f9..d63093985 100644 --- a/src/yuzu/configuration/shared_widget.cpp +++ b/src/yuzu/configuration/shared_widget.cpp | |||
| @@ -194,7 +194,7 @@ QWidget* Widget::CreateRadioGroup(std::function<std::string()>& serializer, | |||
| 194 | return group; | 194 | return group; |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | const auto get_selected = [=]() -> u32 { | 197 | const auto get_selected = [=]() -> int { |
| 198 | for (const auto& [id, button] : radio_buttons) { | 198 | for (const auto& [id, button] : radio_buttons) { |
| 199 | if (button->isChecked()) { | 199 | if (button->isChecked()) { |
| 200 | return id; | 200 | return id; |
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index b5a02700d..6842ced3e 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp | |||
| @@ -557,6 +557,7 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, const std::stri | |||
| 557 | QMenu* dump_romfs_menu = context_menu.addMenu(tr("Dump RomFS")); | 557 | QMenu* dump_romfs_menu = context_menu.addMenu(tr("Dump RomFS")); |
| 558 | QAction* dump_romfs = dump_romfs_menu->addAction(tr("Dump RomFS")); | 558 | QAction* dump_romfs = dump_romfs_menu->addAction(tr("Dump RomFS")); |
| 559 | QAction* dump_romfs_sdmc = dump_romfs_menu->addAction(tr("Dump RomFS to SDMC")); | 559 | QAction* dump_romfs_sdmc = dump_romfs_menu->addAction(tr("Dump RomFS to SDMC")); |
| 560 | QAction* verify_integrity = context_menu.addAction(tr("Verify Integrity")); | ||
| 560 | QAction* copy_tid = context_menu.addAction(tr("Copy Title ID to Clipboard")); | 561 | QAction* copy_tid = context_menu.addAction(tr("Copy Title ID to Clipboard")); |
| 561 | QAction* navigate_to_gamedb_entry = context_menu.addAction(tr("Navigate to GameDB entry")); | 562 | QAction* navigate_to_gamedb_entry = context_menu.addAction(tr("Navigate to GameDB entry")); |
| 562 | #ifndef WIN32 | 563 | #ifndef WIN32 |
| @@ -628,6 +629,8 @@ void GameList::AddGamePopup(QMenu& context_menu, u64 program_id, const std::stri | |||
| 628 | connect(dump_romfs_sdmc, &QAction::triggered, [this, program_id, path]() { | 629 | connect(dump_romfs_sdmc, &QAction::triggered, [this, program_id, path]() { |
| 629 | emit DumpRomFSRequested(program_id, path, DumpRomFSTarget::SDMC); | 630 | emit DumpRomFSRequested(program_id, path, DumpRomFSTarget::SDMC); |
| 630 | }); | 631 | }); |
| 632 | connect(verify_integrity, &QAction::triggered, | ||
| 633 | [this, path]() { emit VerifyIntegrityRequested(path); }); | ||
| 631 | connect(copy_tid, &QAction::triggered, | 634 | connect(copy_tid, &QAction::triggered, |
| 632 | [this, program_id]() { emit CopyTIDRequested(program_id); }); | 635 | [this, program_id]() { emit CopyTIDRequested(program_id); }); |
| 633 | connect(navigate_to_gamedb_entry, &QAction::triggered, [this, program_id]() { | 636 | connect(navigate_to_gamedb_entry, &QAction::triggered, [this, program_id]() { |
diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h index 6c2f75e53..8aea646b2 100644 --- a/src/yuzu/game_list.h +++ b/src/yuzu/game_list.h | |||
| @@ -113,6 +113,7 @@ signals: | |||
| 113 | void RemoveFileRequested(u64 program_id, GameListRemoveTarget target, | 113 | void RemoveFileRequested(u64 program_id, GameListRemoveTarget target, |
| 114 | const std::string& game_path); | 114 | const std::string& game_path); |
| 115 | void DumpRomFSRequested(u64 program_id, const std::string& game_path, DumpRomFSTarget target); | 115 | void DumpRomFSRequested(u64 program_id, const std::string& game_path, DumpRomFSTarget target); |
| 116 | void VerifyIntegrityRequested(const std::string& game_path); | ||
| 116 | void CopyTIDRequested(u64 program_id); | 117 | void CopyTIDRequested(u64 program_id); |
| 117 | void CreateShortcut(u64 program_id, const std::string& game_path, | 118 | void CreateShortcut(u64 program_id, const std::string& game_path, |
| 118 | GameListShortcutTarget target); | 119 | GameListShortcutTarget target); |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index f2e6c03f0..9cea60c32 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -442,8 +442,13 @@ GMainWindow::GMainWindow(std::unique_ptr<Config> config_, bool has_broken_vulkan | |||
| 442 | "#yuzu-starts-with-the-error-broken-vulkan-installation-detected'>" | 442 | "#yuzu-starts-with-the-error-broken-vulkan-installation-detected'>" |
| 443 | "here for instructions to fix the issue</a>.")); | 443 | "here for instructions to fix the issue</a>.")); |
| 444 | 444 | ||
| 445 | #ifdef HAS_OPENGL | ||
| 445 | Settings::values.renderer_backend = Settings::RendererBackend::OpenGL; | 446 | Settings::values.renderer_backend = Settings::RendererBackend::OpenGL; |
| 447 | #else | ||
| 448 | Settings::values.renderer_backend = Settings::RendererBackend::Null; | ||
| 449 | #endif | ||
| 446 | 450 | ||
| 451 | UpdateAPIText(); | ||
| 447 | renderer_status_button->setDisabled(true); | 452 | renderer_status_button->setDisabled(true); |
| 448 | renderer_status_button->setChecked(false); | 453 | renderer_status_button->setChecked(false); |
| 449 | } else { | 454 | } else { |
| @@ -1447,6 +1452,8 @@ void GMainWindow::ConnectWidgetEvents() { | |||
| 1447 | &GMainWindow::OnGameListRemoveInstalledEntry); | 1452 | &GMainWindow::OnGameListRemoveInstalledEntry); |
| 1448 | connect(game_list, &GameList::RemoveFileRequested, this, &GMainWindow::OnGameListRemoveFile); | 1453 | connect(game_list, &GameList::RemoveFileRequested, this, &GMainWindow::OnGameListRemoveFile); |
| 1449 | connect(game_list, &GameList::DumpRomFSRequested, this, &GMainWindow::OnGameListDumpRomFS); | 1454 | connect(game_list, &GameList::DumpRomFSRequested, this, &GMainWindow::OnGameListDumpRomFS); |
| 1455 | connect(game_list, &GameList::VerifyIntegrityRequested, this, | ||
| 1456 | &GMainWindow::OnGameListVerifyIntegrity); | ||
| 1450 | connect(game_list, &GameList::CopyTIDRequested, this, &GMainWindow::OnGameListCopyTID); | 1457 | connect(game_list, &GameList::CopyTIDRequested, this, &GMainWindow::OnGameListCopyTID); |
| 1451 | connect(game_list, &GameList::NavigateToGamedbEntryRequested, this, | 1458 | connect(game_list, &GameList::NavigateToGamedbEntryRequested, this, |
| 1452 | &GMainWindow::OnGameListNavigateToGamedbEntry); | 1459 | &GMainWindow::OnGameListNavigateToGamedbEntry); |
| @@ -2275,40 +2282,62 @@ void GMainWindow::OnTransferableShaderCacheOpenFile(u64 program_id) { | |||
| 2275 | QDesktopServices::openUrl(QUrl::fromLocalFile(qt_shader_cache_path)); | 2282 | QDesktopServices::openUrl(QUrl::fromLocalFile(qt_shader_cache_path)); |
| 2276 | } | 2283 | } |
| 2277 | 2284 | ||
| 2278 | static std::size_t CalculateRomFSEntrySize(const FileSys::VirtualDir& dir, bool full) { | 2285 | static bool RomFSRawCopy(size_t total_size, size_t& read_size, QProgressDialog& dialog, |
| 2279 | std::size_t out = 0; | 2286 | const FileSys::VirtualDir& src, const FileSys::VirtualDir& dest, |
| 2280 | 2287 | bool full) { | |
| 2281 | for (const auto& subdir : dir->GetSubdirectories()) { | ||
| 2282 | out += 1 + CalculateRomFSEntrySize(subdir, full); | ||
| 2283 | } | ||
| 2284 | |||
| 2285 | return out + (full ? dir->GetFiles().size() : 0); | ||
| 2286 | } | ||
| 2287 | |||
| 2288 | static bool RomFSRawCopy(QProgressDialog& dialog, const FileSys::VirtualDir& src, | ||
| 2289 | const FileSys::VirtualDir& dest, std::size_t block_size, bool full) { | ||
| 2290 | if (src == nullptr || dest == nullptr || !src->IsReadable() || !dest->IsWritable()) | 2288 | if (src == nullptr || dest == nullptr || !src->IsReadable() || !dest->IsWritable()) |
| 2291 | return false; | 2289 | return false; |
| 2292 | if (dialog.wasCanceled()) | 2290 | if (dialog.wasCanceled()) |
| 2293 | return false; | 2291 | return false; |
| 2294 | 2292 | ||
| 2293 | std::vector<u8> buffer(CopyBufferSize); | ||
| 2294 | auto last_timestamp = std::chrono::steady_clock::now(); | ||
| 2295 | |||
| 2296 | const auto QtRawCopy = [&](const FileSys::VirtualFile& src_file, | ||
| 2297 | const FileSys::VirtualFile& dest_file) { | ||
| 2298 | if (src_file == nullptr || dest_file == nullptr) { | ||
| 2299 | return false; | ||
| 2300 | } | ||
| 2301 | if (!dest_file->Resize(src_file->GetSize())) { | ||
| 2302 | return false; | ||
| 2303 | } | ||
| 2304 | |||
| 2305 | for (std::size_t i = 0; i < src_file->GetSize(); i += buffer.size()) { | ||
| 2306 | if (dialog.wasCanceled()) { | ||
| 2307 | dest_file->Resize(0); | ||
| 2308 | return false; | ||
| 2309 | } | ||
| 2310 | |||
| 2311 | using namespace std::literals::chrono_literals; | ||
| 2312 | const auto new_timestamp = std::chrono::steady_clock::now(); | ||
| 2313 | |||
| 2314 | if ((new_timestamp - last_timestamp) > 33ms) { | ||
| 2315 | last_timestamp = new_timestamp; | ||
| 2316 | dialog.setValue( | ||
| 2317 | static_cast<int>(std::min(read_size, total_size) * 100 / total_size)); | ||
| 2318 | QCoreApplication::processEvents(); | ||
| 2319 | } | ||
| 2320 | |||
| 2321 | const auto read = src_file->Read(buffer.data(), buffer.size(), i); | ||
| 2322 | dest_file->Write(buffer.data(), read, i); | ||
| 2323 | |||
| 2324 | read_size += read; | ||
| 2325 | } | ||
| 2326 | |||
| 2327 | return true; | ||
| 2328 | }; | ||
| 2329 | |||
| 2295 | if (full) { | 2330 | if (full) { |
| 2296 | for (const auto& file : src->GetFiles()) { | 2331 | for (const auto& file : src->GetFiles()) { |
| 2297 | const auto out = VfsDirectoryCreateFileWrapper(dest, file->GetName()); | 2332 | const auto out = VfsDirectoryCreateFileWrapper(dest, file->GetName()); |
| 2298 | if (!FileSys::VfsRawCopy(file, out, block_size)) | 2333 | if (!QtRawCopy(file, out)) |
| 2299 | return false; | ||
| 2300 | dialog.setValue(dialog.value() + 1); | ||
| 2301 | if (dialog.wasCanceled()) | ||
| 2302 | return false; | 2334 | return false; |
| 2303 | } | 2335 | } |
| 2304 | } | 2336 | } |
| 2305 | 2337 | ||
| 2306 | for (const auto& dir : src->GetSubdirectories()) { | 2338 | for (const auto& dir : src->GetSubdirectories()) { |
| 2307 | const auto out = dest->CreateSubdirectory(dir->GetName()); | 2339 | const auto out = dest->CreateSubdirectory(dir->GetName()); |
| 2308 | if (!RomFSRawCopy(dialog, dir, out, block_size, full)) | 2340 | if (!RomFSRawCopy(total_size, read_size, dialog, dir, out, full)) |
| 2309 | return false; | ||
| 2310 | dialog.setValue(dialog.value() + 1); | ||
| 2311 | if (dialog.wasCanceled()) | ||
| 2312 | return false; | 2341 | return false; |
| 2313 | } | 2342 | } |
| 2314 | 2343 | ||
| @@ -2653,10 +2682,9 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa | |||
| 2653 | } | 2682 | } |
| 2654 | 2683 | ||
| 2655 | const auto full = res == selections.constFirst(); | 2684 | const auto full = res == selections.constFirst(); |
| 2656 | const auto entry_size = CalculateRomFSEntrySize(extracted, full); | ||
| 2657 | 2685 | ||
| 2658 | // The minimum required space is the size of the extracted RomFS + 1 GiB | 2686 | // The expected required space is the size of the RomFS + 1 GiB |
| 2659 | const auto minimum_free_space = extracted->GetSize() + 0x40000000; | 2687 | const auto minimum_free_space = romfs->GetSize() + 0x40000000; |
| 2660 | 2688 | ||
| 2661 | if (full && Common::FS::GetFreeSpaceSize(path) < minimum_free_space) { | 2689 | if (full && Common::FS::GetFreeSpaceSize(path) < minimum_free_space) { |
| 2662 | QMessageBox::warning(this, tr("RomFS Extraction Failed!"), | 2690 | QMessageBox::warning(this, tr("RomFS Extraction Failed!"), |
| @@ -2667,12 +2695,15 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa | |||
| 2667 | return; | 2695 | return; |
| 2668 | } | 2696 | } |
| 2669 | 2697 | ||
| 2670 | QProgressDialog progress(tr("Extracting RomFS..."), tr("Cancel"), 0, | 2698 | QProgressDialog progress(tr("Extracting RomFS..."), tr("Cancel"), 0, 100, this); |
| 2671 | static_cast<s32>(entry_size), this); | ||
| 2672 | progress.setWindowModality(Qt::WindowModal); | 2699 | progress.setWindowModality(Qt::WindowModal); |
| 2673 | progress.setMinimumDuration(100); | 2700 | progress.setMinimumDuration(100); |
| 2701 | progress.setAutoClose(false); | ||
| 2702 | progress.setAutoReset(false); | ||
| 2674 | 2703 | ||
| 2675 | if (RomFSRawCopy(progress, extracted, out, 0x400000, full)) { | 2704 | size_t read_size = 0; |
| 2705 | |||
| 2706 | if (RomFSRawCopy(romfs->GetSize(), read_size, progress, extracted, out, full)) { | ||
| 2676 | progress.close(); | 2707 | progress.close(); |
| 2677 | QMessageBox::information(this, tr("RomFS Extraction Succeeded!"), | 2708 | QMessageBox::information(this, tr("RomFS Extraction Succeeded!"), |
| 2678 | tr("The operation completed successfully.")); | 2709 | tr("The operation completed successfully.")); |
| @@ -2684,6 +2715,54 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa | |||
| 2684 | } | 2715 | } |
| 2685 | } | 2716 | } |
| 2686 | 2717 | ||
| 2718 | void GMainWindow::OnGameListVerifyIntegrity(const std::string& game_path) { | ||
| 2719 | const auto NotImplemented = [this] { | ||
| 2720 | QMessageBox::warning(this, tr("Integrity verification couldn't be performed!"), | ||
| 2721 | tr("File contents were not checked for validity.")); | ||
| 2722 | }; | ||
| 2723 | const auto Failed = [this] { | ||
| 2724 | QMessageBox::critical(this, tr("Integrity verification failed!"), | ||
| 2725 | tr("File contents may be corrupt.")); | ||
| 2726 | }; | ||
| 2727 | |||
| 2728 | const auto loader = Loader::GetLoader(*system, vfs->OpenFile(game_path, FileSys::Mode::Read)); | ||
| 2729 | if (loader == nullptr) { | ||
| 2730 | NotImplemented(); | ||
| 2731 | return; | ||
| 2732 | } | ||
| 2733 | |||
| 2734 | QProgressDialog progress(tr("Verifying integrity..."), tr("Cancel"), 0, 100, this); | ||
| 2735 | progress.setWindowModality(Qt::WindowModal); | ||
| 2736 | progress.setMinimumDuration(100); | ||
| 2737 | progress.setAutoClose(false); | ||
| 2738 | progress.setAutoReset(false); | ||
| 2739 | |||
| 2740 | const auto QtProgressCallback = [&](size_t processed_size, size_t total_size) { | ||
| 2741 | if (progress.wasCanceled()) { | ||
| 2742 | return false; | ||
| 2743 | } | ||
| 2744 | |||
| 2745 | progress.setValue(static_cast<int>((processed_size * 100) / total_size)); | ||
| 2746 | return true; | ||
| 2747 | }; | ||
| 2748 | |||
| 2749 | const auto status = loader->VerifyIntegrity(QtProgressCallback); | ||
| 2750 | if (progress.wasCanceled() || | ||
| 2751 | status == Loader::ResultStatus::ErrorIntegrityVerificationNotImplemented) { | ||
| 2752 | NotImplemented(); | ||
| 2753 | return; | ||
| 2754 | } | ||
| 2755 | |||
| 2756 | if (status == Loader::ResultStatus::ErrorIntegrityVerificationFailed) { | ||
| 2757 | Failed(); | ||
| 2758 | return; | ||
| 2759 | } | ||
| 2760 | |||
| 2761 | progress.close(); | ||
| 2762 | QMessageBox::information(this, tr("Integrity verification succeeded!"), | ||
| 2763 | tr("The operation completed successfully.")); | ||
| 2764 | } | ||
| 2765 | |||
| 2687 | void GMainWindow::OnGameListCopyTID(u64 program_id) { | 2766 | void GMainWindow::OnGameListCopyTID(u64 program_id) { |
| 2688 | QClipboard* clipboard = QGuiApplication::clipboard(); | 2767 | QClipboard* clipboard = QGuiApplication::clipboard(); |
| 2689 | clipboard->setText(QString::fromStdString(fmt::format("{:016X}", program_id))); | 2768 | clipboard->setText(QString::fromStdString(fmt::format("{:016X}", program_id))); |
| @@ -3770,10 +3849,14 @@ void GMainWindow::OnToggleAdaptingFilter() { | |||
| 3770 | 3849 | ||
| 3771 | void GMainWindow::OnToggleGraphicsAPI() { | 3850 | void GMainWindow::OnToggleGraphicsAPI() { |
| 3772 | auto api = Settings::values.renderer_backend.GetValue(); | 3851 | auto api = Settings::values.renderer_backend.GetValue(); |
| 3773 | if (api == Settings::RendererBackend::OpenGL) { | 3852 | if (api != Settings::RendererBackend::Vulkan) { |
| 3774 | api = Settings::RendererBackend::Vulkan; | 3853 | api = Settings::RendererBackend::Vulkan; |
| 3775 | } else { | 3854 | } else { |
| 3855 | #ifdef HAS_OPENGL | ||
| 3776 | api = Settings::RendererBackend::OpenGL; | 3856 | api = Settings::RendererBackend::OpenGL; |
| 3857 | #else | ||
| 3858 | api = Settings::RendererBackend::Null; | ||
| 3859 | #endif | ||
| 3777 | } | 3860 | } |
| 3778 | Settings::values.renderer_backend.SetValue(api); | 3861 | Settings::values.renderer_backend.SetValue(api); |
| 3779 | renderer_status_button->setChecked(api == Settings::RendererBackend::Vulkan); | 3862 | renderer_status_button->setChecked(api == Settings::RendererBackend::Vulkan); |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 668dbc3b1..1e4f6e477 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -313,6 +313,7 @@ private slots: | |||
| 313 | void OnGameListRemoveFile(u64 program_id, GameListRemoveTarget target, | 313 | void OnGameListRemoveFile(u64 program_id, GameListRemoveTarget target, |
| 314 | const std::string& game_path); | 314 | const std::string& game_path); |
| 315 | void OnGameListDumpRomFS(u64 program_id, const std::string& game_path, DumpRomFSTarget target); | 315 | void OnGameListDumpRomFS(u64 program_id, const std::string& game_path, DumpRomFSTarget target); |
| 316 | void OnGameListVerifyIntegrity(const std::string& game_path); | ||
| 316 | void OnGameListCopyTID(u64 program_id); | 317 | void OnGameListCopyTID(u64 program_id); |
| 317 | void OnGameListNavigateToGamedbEntry(u64 program_id, | 318 | void OnGameListNavigateToGamedbEntry(u64 program_id, |
| 318 | const CompatibilityList& compatibility_list); | 319 | const CompatibilityList& compatibility_list); |
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index d0433ffc6..c1695cc6e 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp | |||
| @@ -265,7 +265,7 @@ int main(int argc, char** argv) { | |||
| 265 | password = match[2]; | 265 | password = match[2]; |
| 266 | address = match[3]; | 266 | address = match[3]; |
| 267 | if (!match[4].str().empty()) | 267 | if (!match[4].str().empty()) |
| 268 | port = std::stoi(match[4]); | 268 | port = static_cast<u16>(std::stoi(match[4])); |
| 269 | std::regex nickname_re("^[a-zA-Z0-9._\\- ]+$"); | 269 | std::regex nickname_re("^[a-zA-Z0-9._\\- ]+$"); |
| 270 | if (!std::regex_match(nickname, nickname_re)) { | 270 | if (!std::regex_match(nickname, nickname_re)) { |
| 271 | std::cout | 271 | std::cout |