From 8e47680fdf3d9223a04bb38771ba8f6fbe2130d2 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Sun, 3 Sep 2023 21:57:51 +0200 Subject: [PATCH] early-access version 3855 --- README.md | 2 +- src/audio_core/CMakeLists.txt | 16 +- src/audio_core/adsp/adsp.cpp | 18 ++ src/audio_core/adsp/adsp.h | 53 +++++ .../apps/audio_renderer/audio_renderer.cpp | 215 ++++++++++++++++++ .../adsp/apps/audio_renderer/audio_renderer.h | 115 ++++++++++ .../adsp/apps/audio_renderer/command_buffer.h | 23 ++ .../audio_renderer/command_list_processor.cpp | 108 +++++++++ .../audio_renderer/command_list_processor.h | 120 ++++++++++ src/audio_core/adsp/mailbox.cpp | 0 src/audio_core/adsp/mailbox.h | 69 ++++++ src/audio_core/audio_core.cpp | 4 +- src/audio_core/audio_core.h | 6 +- src/audio_core/audio_in_manager.cpp | 2 +- src/audio_core/audio_in_manager.h | 4 +- src/audio_core/audio_out_manager.cpp | 2 +- src/audio_core/audio_out_manager.h | 3 +- src/audio_core/audio_render_manager.cpp | 4 +- src/audio_core/audio_render_manager.h | 4 +- .../common/audio_renderer_parameter.h | 6 +- src/audio_core/renderer/audio_device.cpp | 4 +- src/audio_core/renderer/audio_device.h | 4 +- src/audio_core/renderer/audio_renderer.cpp | 4 +- src/audio_core/renderer/audio_renderer.h | 6 +- .../renderer/behavior/behavior_info.cpp | 4 +- .../renderer/behavior/behavior_info.h | 8 +- .../renderer/behavior/info_updater.cpp | 4 +- .../renderer/behavior/info_updater.h | 4 +- .../renderer/command/command_buffer.cpp | 4 +- .../renderer/command/command_buffer.h | 4 +- .../renderer/command/command_generator.cpp | 4 +- .../renderer/command/command_generator.h | 4 +- .../renderer/command/command_list_header.h | 4 +- .../command_processing_time_estimator.cpp | 4 +- .../command_processing_time_estimator.h | 4 +- .../renderer/command/data_source/adpcm.cpp | 18 +- .../renderer/command/data_source/adpcm.h | 23 +- .../renderer/command/data_source/decode.cpp | 6 +- .../renderer/command/data_source/decode.h | 4 +- .../command/data_source/pcm_float.cpp | 22 +- .../renderer/command/data_source/pcm_float.h | 23 +- .../command/data_source/pcm_int16.cpp | 22 +- .../renderer/command/data_source/pcm_int16.h | 23 +- .../renderer/command/effect/aux_.cpp | 12 +- src/audio_core/renderer/command/effect/aux_.h | 13 +- .../renderer/command/effect/biquad_filter.cpp | 14 +- .../renderer/command/effect/biquad_filter.h | 13 +- .../renderer/command/effect/capture.cpp | 12 +- .../renderer/command/effect/capture.h | 13 +- .../renderer/command/effect/compressor.cpp | 12 +- .../renderer/command/effect/compressor.h | 13 +- .../renderer/command/effect/delay.cpp | 12 +- .../renderer/command/effect/delay.h | 13 +- .../renderer/command/effect/i3dl2_reverb.cpp | 12 +- .../renderer/command/effect/i3dl2_reverb.h | 13 +- .../renderer/command/effect/light_limiter.cpp | 22 +- .../renderer/command/effect/light_limiter.h | 19 +- .../effect/multi_tap_biquad_filter.cpp | 14 +- .../command/effect/multi_tap_biquad_filter.h | 13 +- .../renderer/command/effect/reverb.cpp | 12 +- .../renderer/command/effect/reverb.h | 13 +- src/audio_core/renderer/command/icommand.h | 17 +- .../renderer/command/mix/clear_mix.cpp | 14 +- .../renderer/command/mix/clear_mix.h | 13 +- .../renderer/command/mix/copy_mix.cpp | 14 +- .../renderer/command/mix/copy_mix.h | 13 +- .../command/mix/depop_for_mix_buffers.cpp | 14 +- .../command/mix/depop_for_mix_buffers.h | 13 +- .../renderer/command/mix/depop_prepare.cpp | 14 +- .../renderer/command/mix/depop_prepare.h | 13 +- src/audio_core/renderer/command/mix/mix.cpp | 12 +- src/audio_core/renderer/command/mix/mix.h | 13 +- .../renderer/command/mix/mix_ramp.cpp | 13 +- .../renderer/command/mix/mix_ramp.h | 13 +- .../renderer/command/mix/mix_ramp_grouped.cpp | 13 +- .../renderer/command/mix/mix_ramp_grouped.h | 13 +- .../renderer/command/mix/volume.cpp | 12 +- src/audio_core/renderer/command/mix/volume.h | 13 +- .../renderer/command/mix/volume_ramp.cpp | 13 +- .../renderer/command/mix/volume_ramp.h | 13 +- .../command/performance/performance.cpp | 20 +- .../command/performance/performance.h | 13 +- .../command/resample/downmix_6ch_to_2ch.cpp | 14 +- .../command/resample/downmix_6ch_to_2ch.h | 13 +- .../renderer/command/resample/resample.cpp | 4 +- .../renderer/command/resample/resample.h | 4 +- .../renderer/command/resample/upsample.cpp | 12 +- .../renderer/command/resample/upsample.h | 13 +- .../renderer/command/sink/circular_buffer.cpp | 14 +- .../renderer/command/sink/circular_buffer.h | 13 +- .../renderer/command/sink/device.cpp | 12 +- src/audio_core/renderer/command/sink/device.h | 13 +- src/audio_core/renderer/effect/aux_.cpp | 4 +- src/audio_core/renderer/effect/aux_.h | 4 +- .../renderer/effect/biquad_filter.cpp | 4 +- .../renderer/effect/biquad_filter.h | 4 +- .../renderer/effect/buffer_mixer.cpp | 4 +- src/audio_core/renderer/effect/buffer_mixer.h | 4 +- src/audio_core/renderer/effect/capture.cpp | 4 +- src/audio_core/renderer/effect/capture.h | 4 +- src/audio_core/renderer/effect/compressor.cpp | 4 +- src/audio_core/renderer/effect/compressor.h | 4 +- src/audio_core/renderer/effect/delay.cpp | 4 +- src/audio_core/renderer/effect/delay.h | 4 +- .../renderer/effect/effect_context.cpp | 4 +- .../renderer/effect/effect_context.h | 4 +- .../renderer/effect/effect_info_base.h | 4 +- src/audio_core/renderer/effect/effect_reset.h | 4 +- .../renderer/effect/effect_result_state.h | 4 +- src/audio_core/renderer/effect/i3dl2.cpp | 4 +- src/audio_core/renderer/effect/i3dl2.h | 4 +- .../renderer/effect/light_limiter.cpp | 4 +- .../renderer/effect/light_limiter.h | 4 +- src/audio_core/renderer/effect/reverb.cpp | 4 +- src/audio_core/renderer/effect/reverb.h | 4 +- src/audio_core/renderer/memory/address_info.h | 4 +- .../renderer/memory/memory_pool_info.cpp | 4 +- .../renderer/memory/memory_pool_info.h | 4 +- .../renderer/memory/pool_mapper.cpp | 4 +- src/audio_core/renderer/memory/pool_mapper.h | 4 +- src/audio_core/renderer/mix/mix_context.cpp | 4 +- src/audio_core/renderer/mix/mix_context.h | 4 +- src/audio_core/renderer/mix/mix_info.cpp | 4 +- src/audio_core/renderer/mix/mix_info.h | 4 +- src/audio_core/renderer/nodes/bit_array.h | 4 +- src/audio_core/renderer/nodes/edge_matrix.cpp | 4 +- src/audio_core/renderer/nodes/edge_matrix.h | 4 +- src/audio_core/renderer/nodes/node_states.cpp | 4 +- src/audio_core/renderer/nodes/node_states.h | 4 +- .../renderer/performance/detail_aspect.cpp | 4 +- .../renderer/performance/detail_aspect.h | 4 +- .../renderer/performance/entry_aspect.cpp | 4 +- .../renderer/performance/entry_aspect.h | 4 +- .../renderer/performance/performance_detail.h | 4 +- .../renderer/performance/performance_entry.h | 4 +- .../performance/performance_entry_addresses.h | 4 +- .../performance/performance_frame_header.h | 4 +- .../performance/performance_manager.cpp | 4 +- .../performance/performance_manager.h | 4 +- .../sink/circular_buffer_sink_info.cpp | 4 +- .../renderer/sink/circular_buffer_sink_info.h | 4 +- .../renderer/sink/device_sink_info.cpp | 4 +- .../renderer/sink/device_sink_info.h | 4 +- src/audio_core/renderer/sink/sink_context.cpp | 4 +- src/audio_core/renderer/sink/sink_context.h | 4 +- .../renderer/sink/sink_info_base.cpp | 4 +- src/audio_core/renderer/sink/sink_info_base.h | 4 +- .../renderer/splitter/splitter_context.cpp | 4 +- .../renderer/splitter/splitter_context.h | 4 +- .../splitter/splitter_destinations_data.cpp | 4 +- .../splitter/splitter_destinations_data.h | 4 +- .../renderer/splitter/splitter_info.cpp | 4 +- .../renderer/splitter/splitter_info.h | 4 +- src/audio_core/renderer/system.cpp | 32 +-- src/audio_core/renderer/system.h | 16 +- src/audio_core/renderer/system_manager.cpp | 30 +-- src/audio_core/renderer/system_manager.h | 21 +- .../renderer/upsampler/upsampler_info.h | 4 +- .../renderer/upsampler/upsampler_manager.cpp | 4 +- .../renderer/upsampler/upsampler_manager.h | 4 +- .../renderer/upsampler/upsampler_state.h | 4 +- .../renderer/voice/voice_channel_resource.h | 4 +- .../renderer/voice/voice_context.cpp | 4 +- src/audio_core/renderer/voice/voice_context.h | 4 +- src/audio_core/renderer/voice/voice_info.cpp | 4 +- src/audio_core/renderer/voice/voice_info.h | 4 +- src/audio_core/renderer/voice/voice_state.h | 4 +- src/common/settings.h | 3 +- src/core/core.cpp | 6 +- src/core/hle/service/audio/audin_u.cpp | 4 +- src/core/hle/service/audio/audout_u.cpp | 2 +- src/core/hle/service/audio/audren_u.cpp | 2 +- src/core/hle/service/audio/audren_u.h | 2 +- .../backend/spirv/emit_spirv_image.cpp | 4 +- .../backend/spirv/spirv_emit_context.cpp | 3 +- .../backend/spirv/spirv_emit_context.h | 1 - .../renderer_vulkan/vk_rasterizer.cpp | 2 +- src/yuzu/main.cpp | 76 ++++--- 178 files changed, 1448 insertions(+), 664 deletions(-) create mode 100755 src/audio_core/adsp/adsp.cpp create mode 100755 src/audio_core/adsp/adsp.h create mode 100755 src/audio_core/adsp/apps/audio_renderer/audio_renderer.cpp create mode 100755 src/audio_core/adsp/apps/audio_renderer/audio_renderer.h create mode 100755 src/audio_core/adsp/apps/audio_renderer/command_buffer.h create mode 100755 src/audio_core/adsp/apps/audio_renderer/command_list_processor.cpp create mode 100755 src/audio_core/adsp/apps/audio_renderer/command_list_processor.h create mode 100755 src/audio_core/adsp/mailbox.cpp create mode 100755 src/audio_core/adsp/mailbox.h diff --git a/README.md b/README.md index 11d056899..caf9d4c4d 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 3854. +This is the source code for early-access 3855. ## Legal Notice diff --git a/src/audio_core/CMakeLists.txt b/src/audio_core/CMakeLists.txt index e7d5442b4..10a1e09fa 100755 --- a/src/audio_core/CMakeLists.txt +++ b/src/audio_core/CMakeLists.txt @@ -2,6 +2,15 @@ # SPDX-License-Identifier: GPL-2.0-or-later add_library(audio_core STATIC + adsp/adsp.cpp + adsp/adsp.h + adsp/mailbox.h + adsp/mailbox.cpp + adsp/apps/audio_renderer/audio_renderer.cpp + adsp/apps/audio_renderer/audio_renderer.h + adsp/apps/audio_renderer/command_buffer.h + adsp/apps/audio_renderer/command_list_processor.cpp + adsp/apps/audio_renderer/command_list_processor.h audio_core.cpp audio_core.h audio_event.h @@ -32,13 +41,6 @@ add_library(audio_core STATIC out/audio_out_system.cpp out/audio_out_system.h precompiled_headers.h - renderer/adsp/adsp.cpp - renderer/adsp/adsp.h - renderer/adsp/audio_renderer.cpp - renderer/adsp/audio_renderer.h - renderer/adsp/command_buffer.h - renderer/adsp/command_list_processor.cpp - renderer/adsp/command_list_processor.h renderer/audio_device.cpp renderer/audio_device.h renderer/audio_renderer.h diff --git a/src/audio_core/adsp/adsp.cpp b/src/audio_core/adsp/adsp.cpp new file mode 100755 index 000000000..1b1915cc6 --- /dev/null +++ b/src/audio_core/adsp/adsp.cpp @@ -0,0 +1,18 @@ +// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "audio_core/adsp/adsp.h" +#include "core/core.h" + +namespace AudioCore::ADSP { + +ADSP::ADSP(Core::System& system, Sink::Sink& sink) { + audio_renderer = + std::make_unique(system, system.ApplicationMemory(), sink); +} + +AudioRenderer::AudioRenderer& ADSP::AudioRenderer() { + return *audio_renderer.get(); +} + +} // namespace AudioCore::ADSP diff --git a/src/audio_core/adsp/adsp.h b/src/audio_core/adsp/adsp.h new file mode 100755 index 000000000..721610664 --- /dev/null +++ b/src/audio_core/adsp/adsp.h @@ -0,0 +1,53 @@ +// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include +#include + +#include "audio_core/adsp/apps/audio_renderer/audio_renderer.h" +#include "common/common_types.h" + +namespace Core { +class System; +} // namespace Core + +namespace AudioCore { +namespace Sink { +class Sink; +} + +namespace ADSP { + +/** + * Represents the ADSP embedded within the audio sysmodule. + * This is a 32-bit Linux4Tegra kernel from nVidia, which is launched with the sysmodule on boot. + * + * The kernel will run the apps you write for it, Nintendo have the following: + * + * Gmix - Responsible for mixing final audio and sending it out to hardware. This is last place all + * audio samples end up, and we skip it entirely, since we have very different backends and + * mixing is implicitly handled by the OS (but also due to lack of research/simplicity). + * + * AudioRenderer - Receives command lists generated by the audio render + * system on the host, processes them, and sends the samples to Gmix. + * + * OpusDecoder - Contains libopus, and decodes Opus audio packets into raw pcm data. + * + * Communication between the host and ADSP is done through mailboxes, and mapping of shared memory. + */ +class ADSP { +public: + explicit ADSP(Core::System& system, Sink::Sink& sink); + ~ADSP() = default; + + AudioRenderer::AudioRenderer& AudioRenderer(); + +private: + /// AudioRenderer app + std::unique_ptr audio_renderer{}; +}; + +} // namespace ADSP +} // 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 100755 index 000000000..db8a9f1fb --- /dev/null +++ b/src/audio_core/adsp/apps/audio_renderer/audio_renderer.cpp @@ -0,0 +1,215 @@ +// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include +#include + +#include "audio_core/adsp/apps/audio_renderer/audio_renderer.h" +#include "audio_core/audio_core.h" +#include "audio_core/common/common.h" +#include "audio_core/sink/sink.h" +#include "common/logging/log.h" +#include "common/microprofile.h" +#include "common/thread.h" +#include "core/core.h" +#include "core/core_timing.h" + +MICROPROFILE_DEFINE(Audio_Renderer, "Audio", "DSP", MP_RGB(60, 19, 97)); + +namespace AudioCore::ADSP::AudioRenderer { + +AudioRenderer::AudioRenderer(Core::System& system_, Core::Memory::Memory& memory_, + Sink::Sink& sink_) + : system{system_}, memory{memory_}, sink{sink_} {} + +AudioRenderer::~AudioRenderer() { + Stop(); +} + +void AudioRenderer::Start() { + CreateSinkStreams(); + + mailbox.Initialize(AppMailboxId::AudioRenderer); + + main_thread = std::jthread([this](std::stop_token stop_token) { Main(stop_token); }); + + mailbox.Send(Direction::DSP, {Message::InitializeOK, {}}); + if (mailbox.Receive(Direction::Host).msg != Message::InitializeOK) { + LOG_ERROR(Service_Audio, "Host Audio Renderer -- Failed to receive shutdown " + "message response from ADSP!"); + return; + } + running = true; +} + +void AudioRenderer::Stop() { + if (!running) { + return; + } + + mailbox.Send(Direction::DSP, {Message::Shutdown, {}}); + if (mailbox.Receive(Direction::Host).msg != Message::Shutdown) { + LOG_ERROR(Service_Audio, "Host Audio Renderer -- Failed to receive shutdown " + "message response from ADSP!"); + } + main_thread.request_stop(); + main_thread.join(); + + for (auto& stream : streams) { + if (stream) { + stream->Stop(); + sink.CloseStream(stream); + stream = nullptr; + } + } + running = false; +} + +void AudioRenderer::Signal() { + signalled_tick = system.CoreTiming().GetGlobalTimeNs().count(); + Send(Direction::DSP, {Message::Render, {}}); +} + +void AudioRenderer::Wait() { + auto received = Receive(Direction::Host); + if (received.msg != Message::RenderResponse) { + LOG_ERROR(Service_Audio, + "Did not receive the expected render response from the AudioRenderer! Expected " + "{}, got {}", + Message::RenderResponse, received.msg); + } +} + +void AudioRenderer::Send(Direction dir, MailboxMessage message) { + mailbox.Send(dir, std::move(message)); +} + +MailboxMessage AudioRenderer::Receive(Direction dir, bool block) { + return mailbox.Receive(dir, block); +} + +void AudioRenderer::SetCommandBuffer(s32 session_id, CommandBuffer& buffer) noexcept { + command_buffers[session_id] = buffer; +} + +u32 AudioRenderer::GetRemainCommandCount(s32 session_id) const noexcept { + return command_buffers[session_id].remaining_command_count; +} + +void AudioRenderer::ClearRemainCommandCount(s32 session_id) noexcept { + command_buffers[session_id].remaining_command_count = 0; +} + +u64 AudioRenderer::GetRenderingStartTick(s32 session_id) const noexcept { + return (1000 * command_buffers[session_id].render_time_taken_us) + signalled_tick; +} + +void AudioRenderer::CreateSinkStreams() { + u32 channels{sink.GetDeviceChannels()}; + for (u32 i = 0; i < MaxRendererSessions; i++) { + std::string name{fmt::format("ADSP_RenderStream-{}", i)}; + streams[i] = + sink.AcquireSinkStream(system, channels, name, ::AudioCore::Sink::StreamType::Render); + streams[i]->SetRingSize(4); + } +} + +void AudioRenderer::Main(std::stop_token stop_token) { + static constexpr char name[]{"AudioRenderer"}; + MicroProfileOnThreadCreate(name); + Common::SetCurrentThreadName(name); + Common::SetCurrentThreadPriority(Common::ThreadPriority::High); + + // TODO: Create buffer map/unmap thread + mailbox + // TODO: Create gMix devices, initialize them here + + if (mailbox.Receive(Direction::DSP).msg != Message::InitializeOK) { + LOG_ERROR(Service_Audio, + "ADSP Audio Renderer -- Failed to receive initialize message from host!"); + return; + } + + mailbox.Send(Direction::Host, {Message::InitializeOK, {}}); + + // 0.12 seconds (2,304,000 / 19,200,000) + constexpr u64 max_process_time{2'304'000ULL}; + + while (!stop_token.stop_requested()) { + auto received{mailbox.Receive(Direction::DSP)}; + switch (received.msg) { + case Message::Shutdown: + mailbox.Send(Direction::Host, {Message::Shutdown, {}}); + return; + + case Message::Render: { + if (system.IsShuttingDown()) [[unlikely]] { + std::this_thread::sleep_for(std::chrono::milliseconds(5)); + mailbox.Send(Direction::Host, {Message::RenderResponse, {}}); + continue; + } + std::array buffers_reset{}; + std::array render_times_taken{}; + const auto start_time{system.CoreTiming().GetGlobalTimeUs().count()}; + + for (u32 index = 0; index < MaxRendererSessions; index++) { + auto& command_buffer{command_buffers[index]}; + auto& command_list_processor{command_list_processors[index]}; + + // Check this buffer is valid, as it may not be used. + if (command_buffer.buffer != 0) { + // If there are no remaining commands (from the previous list), + // this is a new command list, initialize it. + if (command_buffer.remaining_command_count == 0) { + command_list_processor.Initialize(system, command_buffer.buffer, + command_buffer.size, streams[index]); + } + + if (command_buffer.reset_buffer && !buffers_reset[index]) { + streams[index]->ClearQueue(); + buffers_reset[index] = true; + } + + u64 max_time{max_process_time}; + if (index == 1 && command_buffer.applet_resource_user_id == + command_buffers[0].applet_resource_user_id) { + max_time = max_process_time - render_times_taken[0]; + if (render_times_taken[0] > max_process_time) { + max_time = 0; + } + } + + max_time = std::min(command_buffer.time_limit, max_time); + command_list_processor.SetProcessTimeMax(max_time); + + if (index == 0) { + streams[index]->WaitFreeSpace(stop_token); + } + + // Process the command list + { + MICROPROFILE_SCOPE(Audio_Renderer); + render_times_taken[index] = + command_list_processor.Process(index) - start_time; + } + + const auto end_time{system.CoreTiming().GetGlobalTimeUs().count()}; + + command_buffer.remaining_command_count = + command_list_processor.GetRemainingCommandCount(); + command_buffer.render_time_taken_us = end_time - start_time; + } + } + + mailbox.Send(Direction::Host, {Message::RenderResponse, {}}); + } break; + + default: + LOG_WARNING(Service_Audio, + "ADSP AudioRenderer received an invalid message, msg={:02X}!", + received.msg); + break; + } + } +} + +} // 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 100755 index 000000000..eb640a159 --- /dev/null +++ b/src/audio_core/adsp/apps/audio_renderer/audio_renderer.h @@ -0,0 +1,115 @@ +// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include +#include +#include + +#include "audio_core/adsp/apps/audio_renderer/command_buffer.h" +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" +#include "audio_core/adsp/mailbox.h" +#include "common/common_types.h" +#include "common/polyfill_thread.h" +#include "common/reader_writer_queue.h" +#include "common/thread.h" + +namespace Core { +class System; +namespace Timing { +struct EventType; +} +namespace Memory { +class Memory; +} +class System; +} // namespace Core + +namespace AudioCore { +namespace Sink { +class Sink; +} + +namespace ADSP::AudioRenderer { + +enum Message : u32 { + /* 0x00 */ Invalid, + /* 0x01 */ MapUnmap_Map, + /* 0x02 */ MapUnmap_MapResponse, + /* 0x03 */ MapUnmap_Unmap, + /* 0x04 */ MapUnmap_UnmapResponse, + /* 0x05 */ MapUnmap_InvalidateCache, + /* 0x06 */ MapUnmap_InvalidateCacheResponse, + /* 0x07 */ MapUnmap_Shutdown, + /* 0x08 */ MapUnmap_ShutdownResponse, + /* 0x16 */ InitializeOK = 0x16, + /* 0x20 */ RenderResponse = 0x20, + /* 0x2A */ Render = 0x2A, + /* 0x34 */ Shutdown = 0x34, +}; + +/** + * The AudioRenderer application running on the ADSP. + */ +class AudioRenderer { +public: + explicit AudioRenderer(Core::System& system, Core::Memory::Memory& memory, Sink::Sink& sink); + ~AudioRenderer(); + + /** + * Start the AudioRenderer. + * + * @param mailbox The mailbox to use for this session. + */ + void Start(); + + /** + * Stop the AudioRenderer. + */ + void Stop(); + + void Signal(); + void Wait(); + + void Send(Direction dir, MailboxMessage message); + MailboxMessage Receive(Direction dir, bool block = true); + + void SetCommandBuffer(s32 session_id, CommandBuffer& buffer) noexcept; + u32 GetRemainCommandCount(s32 session_id) const noexcept; + void ClearRemainCommandCount(s32 session_id) noexcept; + u64 GetRenderingStartTick(s32 session_id) const noexcept; + +private: + /** + * Main AudioRenderer thread, responsible for processing the command lists. + */ + void Main(std::stop_token stop_token); + + /** + * Creates the streams which will receive the processed samples. + */ + void CreateSinkStreams(); + + /// Core system + Core::System& system; + /// Memory + Core::Memory::Memory& memory; + /// The output sink the AudioRenderer will use + Sink::Sink& sink; + /// The active mailbox + Mailbox mailbox; + /// Main thread + std::jthread main_thread{}; + /// The current state + std::atomic running{}; + std::array command_buffers{}; + /// The command lists to process + std::array command_list_processors{}; + /// The streams which will receive the processed samples + std::array streams{}; + u64 signalled_tick{0}; +}; + +} // namespace ADSP::AudioRenderer +} // 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 100755 index 000000000..4b28e6867 --- /dev/null +++ b/src/audio_core/adsp/apps/audio_renderer/command_buffer.h @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "audio_core/common/common.h" +#include "common/common_types.h" + +namespace AudioCore::ADSP::AudioRenderer { + +struct CommandBuffer { + // Set by the host + CpuAddr buffer{}; + u64 size{}; + u64 time_limit{}; + u64 applet_resource_user_id{}; + bool reset_buffer{}; + // Set by the DSP + u32 remaining_command_count{}; + u64 render_time_taken_us{}; +}; + +} // namespace AudioCore::ADSP::AudioRenderer diff --git a/src/audio_core/adsp/apps/audio_renderer/command_list_processor.cpp b/src/audio_core/adsp/apps/audio_renderer/command_list_processor.cpp new file mode 100755 index 000000000..7a46d1c1b --- /dev/null +++ b/src/audio_core/adsp/apps/audio_renderer/command_list_processor.cpp @@ -0,0 +1,108 @@ +// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include + +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" +#include "audio_core/renderer/command/command_list_header.h" +#include "audio_core/renderer/command/commands.h" +#include "common/settings.h" +#include "core/core.h" +#include "core/core_timing.h" +#include "core/memory.h" + +namespace AudioCore::ADSP::AudioRenderer { + +void CommandListProcessor::Initialize(Core::System& system_, CpuAddr buffer, u64 size, + Sink::SinkStream* stream_) { + system = &system_; + memory = &system->ApplicationMemory(); + stream = stream_; + header = reinterpret_cast(buffer); + commands = reinterpret_cast(buffer + sizeof(Renderer::CommandListHeader)); + commands_buffer_size = size; + command_count = header->command_count; + sample_count = header->sample_count; + target_sample_rate = header->sample_rate; + mix_buffers = header->samples_buffer; + buffer_count = header->buffer_count; + processed_command_count = 0; +} + +void CommandListProcessor::SetProcessTimeMax(const u64 time) { + max_process_time = time; +} + +u32 CommandListProcessor::GetRemainingCommandCount() const { + return command_count - processed_command_count; +} + +void CommandListProcessor::SetBuffer(const CpuAddr buffer, const u64 size) { + commands = reinterpret_cast(buffer + sizeof(Renderer::CommandListHeader)); + commands_buffer_size = size; +} + +Sink::SinkStream* CommandListProcessor::GetOutputSinkStream() const { + return stream; +} + +u64 CommandListProcessor::Process(u32 session_id) { + const auto start_time_{system->CoreTiming().GetGlobalTimeUs().count()}; + const auto command_base{CpuAddr(commands)}; + + if (processed_command_count > 0) { + current_processing_time += start_time_ - end_time; + } else { + start_time = start_time_; + current_processing_time = 0; + } + + std::string dump{fmt::format("\nSession {}\n", session_id)}; + + for (u32 index = 0; index < command_count; index++) { + auto& command{*reinterpret_cast(commands)}; + + if (command.magic != 0xCAFEBABE) { + LOG_ERROR(Service_Audio, "Command has invalid magic! Expected 0xCAFEBABE, got {:08X}", + command.magic); + return system->CoreTiming().GetGlobalTimeUs().count() - start_time_; + } + + auto current_offset{CpuAddr(commands) - command_base}; + + if (current_offset + command.size > commands_buffer_size) { + LOG_ERROR(Service_Audio, + "Command exceeded command buffer, buffer size {:08X}, command ends at {:08X}", + commands_buffer_size, + CpuAddr(commands) + command.size - sizeof(Renderer::CommandListHeader)); + return system->CoreTiming().GetGlobalTimeUs().count() - start_time_; + } + + if (Settings::values.dump_audio_commands) { + command.Dump(*this, dump); + } + + if (!command.Verify(*this)) { + break; + } + + if (command.enabled) { + command.Process(*this); + } else { + dump += fmt::format("\tDisabled!\n"); + } + + processed_command_count++; + commands += command.size; + } + + if (Settings::values.dump_audio_commands && dump != last_dump) { + LOG_WARNING(Service_Audio, "{}", dump); + last_dump = dump; + } + + end_time = system->CoreTiming().GetGlobalTimeUs().count(); + return end_time - start_time_; +} + +} // namespace AudioCore::ADSP::AudioRenderer diff --git a/src/audio_core/adsp/apps/audio_renderer/command_list_processor.h b/src/audio_core/adsp/apps/audio_renderer/command_list_processor.h new file mode 100755 index 000000000..5ef5b0e5d --- /dev/null +++ b/src/audio_core/adsp/apps/audio_renderer/command_list_processor.h @@ -0,0 +1,120 @@ +// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include + +#include "audio_core/common/common.h" +#include "audio_core/renderer/command/command_list_header.h" +#include "common/common_types.h" + +namespace Core { +namespace Memory { +class Memory; +} +class System; +} // namespace Core + +namespace AudioCore { +namespace Sink { +class SinkStream; +} + +namespace Renderer { +struct CommandListHeader; +} + +namespace ADSP::AudioRenderer { + +/** + * A processor for command lists given to the AudioRenderer. + */ +class CommandListProcessor { +public: + /** + * Initialize the processor. + * + * @param system - The core system. + * @param buffer - The command buffer to process. + * @param size - The size of the buffer. + * @param stream - The stream to be used for sending the samples. + */ + void Initialize(Core::System& system, CpuAddr buffer, u64 size, Sink::SinkStream* stream); + + /** + * Set the maximum processing time for this command list. + * + * @param time - The maximum process time. + */ + void SetProcessTimeMax(u64 time); + + /** + * Get the remaining command count for this list. + * + * @return The remaining command count. + */ + u32 GetRemainingCommandCount() const; + + /** + * Set the command buffer. + * + * @param buffer - The buffer to use. + * @param size - The size of the buffer. + */ + void SetBuffer(CpuAddr buffer, u64 size); + + /** + * Get the stream for this command list. + * + * @return The stream associated with this command list. + */ + Sink::SinkStream* GetOutputSinkStream() const; + + /** + * Process the command list. + * + * @param session_id - Session ID for the commands being processed. + * + * @return The time taken to process. + */ + u64 Process(u32 session_id); + + /// Core system + Core::System* system{}; + /// Core memory + Core::Memory::Memory* memory{}; + /// Stream for the processed samples + Sink::SinkStream* stream{}; + /// Header info for this command list + Renderer::CommandListHeader* header{}; + /// The command buffer + u8* commands{}; + /// The command buffer size + u64 commands_buffer_size{}; + /// The maximum processing time allotted + u64 max_process_time{}; + /// The number of commands in the buffer + u32 command_count{}; + /// The target sample count for output + u32 sample_count{}; + /// The target sample rate for output + u32 target_sample_rate{}; + /// The mixing buffers used by the commands + std::span mix_buffers{}; + /// The number of mix buffers + u32 buffer_count{}; + /// The number of processed commands so far + u32 processed_command_count{}; + /// The processing start time of this list + u64 start_time{}; + /// The current processing time for this list + u64 current_processing_time{}; + /// The end processing time for this list + u64 end_time{}; + /// Last command list string generated, used for dumping audio commands to console + std::string last_dump{}; +}; + +} // namespace ADSP::AudioRenderer +} // namespace AudioCore diff --git a/src/audio_core/adsp/mailbox.cpp b/src/audio_core/adsp/mailbox.cpp new file mode 100755 index 000000000..e69de29bb diff --git a/src/audio_core/adsp/mailbox.h b/src/audio_core/adsp/mailbox.h new file mode 100755 index 000000000..528d65f5f --- /dev/null +++ b/src/audio_core/adsp/mailbox.h @@ -0,0 +1,69 @@ +// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "common/bounded_threadsafe_queue.h" +#include "common/common_types.h" + +namespace AudioCore::ADSP { + +enum class AppMailboxId : u32 { + Invalid = 0, + AudioRenderer = 50, + AudioRendererMemoryMapUnmap = 51, +}; + +enum class Direction : u32 { + Host, + DSP, +}; + +struct MailboxMessage { + u32 msg; + std::span data; +}; + +class Mailbox { +public: + void Initialize(AppMailboxId id_) { + Reset(); + id = id_; + } + + AppMailboxId Id() const noexcept { + return id; + } + + void Send(Direction dir, MailboxMessage&& message) { + auto& queue = dir == Direction::Host ? host_queue : adsp_queue; + queue.EmplaceWait(std::move(message)); + } + + MailboxMessage Receive(Direction dir, bool block = true) { + auto& queue = dir == Direction::Host ? host_queue : adsp_queue; + MailboxMessage t; + if (block) { + queue.PopWait(t); + } else { + queue.TryPop(t); + } + return t; + } + + void Reset() { + id = AppMailboxId::Invalid; + MailboxMessage t; + while (host_queue.TryPop(t)) { + } + while (adsp_queue.TryPop(t)) { + } + } + +private: + AppMailboxId id{0}; + Common::SPSCQueue host_queue; + Common::SPSCQueue adsp_queue; +}; + +} // namespace AudioCore::ADSP diff --git a/src/audio_core/audio_core.cpp b/src/audio_core/audio_core.cpp index 756a480b3..4c19fe96a 100755 --- a/src/audio_core/audio_core.cpp +++ b/src/audio_core/audio_core.cpp @@ -11,7 +11,7 @@ namespace AudioCore { AudioCore::AudioCore(Core::System& system) : audio_manager{std::make_unique()} { CreateSinks(); // Must be created after the sinks - adsp = std::make_unique(system, *output_sink); + adsp = std::make_unique(system, *output_sink); } AudioCore ::~AudioCore() { @@ -43,7 +43,7 @@ Sink::Sink& AudioCore::GetInputSink() { return *input_sink; } -AudioRenderer::ADSP::ADSP& AudioCore::GetADSP() { +ADSP::ADSP& AudioCore::ADSP() { return *adsp; } diff --git a/src/audio_core/audio_core.h b/src/audio_core/audio_core.h index ed2c06d61..b88c0aa7b 100755 --- a/src/audio_core/audio_core.h +++ b/src/audio_core/audio_core.h @@ -5,8 +5,8 @@ #include +#include "audio_core/adsp/adsp.h" #include "audio_core/audio_manager.h" -#include "audio_core/renderer/adsp/adsp.h" #include "audio_core/sink/sink.h" namespace Core { @@ -55,7 +55,7 @@ public: * * @return Ref to the ADSP. */ - AudioRenderer::ADSP::ADSP& GetADSP(); + ADSP::ADSP& ADSP(); private: /** @@ -70,7 +70,7 @@ private: /// Sink used for audio input std::unique_ptr input_sink; /// The ADSP in the sysmodule - std::unique_ptr adsp; + std::unique_ptr adsp; }; } // namespace AudioCore diff --git a/src/audio_core/audio_in_manager.cpp b/src/audio_core/audio_in_manager.cpp index f7bcd2b27..f3f29d327 100755 --- a/src/audio_core/audio_in_manager.cpp +++ b/src/audio_core/audio_in_manager.cpp @@ -73,7 +73,7 @@ void Manager::BufferReleaseAndRegister() { } } -u32 Manager::GetDeviceNames(std::vector& names, +u32 Manager::GetDeviceNames(std::vector& names, [[maybe_unused]] const u32 max_count, [[maybe_unused]] const bool filter) { std::scoped_lock l{mutex}; diff --git a/src/audio_core/audio_in_manager.h b/src/audio_core/audio_in_manager.h index 5d83cfebf..601fa570b 100755 --- a/src/audio_core/audio_in_manager.h +++ b/src/audio_core/audio_in_manager.h @@ -65,8 +65,8 @@ public: * * @return Number of names written. */ - u32 GetDeviceNames(std::vector& names, - u32 max_count, bool filter); + u32 GetDeviceNames(std::vector& names, u32 max_count, + bool filter); /// Core system Core::System& system; diff --git a/src/audio_core/audio_out_manager.cpp b/src/audio_core/audio_out_manager.cpp index 8efc5f1c3..72851d3ac 100755 --- a/src/audio_core/audio_out_manager.cpp +++ b/src/audio_core/audio_out_manager.cpp @@ -73,7 +73,7 @@ void Manager::BufferReleaseAndRegister() { } u32 Manager::GetAudioOutDeviceNames( - std::vector& names) const { + std::vector& names) const { names.emplace_back("DeviceOut"); return 1; } diff --git a/src/audio_core/audio_out_manager.h b/src/audio_core/audio_out_manager.h index 9bf8c845a..11ba3f8cf 100755 --- a/src/audio_core/audio_out_manager.h +++ b/src/audio_core/audio_out_manager.h @@ -61,8 +61,7 @@ public: * @param names - Output container to write names to. * @return Number of names written. */ - u32 GetAudioOutDeviceNames( - std::vector& names) const; + u32 GetAudioOutDeviceNames(std::vector& names) const; /// Core system Core::System& system; diff --git a/src/audio_core/audio_render_manager.cpp b/src/audio_core/audio_render_manager.cpp index 0636d1909..7a7764ae1 100755 --- a/src/audio_core/audio_render_manager.cpp +++ b/src/audio_core/audio_render_manager.cpp @@ -6,7 +6,7 @@ #include "audio_core/common/feature_support.h" #include "core/core.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { Manager::Manager(Core::System& system_) : system{system_}, system_manager{std::make_unique(system)} { @@ -67,4 +67,4 @@ bool Manager::RemoveSystem(System& system_) { return system_manager->Remove(system_); } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/audio_render_manager.h b/src/audio_core/audio_render_manager.h index ce3c961d0..343cbba3f 100755 --- a/src/audio_core/audio_render_manager.h +++ b/src/audio_core/audio_render_manager.h @@ -20,7 +20,7 @@ class System; namespace AudioCore { struct AudioRendererParameterInternal; -namespace AudioRenderer { +namespace Renderer { /** * Wrapper for the audio system manager, handles service calls. */ @@ -101,5 +101,5 @@ private: std::unique_ptr system_manager{}; }; -} // namespace AudioRenderer +} // namespace Renderer } // namespace AudioCore diff --git a/src/audio_core/common/audio_renderer_parameter.h b/src/audio_core/common/audio_renderer_parameter.h index 14ce7678b..d0e668340 100755 --- a/src/audio_core/common/audio_renderer_parameter.h +++ b/src/audio_core/common/audio_renderer_parameter.h @@ -51,10 +51,10 @@ struct AudioRendererSystemContext { s32 session_id; s8 channels; s16 mix_buffer_count; - AudioRenderer::BehaviorInfo* behavior; + Renderer::BehaviorInfo* behavior; std::span depop_buffer; - AudioRenderer::UpsamplerManager* upsampler_manager; - AudioRenderer::MemoryPoolInfo* memory_pool_info; + Renderer::UpsamplerManager* upsampler_manager; + Renderer::MemoryPoolInfo* memory_pool_info; }; } // namespace AudioCore diff --git a/src/audio_core/renderer/audio_device.cpp b/src/audio_core/renderer/audio_device.cpp index cdf45fbfa..7b329c880 100755 --- a/src/audio_core/renderer/audio_device.cpp +++ b/src/audio_core/renderer/audio_device.cpp @@ -10,7 +10,7 @@ #include "audio_core/sink/sink.h" #include "core/core.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { constexpr std::array usb_device_names{ AudioDevice::AudioDeviceName{"AudioStereoJackOutput"}, @@ -71,4 +71,4 @@ f32 AudioDevice::GetDeviceVolume([[maybe_unused]] std::string_view name) const { return output_sink.GetDeviceVolume(); } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/audio_device.h b/src/audio_core/renderer/audio_device.h index bc7404ab8..39f0ef591 100755 --- a/src/audio_core/renderer/audio_device.h +++ b/src/audio_core/renderer/audio_device.h @@ -16,7 +16,7 @@ namespace Sink { class Sink; } -namespace AudioRenderer { +namespace Renderer { /** * An interface to an output audio device available to the Switch. */ @@ -76,5 +76,5 @@ private: const u32 user_revision; }; -} // namespace AudioRenderer +} // namespace Renderer } // namespace AudioCore diff --git a/src/audio_core/renderer/audio_renderer.cpp b/src/audio_core/renderer/audio_renderer.cpp index d2d180e1e..22f841455 100755 --- a/src/audio_core/renderer/audio_renderer.cpp +++ b/src/audio_core/renderer/audio_renderer.cpp @@ -9,7 +9,7 @@ #include "core/hle/kernel/k_transfer_memory.h" #include "core/hle/service/audio/errors.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { Renderer::Renderer(Core::System& system_, Manager& manager_, Kernel::KEvent* rendered_event) : core{system_}, manager{manager_}, system{system_, rendered_event} {} @@ -64,4 +64,4 @@ Result Renderer::RequestUpdate(std::span input, std::span performa return system.Update(input, performance, output); } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/audio_renderer.h b/src/audio_core/renderer/audio_renderer.h index 4018550b1..ccc4332db 100755 --- a/src/audio_core/renderer/audio_renderer.h +++ b/src/audio_core/renderer/audio_renderer.h @@ -19,7 +19,7 @@ class KTransferMemory; namespace AudioCore { struct AudioRendererParameterInternal; -namespace AudioRenderer { +namespace Renderer { class Manager; /** @@ -31,7 +31,7 @@ public: /** * Initialize the renderer. - * Registers the system with the AudioRenderer::Manager, allocates workbuffers and initializes + * Registers the system with the Renderer::Manager, allocates workbuffers and initializes * everything to a default state. * * @param params - Input parameters to initialize the system with. @@ -93,5 +93,5 @@ private: System system; }; -} // namespace AudioRenderer +} // namespace Renderer } // namespace AudioCore diff --git a/src/audio_core/renderer/behavior/behavior_info.cpp b/src/audio_core/renderer/behavior/behavior_info.cpp index fd1b9a8c3..5647af55f 100755 --- a/src/audio_core/renderer/behavior/behavior_info.cpp +++ b/src/audio_core/renderer/behavior/behavior_info.cpp @@ -4,7 +4,7 @@ #include "audio_core/common/feature_support.h" #include "audio_core/renderer/behavior/behavior_info.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { BehaviorInfo::BehaviorInfo() : process_revision{CurrentRevision} {} @@ -190,4 +190,4 @@ bool BehaviorInfo::IsI3dl2ReverbChannelMappingChanged() const { return CheckFeatureSupported(SupportTags::I3dl2ReverbChannelMappingChange, user_revision); } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/behavior/behavior_info.h b/src/audio_core/renderer/behavior/behavior_info.h index d2f649fa8..1890d8174 100755 --- a/src/audio_core/renderer/behavior/behavior_info.h +++ b/src/audio_core/renderer/behavior/behavior_info.h @@ -10,7 +10,7 @@ #include "common/common_types.h" #include "core/hle/service/audio/errors.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * Holds host and user revisions, checks whether render features can be enabled, and reports errors. */ @@ -264,7 +264,7 @@ public: /** * Check if skipping voice pitch and sample rate conversion is supported. * This speeds up the data source commands by skipping resampling if unwanted. - * See AudioCore::AudioRenderer::DecodeFromWaveBuffers + * See AudioCore::Renderer::DecodeFromWaveBuffers * * @return True if supported, otherwise false. */ @@ -273,7 +273,7 @@ public: /** * Check if resetting played sample count at loop points is supported. * This resets the number of samples played in a voice state when a loop point is reached. - * See AudioCore::AudioRenderer::DecodeFromWaveBuffers + * See AudioCore::Renderer::DecodeFromWaveBuffers * * @return True if supported, otherwise false. */ @@ -373,4 +373,4 @@ public: u32 error_count{}; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/behavior/info_updater.cpp b/src/audio_core/renderer/behavior/info_updater.cpp index 1cfecf69b..77268f4a5 100755 --- a/src/audio_core/renderer/behavior/info_updater.cpp +++ b/src/audio_core/renderer/behavior/info_updater.cpp @@ -15,7 +15,7 @@ #include "audio_core/renderer/splitter/splitter_context.h" #include "audio_core/renderer/voice/voice_context.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { InfoUpdater::InfoUpdater(std::span input_, std::span output_, const u32 process_handle_, BehaviorInfo& behaviour_) @@ -536,4 +536,4 @@ Result InfoUpdater::CheckConsumedSize() { return ResultSuccess; } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/behavior/info_updater.h b/src/audio_core/renderer/behavior/info_updater.h index 7d1444470..38eeb0777 100755 --- a/src/audio_core/renderer/behavior/info_updater.h +++ b/src/audio_core/renderer/behavior/info_updater.h @@ -8,7 +8,7 @@ #include "common/common_types.h" #include "core/hle/service/audio/errors.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { class BehaviorInfo; class VoiceContext; class MixContext; @@ -202,4 +202,4 @@ private: BehaviorInfo& behaviour; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/command/command_buffer.cpp b/src/audio_core/renderer/command/command_buffer.cpp index 4b87304f3..5fb5c222d 100755 --- a/src/audio_core/renderer/command/command_buffer.cpp +++ b/src/audio_core/renderer/command/command_buffer.cpp @@ -16,7 +16,7 @@ #include "audio_core/renderer/voice/voice_info.h" #include "audio_core/renderer/voice/voice_state.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { template T& CommandBuffer::GenerateStart(const s32 node_id) { @@ -713,4 +713,4 @@ void CommandBuffer::GenerateCompressorCommand(s16 buffer_offset, EffectInfoBase& GenerateEnd(cmd); } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/command/command_buffer.h b/src/audio_core/renderer/command/command_buffer.h index ab56a7d37..30786a21f 100755 --- a/src/audio_core/renderer/command/command_buffer.h +++ b/src/audio_core/renderer/command/command_buffer.h @@ -10,7 +10,7 @@ #include "audio_core/renderer/performance/performance_manager.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { struct UpsamplerInfo; struct VoiceState; class EffectInfoBase; @@ -465,4 +465,4 @@ private: void GenerateEnd(T& cmd); }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/command/command_generator.cpp b/src/audio_core/renderer/command/command_generator.cpp index 63cd3f888..d18dba40b 100755 --- a/src/audio_core/renderer/command/command_generator.cpp +++ b/src/audio_core/renderer/command/command_generator.cpp @@ -21,7 +21,7 @@ #include "audio_core/renderer/voice/voice_context.h" #include "common/alignment.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { CommandGenerator::CommandGenerator(CommandBuffer& command_buffer_, const CommandListHeader& command_list_header_, @@ -793,4 +793,4 @@ void CommandGenerator::GeneratePerformanceCommand( command_buffer.GeneratePerformanceCommand(node_id, state, entry_addresses); } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/command/command_generator.h b/src/audio_core/renderer/command/command_generator.h index e14405c95..f211d06ea 100755 --- a/src/audio_core/renderer/command/command_generator.h +++ b/src/audio_core/renderer/command/command_generator.h @@ -12,7 +12,7 @@ namespace AudioCore { struct AudioRendererSystemContext; -namespace AudioRenderer { +namespace Renderer { class CommandBuffer; struct CommandListHeader; class VoiceContext; @@ -345,5 +345,5 @@ private: PerformanceManager* performance_manager; }; -} // namespace AudioRenderer +} // namespace Renderer } // 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 63305cdac..8f2aa80d2 100755 --- a/src/audio_core/renderer/command/command_list_header.h +++ b/src/audio_core/renderer/command/command_list_header.h @@ -8,7 +8,7 @@ #include "audio_core/common/common.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { struct CommandListHeader { u64 buffer_size; @@ -19,4 +19,4 @@ struct CommandListHeader { u32 sample_rate; }; -} // namespace AudioCore::AudioRenderer +} // 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 bcaa7fd7b..060d7c2e1 100755 --- 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 @@ #include "audio_core/renderer/command/command_processing_time_estimator.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { u32 CommandProcessingTimeEstimatorVersion1::Estimate( const PcmInt16DataSourceVersion1Command& command) const { @@ -3617,4 +3617,4 @@ u32 CommandProcessingTimeEstimatorVersion5::Estimate(const CompressorCommand& co } } -} // namespace AudioCore::AudioRenderer +} // 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 fc1f00365..130487946 100755 --- 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 @@ #include "audio_core/renderer/command/commands.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * Estimate the processing time required for all commands. */ @@ -251,4 +251,4 @@ private: u32 buffer_count{}; }; -} // namespace AudioCore::AudioRenderer +} // 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 e9f8b16ba..c9f5ca922 100755 --- a/src/audio_core/renderer/command/data_source/adpcm.cpp +++ b/src/audio_core/renderer/command/data_source/adpcm.cpp @@ -3,20 +3,20 @@ #include -#include "audio_core/renderer/adsp/command_list_processor.h" +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" #include "audio_core/renderer/command/data_source/adpcm.h" #include "audio_core/renderer/command/data_source/decode.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { -void AdpcmDataSourceVersion1Command::Dump(const ADSP::CommandListProcessor& processor, +void AdpcmDataSourceVersion1Command::Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) { string += fmt::format("AdpcmDataSourceVersion1Command\n\toutput_index {:02X} source sample " "rate {} target sample rate {} src quality {}\n", output_index, sample_rate, processor.target_sample_rate, src_quality); } -void AdpcmDataSourceVersion1Command::Process(const ADSP::CommandListProcessor& processor) { +void AdpcmDataSourceVersion1Command::Process(const AudioRenderer::CommandListProcessor& processor) { auto out_buffer{processor.mix_buffers.subspan(output_index * processor.sample_count, processor.sample_count)}; @@ -41,18 +41,18 @@ void AdpcmDataSourceVersion1Command::Process(const ADSP::CommandListProcessor& p DecodeFromWaveBuffers(*processor.memory, args); } -bool AdpcmDataSourceVersion1Command::Verify(const ADSP::CommandListProcessor& processor) { +bool AdpcmDataSourceVersion1Command::Verify(const AudioRenderer::CommandListProcessor& processor) { return true; } -void AdpcmDataSourceVersion2Command::Dump(const ADSP::CommandListProcessor& processor, +void AdpcmDataSourceVersion2Command::Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) { string += fmt::format("AdpcmDataSourceVersion2Command\n\toutput_index {:02X} source sample " "rate {} target sample rate {} src quality {}\n", output_index, sample_rate, processor.target_sample_rate, src_quality); } -void AdpcmDataSourceVersion2Command::Process(const ADSP::CommandListProcessor& processor) { +void AdpcmDataSourceVersion2Command::Process(const AudioRenderer::CommandListProcessor& processor) { auto out_buffer{processor.mix_buffers.subspan(output_index * processor.sample_count, processor.sample_count)}; @@ -77,8 +77,8 @@ void AdpcmDataSourceVersion2Command::Process(const ADSP::CommandListProcessor& p DecodeFromWaveBuffers(*processor.memory, args); } -bool AdpcmDataSourceVersion2Command::Verify(const ADSP::CommandListProcessor& processor) { +bool AdpcmDataSourceVersion2Command::Verify(const AudioRenderer::CommandListProcessor& processor) { return true; } -} // namespace AudioCore::AudioRenderer +} // 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 65a2c1e0a..7bbea7289 100755 --- a/src/audio_core/renderer/command/data_source/adpcm.h +++ b/src/audio_core/renderer/command/data_source/adpcm.h @@ -11,11 +11,12 @@ #include "audio_core/renderer/command/icommand.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP::AudioRenderer { class CommandListProcessor; } +namespace AudioCore::Renderer { + /** * AudioRenderer command to decode ADPCM-encoded version 1 wavebuffers * into the output_index mix buffer. @@ -27,14 +28,14 @@ struct AdpcmDataSourceVersion1Command : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -42,13 +43,13 @@ struct AdpcmDataSourceVersion1Command : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Quality used for sample rate conversion SrcQuality src_quality; /// Mix buffer index for decoded samples s16 output_index; - /// Flags to control decoding (see AudioCore::AudioRenderer::VoiceInfo::Flags) + /// Flags to control decoding (see AudioCore::Renderer::VoiceInfo::Flags) u16 flags; /// Wavebuffer sample rate u32 sample_rate; @@ -75,14 +76,14 @@ struct AdpcmDataSourceVersion2Command : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -90,13 +91,13 @@ struct AdpcmDataSourceVersion2Command : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Quality used for sample rate conversion SrcQuality src_quality; /// Mix buffer index for decoded samples s16 output_index; - /// Flags to control decoding (see AudioCore::AudioRenderer::VoiceInfo::Flags) + /// Flags to control decoding (see AudioCore::Renderer::VoiceInfo::Flags) u16 flags; /// Wavebuffer sample rate u32 sample_rate; @@ -116,4 +117,4 @@ struct AdpcmDataSourceVersion2Command : ICommand { u64 data_size; }; -} // namespace AudioCore::AudioRenderer +} // 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 fd35571ac..d292288d1 100755 --- a/src/audio_core/renderer/command/data_source/decode.cpp +++ b/src/audio_core/renderer/command/data_source/decode.cpp @@ -11,7 +11,7 @@ #include "common/scratch_buffer.h" #include "core/memory.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { constexpr u32 TempBufferSize = 0x3F00; constexpr std::array PitchBySrcQuality = {4, 8, 4}; @@ -364,7 +364,7 @@ void DecodeFromWaveBuffers(Core::Memory::Memory& memory, const DecodeFromWaveBuf wavebuffers_consumed++; } else { voice_state.loop_count++; - if (wavebuffer.loop_count > 0 && + if (wavebuffer.loop_count >= 0 && (voice_state.loop_count > wavebuffer.loop_count || samples_decoded == 0)) { voice_state.wave_buffer_valid[wavebuffer_index] = false; voice_state.loop_count = 0; @@ -423,4 +423,4 @@ void DecodeFromWaveBuffers(Core::Memory::Memory& memory, const DecodeFromWaveBuf voice_state.fraction = fraction; } -} // namespace AudioCore::AudioRenderer +} // 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 07ad8aadc..0bd784c95 100755 --- 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 { class Memory; } -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { struct DecodeFromWaveBuffersArgs { SampleFormat sample_format; @@ -56,4 +56,4 @@ struct DecodeArg { */ void DecodeFromWaveBuffers(Core::Memory::Memory& memory, const DecodeFromWaveBuffersArgs& args); -} // namespace AudioCore::AudioRenderer +} // 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 ef09adc42..36aeedde1 100755 --- 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 @@ // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "audio_core/renderer/adsp/command_list_processor.h" +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" #include "audio_core/renderer/command/data_source/decode.h" #include "audio_core/renderer/command/data_source/pcm_float.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { -void PcmFloatDataSourceVersion1Command::Dump(const ADSP::CommandListProcessor& processor, +void PcmFloatDataSourceVersion1Command::Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) { string += fmt::format("PcmFloatDataSourceVersion1Command\n\toutput_index {:02X} channel {} " @@ -16,7 +16,8 @@ void PcmFloatDataSourceVersion1Command::Dump(const ADSP::CommandListProcessor& p processor.target_sample_rate, src_quality); } -void PcmFloatDataSourceVersion1Command::Process(const ADSP::CommandListProcessor& processor) { +void PcmFloatDataSourceVersion1Command::Process( + const AudioRenderer::CommandListProcessor& processor) { auto out_buffer = processor.mix_buffers.subspan(output_index * processor.sample_count, processor.sample_count); @@ -41,11 +42,12 @@ void PcmFloatDataSourceVersion1Command::Process(const ADSP::CommandListProcessor DecodeFromWaveBuffers(*processor.memory, args); } -bool PcmFloatDataSourceVersion1Command::Verify(const ADSP::CommandListProcessor& processor) { +bool PcmFloatDataSourceVersion1Command::Verify( + const AudioRenderer::CommandListProcessor& processor) { return true; } -void PcmFloatDataSourceVersion2Command::Dump(const ADSP::CommandListProcessor& processor, +void PcmFloatDataSourceVersion2Command::Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) { string += fmt::format("PcmFloatDataSourceVersion2Command\n\toutput_index {:02X} channel {} " @@ -54,7 +56,8 @@ void PcmFloatDataSourceVersion2Command::Dump(const ADSP::CommandListProcessor& p processor.target_sample_rate, src_quality); } -void PcmFloatDataSourceVersion2Command::Process(const ADSP::CommandListProcessor& processor) { +void PcmFloatDataSourceVersion2Command::Process( + const AudioRenderer::CommandListProcessor& processor) { auto out_buffer = processor.mix_buffers.subspan(output_index * processor.sample_count, processor.sample_count); @@ -79,8 +82,9 @@ void PcmFloatDataSourceVersion2Command::Process(const ADSP::CommandListProcessor DecodeFromWaveBuffers(*processor.memory, args); } -bool PcmFloatDataSourceVersion2Command::Verify(const ADSP::CommandListProcessor& processor) { +bool PcmFloatDataSourceVersion2Command::Verify( + const AudioRenderer::CommandListProcessor& processor) { return true; } -} // namespace AudioCore::AudioRenderer +} // 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 8bba0b014..36bc061c5 100755 --- 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 @@ #include "audio_core/renderer/command/icommand.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP::AudioRenderer { class CommandListProcessor; } +namespace AudioCore::Renderer { + /** * AudioRenderer command to decode PCM float-encoded version 1 wavebuffers * into the output_index mix buffer. @@ -25,14 +26,14 @@ struct PcmFloatDataSourceVersion1Command : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -40,13 +41,13 @@ struct PcmFloatDataSourceVersion1Command : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Quality used for sample rate conversion SrcQuality src_quality; /// Mix buffer index for decoded samples s16 output_index; - /// Flags to control decoding (see AudioCore::AudioRenderer::VoiceInfo::Flags) + /// Flags to control decoding (see AudioCore::Renderer::VoiceInfo::Flags) u16 flags; /// Wavebuffer sample rate u32 sample_rate; @@ -73,14 +74,14 @@ struct PcmFloatDataSourceVersion2Command : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -88,13 +89,13 @@ struct PcmFloatDataSourceVersion2Command : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Quality used for sample rate conversion SrcQuality src_quality; /// Mix buffer index for decoded samples s16 output_index; - /// Flags to control decoding (see AudioCore::AudioRenderer::VoiceInfo::Flags) + /// Flags to control decoding (see AudioCore::Renderer::VoiceInfo::Flags) u16 flags; /// Wavebuffer sample rate u32 sample_rate; @@ -110,4 +111,4 @@ struct PcmFloatDataSourceVersion2Command : ICommand { CpuAddr voice_state; }; -} // namespace AudioCore::AudioRenderer +} // 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 4edede2fd..329b8e434 100755 --- 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 @@ #include -#include "audio_core/renderer/adsp/command_list_processor.h" +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" #include "audio_core/renderer/command/data_source/decode.h" #include "audio_core/renderer/command/data_source/pcm_int16.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { -void PcmInt16DataSourceVersion1Command::Dump(const ADSP::CommandListProcessor& processor, +void PcmInt16DataSourceVersion1Command::Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) { string += fmt::format("PcmInt16DataSourceVersion1Command\n\toutput_index {:02X} channel {} " @@ -18,7 +18,8 @@ void PcmInt16DataSourceVersion1Command::Dump(const ADSP::CommandListProcessor& p processor.target_sample_rate, src_quality); } -void PcmInt16DataSourceVersion1Command::Process(const ADSP::CommandListProcessor& processor) { +void PcmInt16DataSourceVersion1Command::Process( + const AudioRenderer::CommandListProcessor& processor) { auto out_buffer = processor.mix_buffers.subspan(output_index * processor.sample_count, processor.sample_count); @@ -43,11 +44,12 @@ void PcmInt16DataSourceVersion1Command::Process(const ADSP::CommandListProcessor DecodeFromWaveBuffers(*processor.memory, args); } -bool PcmInt16DataSourceVersion1Command::Verify(const ADSP::CommandListProcessor& processor) { +bool PcmInt16DataSourceVersion1Command::Verify( + const AudioRenderer::CommandListProcessor& processor) { return true; } -void PcmInt16DataSourceVersion2Command::Dump(const ADSP::CommandListProcessor& processor, +void PcmInt16DataSourceVersion2Command::Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) { string += fmt::format("PcmInt16DataSourceVersion2Command\n\toutput_index {:02X} channel {} " @@ -56,7 +58,8 @@ void PcmInt16DataSourceVersion2Command::Dump(const ADSP::CommandListProcessor& p processor.target_sample_rate, src_quality); } -void PcmInt16DataSourceVersion2Command::Process(const ADSP::CommandListProcessor& processor) { +void PcmInt16DataSourceVersion2Command::Process( + const AudioRenderer::CommandListProcessor& processor) { auto out_buffer = processor.mix_buffers.subspan(output_index * processor.sample_count, processor.sample_count); DecodeFromWaveBuffersArgs args{ @@ -80,8 +83,9 @@ void PcmInt16DataSourceVersion2Command::Process(const ADSP::CommandListProcessor DecodeFromWaveBuffers(*processor.memory, args); } -bool PcmInt16DataSourceVersion2Command::Verify(const ADSP::CommandListProcessor& processor) { +bool PcmInt16DataSourceVersion2Command::Verify( + const AudioRenderer::CommandListProcessor& processor) { return true; } -} // namespace AudioCore::AudioRenderer +} // 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 ebdccc046..10e57b09c 100755 --- 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 @@ #include "audio_core/renderer/command/icommand.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP::AudioRenderer { class CommandListProcessor; } +namespace AudioCore::Renderer { + /** * AudioRenderer command to decode PCM s16-encoded version 1 wavebuffers * into the output_index mix buffer. @@ -25,14 +26,14 @@ struct PcmInt16DataSourceVersion1Command : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -40,13 +41,13 @@ struct PcmInt16DataSourceVersion1Command : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Quality used for sample rate conversion SrcQuality src_quality; /// Mix buffer index for decoded samples s16 output_index; - /// Flags to control decoding (see AudioCore::AudioRenderer::VoiceInfo::Flags) + /// Flags to control decoding (see AudioCore::Renderer::VoiceInfo::Flags) u16 flags; /// Wavebuffer sample rate u32 sample_rate; @@ -72,26 +73,26 @@ struct PcmInt16DataSourceVersion2Command : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Quality used for sample rate conversion SrcQuality src_quality; /// Mix buffer index for decoded samples s16 output_index; - /// Flags to control decoding (see AudioCore::AudioRenderer::VoiceInfo::Flags) + /// Flags to control decoding (see AudioCore::Renderer::VoiceInfo::Flags) u16 flags; /// Wavebuffer sample rate u32 sample_rate; @@ -107,4 +108,4 @@ struct PcmInt16DataSourceVersion2Command : ICommand { CpuAddr voice_state; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/command/effect/aux_.cpp b/src/audio_core/renderer/command/effect/aux_.cpp index 03f1c6b42..57bcd6505 100755 --- a/src/audio_core/renderer/command/effect/aux_.cpp +++ b/src/audio_core/renderer/command/effect/aux_.cpp @@ -1,13 +1,13 @@ // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "audio_core/renderer/adsp/command_list_processor.h" +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" #include "audio_core/renderer/command/effect/aux_.h" #include "audio_core/renderer/effect/aux_.h" #include "core/core.h" #include "core/memory.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * Reset an AuxBuffer. * @@ -175,13 +175,13 @@ static u32 ReadAuxBufferDsp(Core::Memory::Memory& memory, CpuAddr return_info_, return read_count_; } -void AuxCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, +void AuxCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { string += fmt::format("AuxCommand\n\tenabled {} input {:02X} output {:02X}\n", effect_enabled, input, output); } -void AuxCommand::Process(const ADSP::CommandListProcessor& processor) { +void AuxCommand::Process(const AudioRenderer::CommandListProcessor& processor) { auto input_buffer{ processor.mix_buffers.subspan(input * processor.sample_count, processor.sample_count)}; auto output_buffer{ @@ -208,8 +208,8 @@ void AuxCommand::Process(const ADSP::CommandListProcessor& processor) { } } -bool AuxCommand::Verify(const ADSP::CommandListProcessor& processor) { +bool AuxCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { return true; } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/command/effect/aux_.h b/src/audio_core/renderer/command/effect/aux_.h index 5fe6dbbbe..302339a56 100755 --- a/src/audio_core/renderer/command/effect/aux_.h +++ b/src/audio_core/renderer/command/effect/aux_.h @@ -8,11 +8,12 @@ #include "audio_core/renderer/command/icommand.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP::AudioRenderer { class CommandListProcessor; } +namespace AudioCore::Renderer { + /** * AudioRenderer command to read and write an auxiliary buffer, writing the input mix buffer to game * memory, and reading into the output buffer from game memory. @@ -24,14 +25,14 @@ struct AuxCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -39,7 +40,7 @@ struct AuxCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Input mix buffer index s16 input; @@ -63,4 +64,4 @@ struct AuxCommand : ICommand { bool effect_enabled; }; -} // namespace AudioCore::AudioRenderer +} // 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 7c32fc390..f75bad040 100755 --- a/src/audio_core/renderer/command/effect/biquad_filter.cpp +++ b/src/audio_core/renderer/command/effect/biquad_filter.cpp @@ -1,12 +1,12 @@ // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "audio_core/renderer/adsp/command_list_processor.h" +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" #include "audio_core/renderer/command/effect/biquad_filter.h" #include "audio_core/renderer/voice/voice_state.h" #include "common/bit_cast.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * Biquad filter float implementation. * @@ -76,14 +76,14 @@ static void ApplyBiquadFilterInt(std::span output, std::span inp } } -void BiquadFilterCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, - std::string& string) { +void BiquadFilterCommand::Dump( + [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { string += fmt::format( "BiquadFilterCommand\n\tinput {:02X} output {:02X} needs_init {} use_float_processing {}\n", input, output, needs_init, use_float_processing); } -void BiquadFilterCommand::Process(const ADSP::CommandListProcessor& processor) { +void BiquadFilterCommand::Process(const AudioRenderer::CommandListProcessor& processor) { auto state_{reinterpret_cast(state)}; if (needs_init) { *state_ = {}; @@ -103,8 +103,8 @@ void BiquadFilterCommand::Process(const ADSP::CommandListProcessor& processor) { } } -bool BiquadFilterCommand::Verify(const ADSP::CommandListProcessor& processor) { +bool BiquadFilterCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { return true; } -} // namespace AudioCore::AudioRenderer +} // 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 e8f5fde8c..fff3be991 100755 --- a/src/audio_core/renderer/command/effect/biquad_filter.h +++ b/src/audio_core/renderer/command/effect/biquad_filter.h @@ -10,11 +10,12 @@ #include "audio_core/renderer/voice/voice_state.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP::AudioRenderer { class CommandListProcessor; } +namespace AudioCore::Renderer { + /** * AudioRenderer command for applying a biquad filter to the input mix buffer, saving the results to * the output mix buffer. @@ -26,14 +27,14 @@ struct BiquadFilterCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -41,7 +42,7 @@ struct BiquadFilterCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Input mix buffer index s16 input; @@ -71,4 +72,4 @@ void ApplyBiquadFilterFloat(std::span output, std::span input, std::array& b, std::array& a, VoiceState::BiquadFilterState& state, const u32 sample_count); -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/command/effect/capture.cpp b/src/audio_core/renderer/command/effect/capture.cpp index 9912dedee..f28b0ba51 100755 --- a/src/audio_core/renderer/command/effect/capture.cpp +++ b/src/audio_core/renderer/command/effect/capture.cpp @@ -1,12 +1,12 @@ // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "audio_core/renderer/adsp/command_list_processor.h" +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" #include "audio_core/renderer/command/effect/capture.h" #include "audio_core/renderer/effect/aux_.h" #include "core/memory.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * Reset an AuxBuffer. * @@ -118,13 +118,13 @@ static u32 WriteAuxBufferDsp(Core::Memory::Memory& memory, const CpuAddr send_in return write_count_; } -void CaptureCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, +void CaptureCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { string += fmt::format("CaptureCommand\n\tenabled {} input {:02X} output {:02X}", effect_enabled, input, output); } -void CaptureCommand::Process(const ADSP::CommandListProcessor& processor) { +void CaptureCommand::Process(const AudioRenderer::CommandListProcessor& processor) { if (effect_enabled) { auto input_buffer{ processor.mix_buffers.subspan(input * processor.sample_count, processor.sample_count)}; @@ -135,8 +135,8 @@ void CaptureCommand::Process(const ADSP::CommandListProcessor& processor) { } } -bool CaptureCommand::Verify(const ADSP::CommandListProcessor& processor) { +bool CaptureCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { return true; } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/command/effect/capture.h b/src/audio_core/renderer/command/effect/capture.h index 56d70e434..cf7024cc0 100755 --- a/src/audio_core/renderer/command/effect/capture.h +++ b/src/audio_core/renderer/command/effect/capture.h @@ -8,11 +8,12 @@ #include "audio_core/renderer/command/icommand.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP::AudioRenderer { class CommandListProcessor; } +namespace AudioCore::Renderer { + /** * AudioRenderer command for capturing a mix buffer. That is, writing it back to a given game memory * address. @@ -24,14 +25,14 @@ struct CaptureCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -39,7 +40,7 @@ struct CaptureCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Input mix buffer index s16 input; @@ -59,4 +60,4 @@ struct CaptureCommand : ICommand { bool effect_enabled; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/command/effect/compressor.cpp b/src/audio_core/renderer/command/effect/compressor.cpp index 49d3287c9..6d6ac5cdd 100755 --- a/src/audio_core/renderer/command/effect/compressor.cpp +++ b/src/audio_core/renderer/command/effect/compressor.cpp @@ -5,11 +5,11 @@ #include #include -#include "audio_core/renderer/adsp/command_list_processor.h" +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" #include "audio_core/renderer/command/effect/compressor.h" #include "audio_core/renderer/effect/compressor.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { static void SetCompressorEffectParameter(const CompressorInfo::ParameterVersion2& params, CompressorInfo::State& state) { @@ -110,7 +110,7 @@ static void ApplyCompressorEffect(const CompressorInfo::ParameterVersion2& param } } -void CompressorCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, +void CompressorCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { string += fmt::format("CompressorCommand\n\tenabled {} \n\tinputs: ", effect_enabled); for (s16 i = 0; i < parameter.channel_count; i++) { @@ -123,7 +123,7 @@ void CompressorCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& string += "\n"; } -void CompressorCommand::Process(const ADSP::CommandListProcessor& processor) { +void CompressorCommand::Process(const AudioRenderer::CommandListProcessor& processor) { std::array, MaxChannels> input_buffers{}; std::array, MaxChannels> output_buffers{}; @@ -148,8 +148,8 @@ void CompressorCommand::Process(const ADSP::CommandListProcessor& processor) { processor.sample_count); } -bool CompressorCommand::Verify(const ADSP::CommandListProcessor& processor) { +bool CompressorCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { return true; } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/command/effect/compressor.h b/src/audio_core/renderer/command/effect/compressor.h index 36942b4ec..525aac54e 100755 --- a/src/audio_core/renderer/command/effect/compressor.h +++ b/src/audio_core/renderer/command/effect/compressor.h @@ -10,11 +10,12 @@ #include "audio_core/renderer/effect/compressor.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP::AudioRenderer { class CommandListProcessor; } +namespace AudioCore::Renderer { + /** * AudioRenderer command for limiting volume between a high and low threshold. * Version 1. @@ -26,14 +27,14 @@ struct CompressorCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -41,7 +42,7 @@ struct CompressorCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Input mix buffer offsets for each channel std::array inputs; @@ -57,4 +58,4 @@ struct CompressorCommand : ICommand { bool effect_enabled; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/command/effect/delay.cpp b/src/audio_core/renderer/command/effect/delay.cpp index 81859b958..40134ac1d 100755 --- a/src/audio_core/renderer/command/effect/delay.cpp +++ b/src/audio_core/renderer/command/effect/delay.cpp @@ -1,10 +1,10 @@ // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "audio_core/renderer/adsp/command_list_processor.h" +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" #include "audio_core/renderer/command/effect/delay.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * Update the DelayInfo state according to the given parameters. * @@ -194,7 +194,7 @@ static void ApplyDelayEffect(const DelayInfo::ParameterVersion1& params, DelayIn } } -void DelayCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, +void DelayCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { string += fmt::format("DelayCommand\n\tenabled {} \n\tinputs: ", effect_enabled); for (u32 i = 0; i < MaxChannels; i++) { @@ -207,7 +207,7 @@ void DelayCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& proce string += "\n"; } -void DelayCommand::Process(const ADSP::CommandListProcessor& processor) { +void DelayCommand::Process(const AudioRenderer::CommandListProcessor& processor) { std::array, MaxChannels> input_buffers{}; std::array, MaxChannels> output_buffers{}; @@ -231,8 +231,8 @@ void DelayCommand::Process(const ADSP::CommandListProcessor& processor) { processor.sample_count); } -bool DelayCommand::Verify(const ADSP::CommandListProcessor& processor) { +bool DelayCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { return true; } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/command/effect/delay.h b/src/audio_core/renderer/command/effect/delay.h index 30c5f8b86..b7dfcae1f 100755 --- a/src/audio_core/renderer/command/effect/delay.h +++ b/src/audio_core/renderer/command/effect/delay.h @@ -10,11 +10,12 @@ #include "audio_core/renderer/effect/delay.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP::AudioRenderer { class CommandListProcessor; } +namespace AudioCore::Renderer { + /** * AudioRenderer command for a delay effect. Delays inputs mix buffers according to the parameters * and state, outputs receives the delayed samples. @@ -26,14 +27,14 @@ struct DelayCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -41,7 +42,7 @@ struct DelayCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Input mix buffer offsets for each channel std::array inputs; @@ -57,4 +58,4 @@ struct DelayCommand : ICommand { bool effect_enabled; }; -} // namespace AudioCore::AudioRenderer +} // 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 580a4f563..c2ce7e3c2 100755 --- a/src/audio_core/renderer/command/effect/i3dl2_reverb.cpp +++ b/src/audio_core/renderer/command/effect/i3dl2_reverb.cpp @@ -3,11 +3,11 @@ #include -#include "audio_core/renderer/adsp/command_list_processor.h" +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" #include "audio_core/renderer/command/effect/i3dl2_reverb.h" #include "common/polyfill_ranges.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { constexpr std::array MinDelayLineTimes{ 5.0f, @@ -394,7 +394,7 @@ static void ApplyI3dl2ReverbEffect(const I3dl2ReverbInfo::ParameterVersion1& par } } -void I3dl2ReverbCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, +void I3dl2ReverbCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { string += fmt::format("I3dl2ReverbCommand\n\tenabled {} \n\tinputs: ", effect_enabled); for (u32 i = 0; i < parameter.channel_count; i++) { @@ -407,7 +407,7 @@ void I3dl2ReverbCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& string += "\n"; } -void I3dl2ReverbCommand::Process(const ADSP::CommandListProcessor& processor) { +void I3dl2ReverbCommand::Process(const AudioRenderer::CommandListProcessor& processor) { std::array, MaxChannels> input_buffers{}; std::array, MaxChannels> output_buffers{}; @@ -431,8 +431,8 @@ void I3dl2ReverbCommand::Process(const ADSP::CommandListProcessor& processor) { processor.sample_count); } -bool I3dl2ReverbCommand::Verify(const ADSP::CommandListProcessor& processor) { +bool I3dl2ReverbCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { return true; } -} // namespace AudioCore::AudioRenderer +} // 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 32288ec63..c3a0a5b11 100755 --- a/src/audio_core/renderer/command/effect/i3dl2_reverb.h +++ b/src/audio_core/renderer/command/effect/i3dl2_reverb.h @@ -10,11 +10,12 @@ #include "audio_core/renderer/effect/i3dl2.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP::AudioRenderer { class CommandListProcessor; } +namespace AudioCore::Renderer { + /** * AudioRenderer command for a I3DL2Reverb effect. Apply a reverb to inputs mix buffer according to * the I3DL2 spec, outputs receives the results. @@ -26,14 +27,14 @@ struct I3dl2ReverbCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -41,7 +42,7 @@ struct I3dl2ReverbCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Input mix buffer offsets for each channel std::array inputs; @@ -57,4 +58,4 @@ struct I3dl2ReverbCommand : ICommand { bool effect_enabled; }; -} // namespace AudioCore::AudioRenderer +} // 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 16b08fc5d..1d91785ec 100755 --- a/src/audio_core/renderer/command/effect/light_limiter.cpp +++ b/src/audio_core/renderer/command/effect/light_limiter.cpp @@ -1,10 +1,10 @@ // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "audio_core/renderer/adsp/command_list_processor.h" +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" #include "audio_core/renderer/command/effect/light_limiter.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * Update the LightLimiterInfo state according to the given parameters. * A no-op. @@ -133,8 +133,8 @@ static void ApplyLightLimiterEffect(const LightLimiterInfo::ParameterVersion2& p } } -void LightLimiterVersion1Command::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, - std::string& string) { +void LightLimiterVersion1Command::Dump( + [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { string += fmt::format("LightLimiterVersion1Command\n\tinputs: "); for (u32 i = 0; i < MaxChannels; i++) { string += fmt::format("{:02X}, ", inputs[i]); @@ -146,7 +146,7 @@ void LightLimiterVersion1Command::Dump([[maybe_unused]] const ADSP::CommandListP string += "\n"; } -void LightLimiterVersion1Command::Process(const ADSP::CommandListProcessor& processor) { +void LightLimiterVersion1Command::Process(const AudioRenderer::CommandListProcessor& processor) { std::array, MaxChannels> input_buffers{}; std::array, MaxChannels> output_buffers{}; @@ -172,12 +172,12 @@ void LightLimiterVersion1Command::Process(const ADSP::CommandListProcessor& proc processor.sample_count, statistics); } -bool LightLimiterVersion1Command::Verify(const ADSP::CommandListProcessor& processor) { +bool LightLimiterVersion1Command::Verify(const AudioRenderer::CommandListProcessor& processor) { return true; } -void LightLimiterVersion2Command::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, - std::string& string) { +void LightLimiterVersion2Command::Dump( + [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { string += fmt::format("LightLimiterVersion2Command\n\tinputs: \n"); for (u32 i = 0; i < MaxChannels; i++) { string += fmt::format("{:02X}, ", inputs[i]); @@ -189,7 +189,7 @@ void LightLimiterVersion2Command::Dump([[maybe_unused]] const ADSP::CommandListP string += "\n"; } -void LightLimiterVersion2Command::Process(const ADSP::CommandListProcessor& processor) { +void LightLimiterVersion2Command::Process(const AudioRenderer::CommandListProcessor& processor) { std::array, MaxChannels> input_buffers{}; std::array, MaxChannels> output_buffers{}; @@ -215,8 +215,8 @@ void LightLimiterVersion2Command::Process(const ADSP::CommandListProcessor& proc processor.sample_count, statistics); } -bool LightLimiterVersion2Command::Verify(const ADSP::CommandListProcessor& processor) { +bool LightLimiterVersion2Command::Verify(const AudioRenderer::CommandListProcessor& processor) { return true; } -} // namespace AudioCore::AudioRenderer +} // 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 027d262c5..95d62bbd5 100755 --- a/src/audio_core/renderer/command/effect/light_limiter.h +++ b/src/audio_core/renderer/command/effect/light_limiter.h @@ -10,11 +10,12 @@ #include "audio_core/renderer/effect/light_limiter.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP::AudioRenderer { class CommandListProcessor; } +namespace AudioCore::Renderer { + /** * AudioRenderer command for limiting volume between a high and low threshold. * Version 1. @@ -26,14 +27,14 @@ struct LightLimiterVersion1Command : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -41,7 +42,7 @@ struct LightLimiterVersion1Command : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Input mix buffer offsets for each channel std::array inputs; @@ -68,21 +69,21 @@ struct LightLimiterVersion2Command : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. * * @param processor - The CommandListProcessor processing this command. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Input mix buffer offsets for each channel std::array inputs; @@ -100,4 +101,4 @@ struct LightLimiterVersion2Command : ICommand { bool effect_enabled; }; -} // namespace AudioCore::AudioRenderer +} // 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 22c7e2840..4c434fcd5 100755 --- 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 @@ // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "audio_core/renderer/adsp/command_list_processor.h" +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" #include "audio_core/renderer/command/effect/biquad_filter.h" #include "audio_core/renderer/command/effect/multi_tap_biquad_filter.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { -void MultiTapBiquadFilterCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, - std::string& string) { +void MultiTapBiquadFilterCommand::Dump( + [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { string += fmt::format( "MultiTapBiquadFilterCommand\n\tinput {:02X}\n\toutput {:02X}\n\tneeds_init ({}, {})\n", input, output, needs_init[0], needs_init[1]); } -void MultiTapBiquadFilterCommand::Process(const ADSP::CommandListProcessor& processor) { +void MultiTapBiquadFilterCommand::Process(const AudioRenderer::CommandListProcessor& processor) { if (filter_tap_count > MaxBiquadFilters) { LOG_ERROR(Service_Audio, "Too many filter taps! {}", filter_tap_count); filter_tap_count = MaxBiquadFilters; @@ -38,8 +38,8 @@ void MultiTapBiquadFilterCommand::Process(const ADSP::CommandListProcessor& proc } } -bool MultiTapBiquadFilterCommand::Verify(const ADSP::CommandListProcessor& processor) { +bool MultiTapBiquadFilterCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { return true; } -} // namespace AudioCore::AudioRenderer +} // 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 f42a2b415..371d43e2d 100755 --- 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 @@ #include "audio_core/renderer/voice/voice_info.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP::AudioRenderer { class CommandListProcessor; } +namespace AudioCore::Renderer { + /** * AudioRenderer command for applying multiple biquads at once. */ @@ -25,14 +26,14 @@ struct MultiTapBiquadFilterCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -40,7 +41,7 @@ struct MultiTapBiquadFilterCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Input mix buffer index s16 input; @@ -56,4 +57,4 @@ struct MultiTapBiquadFilterCommand : ICommand { u8 filter_tap_count; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/command/effect/reverb.cpp b/src/audio_core/renderer/command/effect/reverb.cpp index 01b82f1d1..f85f38ebc 100755 --- a/src/audio_core/renderer/command/effect/reverb.cpp +++ b/src/audio_core/renderer/command/effect/reverb.cpp @@ -4,11 +4,11 @@ #include #include -#include "audio_core/renderer/adsp/command_list_processor.h" +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" #include "audio_core/renderer/command/effect/reverb.h" #include "common/polyfill_ranges.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { constexpr std::array FdnMaxDelayLineTimes = { 53.9532470703125f, @@ -396,7 +396,7 @@ static void ApplyReverbEffect(const ReverbInfo::ParameterVersion2& params, Rever } } -void ReverbCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, +void ReverbCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { string += fmt::format( "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 string += "\n"; } -void ReverbCommand::Process(const ADSP::CommandListProcessor& processor) { +void ReverbCommand::Process(const AudioRenderer::CommandListProcessor& processor) { std::array, MaxChannels> input_buffers{}; std::array, MaxChannels> output_buffers{}; @@ -435,8 +435,8 @@ void ReverbCommand::Process(const ADSP::CommandListProcessor& processor) { processor.sample_count); } -bool ReverbCommand::Verify(const ADSP::CommandListProcessor& processor) { +bool ReverbCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { return true; } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/command/effect/reverb.h b/src/audio_core/renderer/command/effect/reverb.h index 75a33cf00..1c9f16a71 100755 --- a/src/audio_core/renderer/command/effect/reverb.h +++ b/src/audio_core/renderer/command/effect/reverb.h @@ -10,11 +10,12 @@ #include "audio_core/renderer/effect/reverb.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP::AudioRenderer { class CommandListProcessor; } +namespace AudioCore::Renderer { + /** * AudioRenderer command for a Reverb effect. Apply a reverb to inputs mix buffer, outputs receives * the results. @@ -26,14 +27,14 @@ struct ReverbCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -41,7 +42,7 @@ struct ReverbCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Input mix buffer offsets for each channel std::array inputs; @@ -59,4 +60,4 @@ struct ReverbCommand : ICommand { bool long_size_pre_delay_supported; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/command/icommand.h b/src/audio_core/renderer/command/icommand.h index d60d5c72c..7c79ed3f7 100755 --- a/src/audio_core/renderer/command/icommand.h +++ b/src/audio_core/renderer/command/icommand.h @@ -3,14 +3,18 @@ #pragma once +#include + #include "audio_core/common/common.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP::AudioRenderer { class CommandListProcessor; } +namespace AudioCore::Renderer { +using namespace ::AudioCore::ADSP; + enum class CommandId : u8 { /* 0x00 */ Invalid, /* 0x01 */ DataSourcePcmInt16Version1, @@ -59,14 +63,15 @@ struct ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - virtual void Dump(const ADSP::CommandListProcessor& processor, std::string& string) = 0; + virtual void Dump(const AudioRenderer::CommandListProcessor& processor, + std::string& string) = 0; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - virtual void Process(const ADSP::CommandListProcessor& processor) = 0; + virtual void Process(const AudioRenderer::CommandListProcessor& processor) = 0; /** * Verify this command's data is valid. @@ -74,7 +79,7 @@ struct ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - virtual bool Verify(const ADSP::CommandListProcessor& processor) = 0; + virtual bool Verify(const AudioRenderer::CommandListProcessor& processor) = 0; /// Command magic 0xCAFEBABE u32 magic{}; @@ -90,4 +95,4 @@ struct ICommand { u32 node_id{}; }; -} // namespace AudioCore::AudioRenderer +} // 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 b8c0c6a0c..2fc8593a6 100755 --- a/src/audio_core/renderer/command/mix/clear_mix.cpp +++ b/src/audio_core/renderer/command/mix/clear_mix.cpp @@ -3,22 +3,22 @@ #include -#include "audio_core/renderer/adsp/command_list_processor.h" +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" #include "audio_core/renderer/command/mix/clear_mix.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { -void ClearMixBufferCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, - std::string& string) { +void ClearMixBufferCommand::Dump( + [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { string += fmt::format("ClearMixBufferCommand\n"); } -void ClearMixBufferCommand::Process(const ADSP::CommandListProcessor& processor) { +void ClearMixBufferCommand::Process(const AudioRenderer::CommandListProcessor& processor) { memset(processor.mix_buffers.data(), 0, processor.mix_buffers.size_bytes()); } -bool ClearMixBufferCommand::Verify(const ADSP::CommandListProcessor& processor) { +bool ClearMixBufferCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { return true; } -} // namespace AudioCore::AudioRenderer +} // 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 186cdb44a..03026965b 100755 --- a/src/audio_core/renderer/command/mix/clear_mix.h +++ b/src/audio_core/renderer/command/mix/clear_mix.h @@ -8,11 +8,12 @@ #include "audio_core/renderer/command/icommand.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP::AudioRenderer { class CommandListProcessor; } +namespace AudioCore::Renderer { + /** * AudioRenderer command for a clearing the mix buffers. * Used at the start of each command list. @@ -24,14 +25,14 @@ struct ClearMixBufferCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -39,7 +40,7 @@ struct ClearMixBufferCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; }; -} // namespace AudioCore::AudioRenderer +} // 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 19cdce337..be1c2a655 100755 --- a/src/audio_core/renderer/command/mix/copy_mix.cpp +++ b/src/audio_core/renderer/command/mix/copy_mix.cpp @@ -1,18 +1,18 @@ // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "audio_core/renderer/adsp/command_list_processor.h" +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" #include "audio_core/renderer/command/mix/copy_mix.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { -void CopyMixBufferCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, - std::string& string) { +void CopyMixBufferCommand::Dump( + [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { string += fmt::format("CopyMixBufferCommand\n\tinput {:02X} output {:02X}\n", input_index, output_index); } -void CopyMixBufferCommand::Process(const ADSP::CommandListProcessor& processor) { +void CopyMixBufferCommand::Process(const AudioRenderer::CommandListProcessor& processor) { auto output{processor.mix_buffers.subspan(output_index * processor.sample_count, processor.sample_count)}; auto input{processor.mix_buffers.subspan(input_index * processor.sample_count, @@ -20,8 +20,8 @@ void CopyMixBufferCommand::Process(const ADSP::CommandListProcessor& processor) std::memcpy(output.data(), input.data(), processor.sample_count * sizeof(s32)); } -bool CopyMixBufferCommand::Verify(const ADSP::CommandListProcessor& processor) { +bool CopyMixBufferCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { return true; } -} // namespace AudioCore::AudioRenderer +} // 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 566c9c378..dfbbff120 100755 --- a/src/audio_core/renderer/command/mix/copy_mix.h +++ b/src/audio_core/renderer/command/mix/copy_mix.h @@ -8,11 +8,12 @@ #include "audio_core/renderer/command/icommand.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP::AudioRenderer { class CommandListProcessor; } +namespace AudioCore::Renderer { + /** * AudioRenderer command for a copying a mix buffer from input to output. */ @@ -23,14 +24,14 @@ struct CopyMixBufferCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -38,7 +39,7 @@ struct CopyMixBufferCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Input mix buffer index s16 input_index; @@ -46,4 +47,4 @@ struct CopyMixBufferCommand : ICommand { s16 output_index; }; -} // namespace AudioCore::AudioRenderer +} // 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 d3557f48a..0f770bdad 100755 --- 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 @@ // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" #include "audio_core/common/common.h" -#include "audio_core/renderer/adsp/command_list_processor.h" #include "audio_core/renderer/command/mix/depop_for_mix_buffers.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * Apply depopping. Add the depopped sample to each incoming new sample, decaying it each time * according to decay. @@ -36,13 +36,13 @@ static s32 ApplyDepopMix(std::span output, const s32 depop_sample, } } -void DepopForMixBuffersCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, - std::string& string) { +void DepopForMixBuffersCommand::Dump( + [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { string += fmt::format("DepopForMixBuffersCommand\n\tinput {:02X} count {} decay {}\n", input, count, decay.to_float()); } -void DepopForMixBuffersCommand::Process(const ADSP::CommandListProcessor& processor) { +void DepopForMixBuffersCommand::Process(const AudioRenderer::CommandListProcessor& processor) { auto end_index{std::min(processor.buffer_count, input + count)}; std::span depop_buff{reinterpret_cast(depop_buffer), end_index}; @@ -57,8 +57,8 @@ void DepopForMixBuffersCommand::Process(const ADSP::CommandListProcessor& proces } } -bool DepopForMixBuffersCommand::Verify(const ADSP::CommandListProcessor& processor) { +bool DepopForMixBuffersCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { return true; } -} // namespace AudioCore::AudioRenderer +} // 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 e543e1d2e..415105259 100755 --- 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 @@ #include "common/common_types.h" #include "common/fixed_point.h" -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP::AudioRenderer { class CommandListProcessor; } +namespace AudioCore::Renderer { + /** * AudioRenderer command for depopping a mix buffer. * Adds a cumulation of previous samples to the current mix buffer with a decay. @@ -25,14 +26,14 @@ struct DepopForMixBuffersCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -40,7 +41,7 @@ struct DepopForMixBuffersCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Starting input mix buffer index u32 input; @@ -52,4 +53,4 @@ struct DepopForMixBuffersCommand : ICommand { CpuAddr depop_buffer; }; -} // namespace AudioCore::AudioRenderer +} // 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 1d94ab9f4..1ddf1a04c 100755 --- a/src/audio_core/renderer/command/mix/depop_prepare.cpp +++ b/src/audio_core/renderer/command/mix/depop_prepare.cpp @@ -1,15 +1,15 @@ // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "audio_core/renderer/adsp/command_list_processor.h" +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" #include "audio_core/renderer/command/mix/depop_prepare.h" #include "audio_core/renderer/voice/voice_state.h" #include "common/fixed_point.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { -void DepopPrepareCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, - std::string& string) { +void DepopPrepareCommand::Dump( + [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { string += fmt::format("DepopPrepareCommand\n\tinputs: "); for (u32 i = 0; i < buffer_count; i++) { string += fmt::format("{:02X}, ", inputs[i]); @@ -17,7 +17,7 @@ void DepopPrepareCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor string += "\n"; } -void DepopPrepareCommand::Process(const ADSP::CommandListProcessor& processor) { +void DepopPrepareCommand::Process(const AudioRenderer::CommandListProcessor& processor) { auto samples{reinterpret_cast(previous_samples)}; auto buffer{reinterpret_cast(depop_buffer)}; @@ -29,8 +29,8 @@ void DepopPrepareCommand::Process(const ADSP::CommandListProcessor& processor) { } } -bool DepopPrepareCommand::Verify(const ADSP::CommandListProcessor& processor) { +bool DepopPrepareCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { return true; } -} // namespace AudioCore::AudioRenderer +} // 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 861370e0d..dee88878a 100755 --- a/src/audio_core/renderer/command/mix/depop_prepare.h +++ b/src/audio_core/renderer/command/mix/depop_prepare.h @@ -8,11 +8,12 @@ #include "audio_core/renderer/command/icommand.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP::AudioRenderer { class CommandListProcessor; } +namespace AudioCore::Renderer { + /** * AudioRenderer command for preparing depop. * Adds the previusly output last samples to the depop buffer. @@ -24,14 +25,14 @@ struct DepopPrepareCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -39,7 +40,7 @@ struct DepopPrepareCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Depop buffer offset for each mix buffer std::array inputs; @@ -51,4 +52,4 @@ struct DepopPrepareCommand : ICommand { CpuAddr depop_buffer; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/command/mix/mix.cpp b/src/audio_core/renderer/command/mix/mix.cpp index 1e04c4dcc..d4214f769 100755 --- a/src/audio_core/renderer/command/mix/mix.cpp +++ b/src/audio_core/renderer/command/mix/mix.cpp @@ -5,11 +5,11 @@ #include #include -#include "audio_core/renderer/adsp/command_list_processor.h" +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" #include "audio_core/renderer/command/mix/mix.h" #include "common/fixed_point.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * Mix input mix buffer into output mix buffer, with volume applied to the input. * @@ -28,7 +28,7 @@ static void ApplyMix(std::span output, std::span input, const f3 } } -void MixCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, +void MixCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { string += fmt::format("MixCommand"); string += fmt::format("\n\tinput {:02X}", input_index); @@ -37,7 +37,7 @@ void MixCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& process string += "\n"; } -void MixCommand::Process(const ADSP::CommandListProcessor& processor) { +void MixCommand::Process(const AudioRenderer::CommandListProcessor& processor) { auto output{processor.mix_buffers.subspan(output_index * processor.sample_count, processor.sample_count)}; auto input{processor.mix_buffers.subspan(input_index * processor.sample_count, @@ -63,8 +63,8 @@ void MixCommand::Process(const ADSP::CommandListProcessor& processor) { } } -bool MixCommand::Verify(const ADSP::CommandListProcessor& processor) { +bool MixCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { return true; } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/command/mix/mix.h b/src/audio_core/renderer/command/mix/mix.h index c9f8905de..b2ddb72f8 100755 --- a/src/audio_core/renderer/command/mix/mix.h +++ b/src/audio_core/renderer/command/mix/mix.h @@ -8,11 +8,12 @@ #include "audio_core/renderer/command/icommand.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP::AudioRenderer { class CommandListProcessor; } +namespace AudioCore::Renderer { + /** * AudioRenderer command for mixing an input mix buffer to an output mix buffer, with a volume * applied to the input. @@ -24,14 +25,14 @@ struct MixCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -39,7 +40,7 @@ struct MixCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Fixed point precision u8 precision; @@ -51,4 +52,4 @@ struct MixCommand : ICommand { f32 volume; }; -} // namespace AudioCore::AudioRenderer +} // 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 54226afd6..3cffe3493 100755 --- a/src/audio_core/renderer/command/mix/mix_ramp.cpp +++ b/src/audio_core/renderer/command/mix/mix_ramp.cpp @@ -1,12 +1,12 @@ // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "audio_core/renderer/adsp/command_list_processor.h" +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" #include "audio_core/renderer/command/mix/mix_ramp.h" #include "common/fixed_point.h" #include "common/logging/log.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { template s32 ApplyMixRamp(std::span output, std::span input, const f32 volume_, @@ -33,7 +33,8 @@ s32 ApplyMixRamp(std::span output, std::span input, const f32 vo template s32 ApplyMixRamp<15>(std::span, std::span, f32, f32, u32); template s32 ApplyMixRamp<23>(std::span, std::span, f32, f32, u32); -void MixRampCommand::Dump(const ADSP::CommandListProcessor& processor, std::string& string) { +void MixRampCommand::Dump(const AudioRenderer::CommandListProcessor& processor, + std::string& string) { const auto ramp{(volume - prev_volume) / static_cast(processor.sample_count)}; string += fmt::format("MixRampCommand"); string += fmt::format("\n\tinput {:02X}", input_index); @@ -44,7 +45,7 @@ void MixRampCommand::Dump(const ADSP::CommandListProcessor& processor, std::stri string += "\n"; } -void MixRampCommand::Process(const ADSP::CommandListProcessor& processor) { +void MixRampCommand::Process(const AudioRenderer::CommandListProcessor& processor) { auto output{processor.mix_buffers.subspan(output_index * processor.sample_count, processor.sample_count)}; auto input{processor.mix_buffers.subspan(input_index * processor.sample_count, @@ -75,8 +76,8 @@ void MixRampCommand::Process(const ADSP::CommandListProcessor& processor) { } } -bool MixRampCommand::Verify(const ADSP::CommandListProcessor& processor) { +bool MixRampCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { return true; } -} // namespace AudioCore::AudioRenderer +} // 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 8d4fbe509..e232a519e 100755 --- a/src/audio_core/renderer/command/mix/mix_ramp.h +++ b/src/audio_core/renderer/command/mix/mix_ramp.h @@ -9,11 +9,12 @@ #include "audio_core/renderer/command/icommand.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP::AudioRenderer { class CommandListProcessor; } +namespace AudioCore::Renderer { + /** * AudioRenderer command for mixing an input mix buffer to an output mix buffer, with a volume * applied to the input, and volume ramping to smooth out the transition. @@ -25,14 +26,14 @@ struct MixRampCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -40,7 +41,7 @@ struct MixRampCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Fixed point precision u8 precision; @@ -70,4 +71,4 @@ template s32 ApplyMixRamp(std::span output, std::span input, f32 volume_, f32 ramp_, u32 sample_count); -} // namespace AudioCore::AudioRenderer +} // 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 85d004e2f..8720cc5a6 100755 --- 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 @@ // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "audio_core/renderer/adsp/command_list_processor.h" +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" #include "audio_core/renderer/command/mix/mix_ramp.h" #include "audio_core/renderer/command/mix/mix_ramp_grouped.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { -void MixRampGroupedCommand::Dump(const ADSP::CommandListProcessor& processor, std::string& string) { +void MixRampGroupedCommand::Dump(const AudioRenderer::CommandListProcessor& processor, + std::string& string) { string += "MixRampGroupedCommand"; for (u32 i = 0; i < buffer_count; i++) { string += fmt::format("\n\t{}", i); @@ -21,7 +22,7 @@ void MixRampGroupedCommand::Dump(const ADSP::CommandListProcessor& processor, st } } -void MixRampGroupedCommand::Process(const ADSP::CommandListProcessor& processor) { +void MixRampGroupedCommand::Process(const AudioRenderer::CommandListProcessor& processor) { std::span prev_samples = {reinterpret_cast(previous_samples), MaxMixBuffers}; for (u32 i = 0; i < buffer_count; i++) { @@ -58,8 +59,8 @@ void MixRampGroupedCommand::Process(const ADSP::CommandListProcessor& processor) } } -bool MixRampGroupedCommand::Verify(const ADSP::CommandListProcessor& processor) { +bool MixRampGroupedCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { return true; } -} // namespace AudioCore::AudioRenderer +} // 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 1952b1c91..b28260311 100755 --- 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 @@ #include "audio_core/renderer/command/icommand.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP::AudioRenderer { class CommandListProcessor; } +namespace AudioCore::Renderer { + /** * AudioRenderer command for mixing multiple input mix buffers to multiple output mix buffers, with * a volume applied to the input, and volume ramping to smooth out the transition. @@ -25,14 +26,14 @@ struct MixRampGroupedCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -40,7 +41,7 @@ struct MixRampGroupedCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Fixed point precision u8 precision; @@ -58,4 +59,4 @@ struct MixRampGroupedCommand : ICommand { CpuAddr previous_samples; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/command/mix/volume.cpp b/src/audio_core/renderer/command/mix/volume.cpp index d1617ee62..540eda85a 100755 --- a/src/audio_core/renderer/command/mix/volume.cpp +++ b/src/audio_core/renderer/command/mix/volume.cpp @@ -1,12 +1,12 @@ // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "audio_core/renderer/adsp/command_list_processor.h" +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" #include "audio_core/renderer/command/mix/volume.h" #include "common/fixed_point.h" #include "common/logging/log.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * Apply volume to the input mix buffer, saving to the output buffer. * @@ -29,7 +29,7 @@ static void ApplyUniformGain(std::span output, std::span input, } } -void VolumeCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, +void VolumeCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { string += fmt::format("VolumeCommand"); string += fmt::format("\n\tinput {:02X}", input_index); @@ -38,7 +38,7 @@ void VolumeCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& proc string += "\n"; } -void VolumeCommand::Process(const ADSP::CommandListProcessor& processor) { +void VolumeCommand::Process(const AudioRenderer::CommandListProcessor& processor) { // If input and output buffers are the same, and the volume is 1.0f, this won't do // anything, so just skip. if (input_index == output_index && volume == 1.0f) { @@ -65,8 +65,8 @@ void VolumeCommand::Process(const ADSP::CommandListProcessor& processor) { } } -bool VolumeCommand::Verify(const ADSP::CommandListProcessor& processor) { +bool VolumeCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { return true; } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/command/mix/volume.h b/src/audio_core/renderer/command/mix/volume.h index 9745b4542..06b3a0082 100755 --- a/src/audio_core/renderer/command/mix/volume.h +++ b/src/audio_core/renderer/command/mix/volume.h @@ -8,11 +8,12 @@ #include "audio_core/renderer/command/icommand.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP::AudioRenderer { class CommandListProcessor; } +namespace AudioCore::Renderer { + /** * AudioRenderer command for applying volume to a mix buffer. */ @@ -23,14 +24,14 @@ struct VolumeCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -38,7 +39,7 @@ struct VolumeCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Fixed point precision u8 precision; @@ -50,4 +51,4 @@ struct VolumeCommand : ICommand { f32 volume; }; -} // namespace AudioCore::AudioRenderer +} // 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 03c41e541..56085516b 100755 --- a/src/audio_core/renderer/command/mix/volume_ramp.cpp +++ b/src/audio_core/renderer/command/mix/volume_ramp.cpp @@ -1,11 +1,11 @@ // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "audio_core/renderer/adsp/command_list_processor.h" +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" #include "audio_core/renderer/command/mix/volume_ramp.h" #include "common/fixed_point.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * Apply volume with ramping to the input mix buffer, saving to the output buffer. * @@ -38,7 +38,8 @@ static void ApplyLinearEnvelopeGain(std::span output, std::span } } -void VolumeRampCommand::Dump(const ADSP::CommandListProcessor& processor, std::string& string) { +void VolumeRampCommand::Dump(const AudioRenderer::CommandListProcessor& processor, + std::string& string) { const auto ramp{(volume - prev_volume) / static_cast(processor.sample_count)}; string += fmt::format("VolumeRampCommand"); string += fmt::format("\n\tinput {:02X}", input_index); @@ -49,7 +50,7 @@ void VolumeRampCommand::Dump(const ADSP::CommandListProcessor& processor, std::s string += "\n"; } -void VolumeRampCommand::Process(const ADSP::CommandListProcessor& processor) { +void VolumeRampCommand::Process(const AudioRenderer::CommandListProcessor& processor) { auto output{processor.mix_buffers.subspan(output_index * processor.sample_count, processor.sample_count)}; auto input{processor.mix_buffers.subspan(input_index * processor.sample_count, @@ -77,8 +78,8 @@ void VolumeRampCommand::Process(const ADSP::CommandListProcessor& processor) { } } -bool VolumeRampCommand::Verify(const ADSP::CommandListProcessor& processor) { +bool VolumeRampCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { return true; } -} // namespace AudioCore::AudioRenderer +} // 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 b00ea9678..74b834a31 100755 --- a/src/audio_core/renderer/command/mix/volume_ramp.h +++ b/src/audio_core/renderer/command/mix/volume_ramp.h @@ -8,11 +8,12 @@ #include "audio_core/renderer/command/icommand.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP::AudioRenderer { class CommandListProcessor; } +namespace AudioCore::Renderer { + /** * AudioRenderer command for applying volume to a mix buffer, with ramping for the volume to smooth * out the transition. @@ -24,14 +25,14 @@ struct VolumeRampCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -39,7 +40,7 @@ struct VolumeRampCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Fixed point precision u8 precision; @@ -53,4 +54,4 @@ struct VolumeRampCommand : ICommand { f32 volume; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/command/performance/performance.cpp b/src/audio_core/renderer/command/performance/performance.cpp index b31880de3..029e01563 100755 --- a/src/audio_core/renderer/command/performance/performance.cpp +++ b/src/audio_core/renderer/command/performance/performance.cpp @@ -1,25 +1,25 @@ // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "audio_core/renderer/adsp/command_list_processor.h" +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" #include "audio_core/renderer/command/performance/performance.h" #include "core/core.h" #include "core/core_timing.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { -void PerformanceCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, +void PerformanceCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { string += fmt::format("PerformanceCommand\n\tstate {}\n", static_cast(state)); } -void PerformanceCommand::Process(const ADSP::CommandListProcessor& processor) { +void PerformanceCommand::Process(const AudioRenderer::CommandListProcessor& processor) { auto base{entry_address.translated_address}; if (state == PerformanceState::Start) { auto start_time_ptr{reinterpret_cast(base + entry_address.entry_start_time_offset)}; *start_time_ptr = - static_cast(processor.system->CoreTiming().GetClockTicks() - processor.start_time - - processor.current_processing_time); + static_cast(processor.system->CoreTiming().GetGlobalTimeUs().count() - + processor.start_time - processor.current_processing_time); } else if (state == PerformanceState::Stop) { auto processed_time_ptr{ reinterpret_cast(base + entry_address.entry_processed_time_offset)}; @@ -27,14 +27,14 @@ void PerformanceCommand::Process(const ADSP::CommandListProcessor& processor) { reinterpret_cast(base + entry_address.header_entry_count_offset)}; *processed_time_ptr = - static_cast(processor.system->CoreTiming().GetClockTicks() - processor.start_time - - processor.current_processing_time); + static_cast(processor.system->CoreTiming().GetGlobalTimeUs().count() - + processor.start_time - processor.current_processing_time); (*entry_count_ptr)++; } } -bool PerformanceCommand::Verify(const ADSP::CommandListProcessor& processor) { +bool PerformanceCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { return true; } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/command/performance/performance.h b/src/audio_core/renderer/command/performance/performance.h index 5c45aaeeb..646e0c463 100755 --- a/src/audio_core/renderer/command/performance/performance.h +++ b/src/audio_core/renderer/command/performance/performance.h @@ -10,11 +10,12 @@ #include "audio_core/renderer/performance/performance_manager.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP::AudioRenderer { class CommandListProcessor; } +namespace AudioCore::Renderer { + /** * AudioRenderer command for writing AudioRenderer performance metrics back to the sysmodule. */ @@ -25,14 +26,14 @@ struct PerformanceCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -40,7 +41,7 @@ struct PerformanceCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// State of the performance PerformanceState state; @@ -48,4 +49,4 @@ struct PerformanceCommand : ICommand { PerformanceEntryAddresses entry_address; }; -} // namespace AudioCore::AudioRenderer +} // 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 85bc7234c..8e1e2aa34 100755 --- 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 @@ // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later -#include "audio_core/renderer/adsp/command_list_processor.h" +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" #include "audio_core/renderer/command/resample/downmix_6ch_to_2ch.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { -void DownMix6chTo2chCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, - std::string& string) { +void DownMix6chTo2chCommand::Dump( + [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { string += fmt::format("DownMix6chTo2chCommand\n\tinputs: "); for (u32 i = 0; i < MaxChannels; i++) { string += fmt::format("{:02X}, ", inputs[i]); @@ -19,7 +19,7 @@ void DownMix6chTo2chCommand::Dump([[maybe_unused]] const ADSP::CommandListProces string += "\n"; } -void DownMix6chTo2chCommand::Process(const ADSP::CommandListProcessor& processor) { +void DownMix6chTo2chCommand::Process(const AudioRenderer::CommandListProcessor& processor) { auto in_front_left{ processor.mix_buffers.subspan(inputs[0] * processor.sample_count, processor.sample_count)}; auto in_front_right{ @@ -67,8 +67,8 @@ void DownMix6chTo2chCommand::Process(const ADSP::CommandListProcessor& processor std::memset(out_back_right.data(), 0, out_back_right.size_bytes()); } -bool DownMix6chTo2chCommand::Verify(const ADSP::CommandListProcessor& processor) { +bool DownMix6chTo2chCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { return true; } -} // namespace AudioCore::AudioRenderer +} // 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 3cee82e6e..daba098b8 100755 --- 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 @@ #include "common/common_types.h" #include "common/fixed_point.h" -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP::AudioRenderer { class CommandListProcessor; } +namespace AudioCore::Renderer { + /** * AudioRenderer command for downmixing 6 channels to 2. * Channel layout (SMPTE): @@ -31,14 +32,14 @@ struct DownMix6chTo2chCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -46,7 +47,7 @@ struct DownMix6chTo2chCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Input mix buffer offsets for each channel std::array inputs; @@ -56,4 +57,4 @@ struct DownMix6chTo2chCommand : ICommand { std::array, 4> down_mix_coeff; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/command/resample/resample.cpp b/src/audio_core/renderer/command/resample/resample.cpp index 743ca6d96..8386b2b61 100755 --- a/src/audio_core/renderer/command/resample/resample.cpp +++ b/src/audio_core/renderer/command/resample/resample.cpp @@ -3,7 +3,7 @@ #include "audio_core/renderer/command/resample/resample.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { static void ResampleLowQuality(std::span output, std::span input, const Common::FixedPoint<49, 15>& sample_rate_ratio, @@ -880,4 +880,4 @@ void Resample(std::span output, std::span input, } } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/command/resample/resample.h b/src/audio_core/renderer/command/resample/resample.h index 4bc22eedf..b4015036a 100755 --- a/src/audio_core/renderer/command/resample/resample.h +++ b/src/audio_core/renderer/command/resample/resample.h @@ -9,7 +9,7 @@ #include "common/common_types.h" #include "common/fixed_point.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * Resample an input buffer into an output buffer, according to the sample_rate_ratio. * @@ -26,4 +26,4 @@ void Resample(std::span output, std::span input, const Common::FixedPoint<49, 15>& sample_rate_ratio, Common::FixedPoint<49, 15>& fraction, u32 samples_to_write, SrcQuality src_quality); -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/command/resample/upsample.cpp b/src/audio_core/renderer/command/resample/upsample.cpp index 43eaaba43..5288fb072 100755 --- a/src/audio_core/renderer/command/resample/upsample.cpp +++ b/src/audio_core/renderer/command/resample/upsample.cpp @@ -3,11 +3,11 @@ #include -#include "audio_core/renderer/adsp/command_list_processor.h" +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" #include "audio_core/renderer/command/resample/upsample.h" #include "audio_core/renderer/upsampler/upsampler_info.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * Upsampling impl. Input must be 8K, 16K or 32K, output is 48K. * @@ -198,7 +198,7 @@ static void SrcProcessFrame(std::span output, std::span input, } } -auto UpsampleCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, +auto UpsampleCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) -> void { string += fmt::format("UpsampleCommand\n\tsource_sample_count {} source_sample_rate {}", source_sample_count, source_sample_rate); @@ -213,7 +213,7 @@ auto UpsampleCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& pr string += "\n"; } -void UpsampleCommand::Process(const ADSP::CommandListProcessor& processor) { +void UpsampleCommand::Process(const AudioRenderer::CommandListProcessor& processor) { const auto info{reinterpret_cast(upsampler_info)}; const auto input_count{std::min(info->input_count, buffer_count)}; const std::span inputs_{reinterpret_cast(inputs), input_count}; @@ -234,8 +234,8 @@ void UpsampleCommand::Process(const ADSP::CommandListProcessor& processor) { } } -bool UpsampleCommand::Verify(const ADSP::CommandListProcessor& processor) { +bool UpsampleCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { return true; } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/command/resample/upsample.h b/src/audio_core/renderer/command/resample/upsample.h index 0e524d07a..2fcff8257 100755 --- a/src/audio_core/renderer/command/resample/upsample.h +++ b/src/audio_core/renderer/command/resample/upsample.h @@ -8,11 +8,12 @@ #include "audio_core/renderer/command/icommand.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP::AudioRenderer { class CommandListProcessor; } +namespace AudioCore::Renderer { + /** * AudioRenderer command for upsampling a mix buffer to 48Khz. * Input must be 8Khz, 16Khz or 32Khz, and output will be 48Khz. @@ -24,14 +25,14 @@ struct UpsampleCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -39,7 +40,7 @@ struct UpsampleCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Pointer to the output samples buffer. CpuAddr samples_buffer; @@ -57,4 +58,4 @@ struct UpsampleCommand : ICommand { CpuAddr upsampler_info; }; -} // namespace AudioCore::AudioRenderer +} // 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 970e9f02c..5121e646c 100755 --- a/src/audio_core/renderer/command/sink/circular_buffer.cpp +++ b/src/audio_core/renderer/command/sink/circular_buffer.cpp @@ -3,14 +3,14 @@ #include -#include "audio_core/renderer/adsp/command_list_processor.h" +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" #include "audio_core/renderer/command/sink/circular_buffer.h" #include "core/memory.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { -void CircularBufferSinkCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, - std::string& string) { +void CircularBufferSinkCommand::Dump( + [[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { string += fmt::format( "CircularBufferSinkCommand\n\tinput_count {} ring size {:04X} ring pos {:04X}\n\tinputs: ", input_count, size, pos); @@ -20,7 +20,7 @@ void CircularBufferSinkCommand::Dump([[maybe_unused]] const ADSP::CommandListPro string += "\n"; } -void CircularBufferSinkCommand::Process(const ADSP::CommandListProcessor& processor) { +void CircularBufferSinkCommand::Process(const AudioRenderer::CommandListProcessor& processor) { constexpr s32 min{std::numeric_limits::min()}; constexpr s32 max{std::numeric_limits::max()}; @@ -41,8 +41,8 @@ void CircularBufferSinkCommand::Process(const ADSP::CommandListProcessor& proces } } -bool CircularBufferSinkCommand::Verify(const ADSP::CommandListProcessor& processor) { +bool CircularBufferSinkCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { return true; } -} // namespace AudioCore::AudioRenderer +} // 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 dfcf9d533..e4f307755 100755 --- a/src/audio_core/renderer/command/sink/circular_buffer.h +++ b/src/audio_core/renderer/command/sink/circular_buffer.h @@ -8,11 +8,12 @@ #include "audio_core/renderer/command/icommand.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP::AudioRenderer { class CommandListProcessor; } +namespace AudioCore::Renderer { + /** * AudioRenderer command for sinking samples to a circular buffer. */ @@ -23,14 +24,14 @@ struct CircularBufferSinkCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -38,7 +39,7 @@ struct CircularBufferSinkCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Number of input mix buffers u32 input_count; @@ -52,4 +53,4 @@ struct CircularBufferSinkCommand : ICommand { u32 pos; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/command/sink/device.cpp b/src/audio_core/renderer/command/sink/device.cpp index 370a681f4..dc6fbd1bd 100755 --- a/src/audio_core/renderer/command/sink/device.cpp +++ b/src/audio_core/renderer/command/sink/device.cpp @@ -3,13 +3,13 @@ #include -#include "audio_core/renderer/adsp/command_list_processor.h" +#include "audio_core/adsp/apps/audio_renderer/command_list_processor.h" #include "audio_core/renderer/command/sink/device.h" #include "audio_core/sink/sink.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { -void DeviceSinkCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& processor, +void DeviceSinkCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProcessor& processor, std::string& string) { string += fmt::format("DeviceSinkCommand\n\t{} session {} input_count {}\n\tinputs: ", std::string_view(name), session_id, input_count); @@ -19,7 +19,7 @@ void DeviceSinkCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor& string += "\n"; } -void DeviceSinkCommand::Process(const ADSP::CommandListProcessor& processor) { +void DeviceSinkCommand::Process(const AudioRenderer::CommandListProcessor& processor) { constexpr s32 min = std::numeric_limits::min(); constexpr s32 max = std::numeric_limits::max(); @@ -51,8 +51,8 @@ void DeviceSinkCommand::Process(const ADSP::CommandListProcessor& processor) { } } -bool DeviceSinkCommand::Verify(const ADSP::CommandListProcessor& processor) { +bool DeviceSinkCommand::Verify(const AudioRenderer::CommandListProcessor& processor) { return true; } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/command/sink/device.h b/src/audio_core/renderer/command/sink/device.h index 3e7c7b4b5..2e58f40ba 100755 --- a/src/audio_core/renderer/command/sink/device.h +++ b/src/audio_core/renderer/command/sink/device.h @@ -10,11 +10,12 @@ #include "audio_core/renderer/command/icommand.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP::AudioRenderer { class CommandListProcessor; } +namespace AudioCore::Renderer { + /** * AudioRenderer command for sinking samples to an output device. */ @@ -25,14 +26,14 @@ struct DeviceSinkCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @param string - The string to print into. */ - void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override; + void Dump(const AudioRenderer::CommandListProcessor& processor, std::string& string) override; /** * Process this command. * * @param processor - The CommandListProcessor processing this command. */ - void Process(const ADSP::CommandListProcessor& processor) override; + void Process(const AudioRenderer::CommandListProcessor& processor) override; /** * Verify this command's data is valid. @@ -40,7 +41,7 @@ struct DeviceSinkCommand : ICommand { * @param processor - The CommandListProcessor processing this command. * @return True if the command is valid, otherwise false. */ - bool Verify(const ADSP::CommandListProcessor& processor) override; + bool Verify(const AudioRenderer::CommandListProcessor& processor) override; /// Device name char name[0x100]; @@ -54,4 +55,4 @@ struct DeviceSinkCommand : ICommand { std::array inputs; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/effect/aux_.cpp b/src/audio_core/renderer/effect/aux_.cpp index 00e2aa317..b9c9b692e 100755 --- a/src/audio_core/renderer/effect/aux_.cpp +++ b/src/audio_core/renderer/effect/aux_.cpp @@ -3,7 +3,7 @@ #include "audio_core/renderer/effect/aux_.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { void AuxInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params, const PoolMapper& pool_mapper) { @@ -90,4 +90,4 @@ CpuAddr AuxInfo::GetWorkbuffer(s32 index) { return workbuffers[index].GetReference(true); } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/effect/aux_.h b/src/audio_core/renderer/effect/aux_.h index 11b631b7c..57a11280c 100755 --- a/src/audio_core/renderer/effect/aux_.h +++ b/src/audio_core/renderer/effect/aux_.h @@ -9,7 +9,7 @@ #include "audio_core/renderer/effect/effect_info_base.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * Auxiliary Buffer used for Aux commands. * Send and return buffers are available (names from the game's perspective). @@ -120,4 +120,4 @@ public: CpuAddr GetWorkbuffer(s32 index) override; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/effect/biquad_filter.cpp b/src/audio_core/renderer/effect/biquad_filter.cpp index 47a9cea4c..877ec14e4 100755 --- a/src/audio_core/renderer/effect/biquad_filter.cpp +++ b/src/audio_core/renderer/effect/biquad_filter.cpp @@ -3,7 +3,7 @@ #include "audio_core/renderer/effect/biquad_filter.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { void BiquadFilterInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params, const PoolMapper& pool_mapper) { @@ -49,4 +49,4 @@ void BiquadFilterInfo::InitializeResultState(EffectResultState& result_state) {} void BiquadFilterInfo::UpdateResultState(EffectResultState& cpu_state, EffectResultState& dsp_state) {} -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/effect/biquad_filter.h b/src/audio_core/renderer/effect/biquad_filter.h index 928fd48cd..2388dd012 100755 --- a/src/audio_core/renderer/effect/biquad_filter.h +++ b/src/audio_core/renderer/effect/biquad_filter.h @@ -9,7 +9,7 @@ #include "audio_core/renderer/effect/effect_info_base.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { class BiquadFilterInfo : public EffectInfoBase { public: @@ -76,4 +76,4 @@ public: void UpdateResultState(EffectResultState& cpu_state, EffectResultState& dsp_state) override; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/effect/buffer_mixer.cpp b/src/audio_core/renderer/effect/buffer_mixer.cpp index abd463125..362046306 100755 --- a/src/audio_core/renderer/effect/buffer_mixer.cpp +++ b/src/audio_core/renderer/effect/buffer_mixer.cpp @@ -3,7 +3,7 @@ #include "audio_core/renderer/effect/buffer_mixer.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { void BufferMixerInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params, const PoolMapper& pool_mapper) { @@ -46,4 +46,4 @@ void BufferMixerInfo::InitializeResultState(EffectResultState& result_state) {} void BufferMixerInfo::UpdateResultState(EffectResultState& cpu_state, EffectResultState& dsp_state) {} -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/effect/buffer_mixer.h b/src/audio_core/renderer/effect/buffer_mixer.h index c81b81e3e..709b19d79 100755 --- a/src/audio_core/renderer/effect/buffer_mixer.h +++ b/src/audio_core/renderer/effect/buffer_mixer.h @@ -9,7 +9,7 @@ #include "audio_core/renderer/effect/effect_info_base.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { class BufferMixerInfo : public EffectInfoBase { public: @@ -72,4 +72,4 @@ public: void UpdateResultState(EffectResultState& cpu_state, EffectResultState& dsp_state) override; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/effect/capture.cpp b/src/audio_core/renderer/effect/capture.cpp index 2419dc7b1..f23e7dcbb 100755 --- a/src/audio_core/renderer/effect/capture.cpp +++ b/src/audio_core/renderer/effect/capture.cpp @@ -4,7 +4,7 @@ #include "audio_core/renderer/effect/aux_.h" #include "audio_core/renderer/effect/capture.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { void CaptureInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params, const PoolMapper& pool_mapper) { @@ -79,4 +79,4 @@ CpuAddr CaptureInfo::GetWorkbuffer(s32 index) { return workbuffers[index].GetReference(true); } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/effect/capture.h b/src/audio_core/renderer/effect/capture.h index c85a7fc55..5f77fb735 100755 --- a/src/audio_core/renderer/effect/capture.h +++ b/src/audio_core/renderer/effect/capture.h @@ -9,7 +9,7 @@ #include "audio_core/renderer/effect/effect_info_base.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { class CaptureInfo : public EffectInfoBase { public: @@ -62,4 +62,4 @@ public: CpuAddr GetWorkbuffer(s32 index) override; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/effect/compressor.cpp b/src/audio_core/renderer/effect/compressor.cpp index ad6df5120..6908c8899 100755 --- a/src/audio_core/renderer/effect/compressor.cpp +++ b/src/audio_core/renderer/effect/compressor.cpp @@ -3,7 +3,7 @@ #include "audio_core/renderer/effect/compressor.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { void CompressorInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params, const PoolMapper& pool_mapper) {} @@ -37,4 +37,4 @@ CpuAddr CompressorInfo::GetWorkbuffer(s32 index) { return GetSingleBuffer(index); } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/effect/compressor.h b/src/audio_core/renderer/effect/compressor.h index addb99084..055e5317a 100755 --- a/src/audio_core/renderer/effect/compressor.h +++ b/src/audio_core/renderer/effect/compressor.h @@ -10,7 +10,7 @@ #include "common/common_types.h" #include "common/fixed_point.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { class CompressorInfo : public EffectInfoBase { public: @@ -103,4 +103,4 @@ public: CpuAddr GetWorkbuffer(s32 index) override; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/effect/delay.cpp b/src/audio_core/renderer/effect/delay.cpp index 776e71360..fa39abf66 100755 --- a/src/audio_core/renderer/effect/delay.cpp +++ b/src/audio_core/renderer/effect/delay.cpp @@ -3,7 +3,7 @@ #include "audio_core/renderer/effect/delay.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { void DelayInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params, const PoolMapper& pool_mapper) { @@ -90,4 +90,4 @@ CpuAddr DelayInfo::GetWorkbuffer(s32 index) { return GetSingleBuffer(index); } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/effect/delay.h b/src/audio_core/renderer/effect/delay.h index 7e380b4a7..f4bf66a8a 100755 --- a/src/audio_core/renderer/effect/delay.h +++ b/src/audio_core/renderer/effect/delay.h @@ -11,7 +11,7 @@ #include "common/common_types.h" #include "common/fixed_point.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { class DelayInfo : public EffectInfoBase { public: @@ -132,4 +132,4 @@ public: CpuAddr GetWorkbuffer(s32 index) override; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/effect/effect_context.cpp b/src/audio_core/renderer/effect/effect_context.cpp index 7618384d4..e79b740f5 100755 --- a/src/audio_core/renderer/effect/effect_context.cpp +++ b/src/audio_core/renderer/effect/effect_context.cpp @@ -3,7 +3,7 @@ #include "audio_core/renderer/effect/effect_context.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { void EffectContext::Initialize(std::span effect_infos_, const u32 effect_count_, std::span result_states_cpu_, @@ -38,4 +38,4 @@ void EffectContext::UpdateStateByDspShared() { } } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/effect/effect_context.h b/src/audio_core/renderer/effect/effect_context.h index 839e8cb7a..e62aa2cdc 100755 --- a/src/audio_core/renderer/effect/effect_context.h +++ b/src/audio_core/renderer/effect/effect_context.h @@ -9,7 +9,7 @@ #include "audio_core/renderer/effect/effect_result_state.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { class EffectContext { public: @@ -72,4 +72,4 @@ private: size_t dsp_state_count{}; }; -} // namespace AudioCore::AudioRenderer +} // 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 fae03897d..059b708f3 100755 --- a/src/audio_core/renderer/effect/effect_info_base.h +++ b/src/audio_core/renderer/effect/effect_info_base.h @@ -12,7 +12,7 @@ #include "audio_core/renderer/memory/pool_mapper.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * Base of all effects. Holds various data and functions used for all derived effects. * Should not be used directly. @@ -432,4 +432,4 @@ protected: std::array state{}; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/effect/effect_reset.h b/src/audio_core/renderer/effect/effect_reset.h index 2181d6d30..7d4d1bdba 100755 --- a/src/audio_core/renderer/effect/effect_reset.h +++ b/src/audio_core/renderer/effect/effect_reset.h @@ -14,7 +14,7 @@ #include "audio_core/renderer/effect/reverb.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * Reset an effect, and create a new one of the given type. * @@ -68,4 +68,4 @@ static void ResetEffect(EffectInfoBase* effect, const EffectInfoBase::Type type) } } -} // namespace AudioCore::AudioRenderer +} // 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 cd6a5f854..5186437a3 100755 --- a/src/audio_core/renderer/effect/effect_result_state.h +++ b/src/audio_core/renderer/effect/effect_result_state.h @@ -7,10 +7,10 @@ #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { struct EffectResultState { std::array state; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/effect/i3dl2.cpp b/src/audio_core/renderer/effect/i3dl2.cpp index c27dac61c..896e53d7e 100755 --- a/src/audio_core/renderer/effect/i3dl2.cpp +++ b/src/audio_core/renderer/effect/i3dl2.cpp @@ -3,7 +3,7 @@ #include "audio_core/renderer/effect/i3dl2.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { void I3dl2ReverbInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params, const PoolMapper& pool_mapper) { @@ -91,4 +91,4 @@ CpuAddr I3dl2ReverbInfo::GetWorkbuffer(s32 index) { return GetSingleBuffer(index); } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/effect/i3dl2.h b/src/audio_core/renderer/effect/i3dl2.h index 5572af2a0..908e68124 100755 --- a/src/audio_core/renderer/effect/i3dl2.h +++ b/src/audio_core/renderer/effect/i3dl2.h @@ -11,7 +11,7 @@ #include "common/common_types.h" #include "common/fixed_point.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { class I3dl2ReverbInfo : public EffectInfoBase { public: @@ -198,4 +198,4 @@ public: CpuAddr GetWorkbuffer(s32 index) override; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/effect/light_limiter.cpp b/src/audio_core/renderer/effect/light_limiter.cpp index c54ff049a..fac19ff43 100755 --- a/src/audio_core/renderer/effect/light_limiter.cpp +++ b/src/audio_core/renderer/effect/light_limiter.cpp @@ -3,7 +3,7 @@ #include "audio_core/renderer/effect/light_limiter.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { void LightLimiterInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params, const PoolMapper& pool_mapper) { @@ -78,4 +78,4 @@ CpuAddr LightLimiterInfo::GetWorkbuffer(s32 index) { return GetSingleBuffer(index); } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/effect/light_limiter.h b/src/audio_core/renderer/effect/light_limiter.h index 0f37cecf8..9933fd1a3 100755 --- a/src/audio_core/renderer/effect/light_limiter.h +++ b/src/audio_core/renderer/effect/light_limiter.h @@ -11,7 +11,7 @@ #include "common/common_types.h" #include "common/fixed_point.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { class LightLimiterInfo : public EffectInfoBase { public: @@ -135,4 +135,4 @@ public: CpuAddr GetWorkbuffer(s32 index) override; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/effect/reverb.cpp b/src/audio_core/renderer/effect/reverb.cpp index bb59f49f7..34d808584 100755 --- a/src/audio_core/renderer/effect/reverb.cpp +++ b/src/audio_core/renderer/effect/reverb.cpp @@ -3,7 +3,7 @@ #include "audio_core/renderer/effect/reverb.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { void ReverbInfo::Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params, const PoolMapper& pool_mapper) { @@ -90,4 +90,4 @@ CpuAddr ReverbInfo::GetWorkbuffer(s32 index) { return GetSingleBuffer(index); } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/effect/reverb.h b/src/audio_core/renderer/effect/reverb.h index c2b3e2c35..d05ecd8b9 100755 --- a/src/audio_core/renderer/effect/reverb.h +++ b/src/audio_core/renderer/effect/reverb.h @@ -11,7 +11,7 @@ #include "common/common_types.h" #include "common/fixed_point.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { class ReverbInfo : public EffectInfoBase { public: @@ -187,4 +187,4 @@ public: CpuAddr GetWorkbuffer(s32 index) override; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/memory/address_info.h b/src/audio_core/renderer/memory/address_info.h index 81ea41056..fac579722 100755 --- a/src/audio_core/renderer/memory/address_info.h +++ b/src/audio_core/renderer/memory/address_info.h @@ -6,7 +6,7 @@ #include "audio_core/renderer/memory/memory_pool_info.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * Represents a region of mapped or unmapped memory. @@ -121,4 +121,4 @@ private: CpuAddr dsp_address; }; -} // namespace AudioCore::AudioRenderer +} // 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 7a4d86942..f3c2ff319 100755 --- a/src/audio_core/renderer/memory/memory_pool_info.cpp +++ b/src/audio_core/renderer/memory/memory_pool_info.cpp @@ -3,7 +3,7 @@ #include "audio_core/renderer/memory/memory_pool_info.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { CpuAddr MemoryPoolInfo::GetCpuAddress() const { return cpu_address; @@ -58,4 +58,4 @@ bool MemoryPoolInfo::IsUsed() const { return in_use; } -} // namespace AudioCore::AudioRenderer +} // 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 2f6fb6910..77ac7ac4e 100755 --- a/src/audio_core/renderer/memory/memory_pool_info.h +++ b/src/audio_core/renderer/memory/memory_pool_info.h @@ -8,7 +8,7 @@ #include "audio_core/common/common.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * CPU pools are mapped in user memory with the supplied process_handle (see PoolMapper). */ @@ -167,4 +167,4 @@ private: bool in_use{}; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/memory/pool_mapper.cpp b/src/audio_core/renderer/memory/pool_mapper.cpp index 387313b26..4016a1367 100755 --- a/src/audio_core/renderer/memory/pool_mapper.cpp +++ b/src/audio_core/renderer/memory/pool_mapper.cpp @@ -6,7 +6,7 @@ #include "core/hle/kernel/k_process.h" #include "core/hle/kernel/svc.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { PoolMapper::PoolMapper(u32 process_handle_, bool force_map_) : process_handle{process_handle_}, force_map{force_map_} {} @@ -240,4 +240,4 @@ bool PoolMapper::InitializeSystemPool(MemoryPoolInfo& pool, const u8* memory, } } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/memory/pool_mapper.h b/src/audio_core/renderer/memory/pool_mapper.h index f86b4c34f..ce98f6da6 100755 --- a/src/audio_core/renderer/memory/pool_mapper.h +++ b/src/audio_core/renderer/memory/pool_mapper.h @@ -10,7 +10,7 @@ #include "common/common_types.h" #include "core/hle/service/audio/errors.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { class AddressInfo; /** @@ -176,4 +176,4 @@ private: bool force_map; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/mix/mix_context.cpp b/src/audio_core/renderer/mix/mix_context.cpp index 53bed40e2..b1272a247 100755 --- a/src/audio_core/renderer/mix/mix_context.cpp +++ b/src/audio_core/renderer/mix/mix_context.cpp @@ -7,7 +7,7 @@ #include "audio_core/renderer/splitter/splitter_context.h" #include "common/polyfill_ranges.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { void MixContext::Initialize(std::span sorted_mix_infos_, std::span mix_infos_, const u32 count_, std::span effect_process_order_buffer_, @@ -139,4 +139,4 @@ EdgeMatrix& MixContext::GetEdgeMatrix() { return edge_matrix; } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/mix/mix_context.h b/src/audio_core/renderer/mix/mix_context.h index 4762b4ff7..d83f40e97 100755 --- a/src/audio_core/renderer/mix/mix_context.h +++ b/src/audio_core/renderer/mix/mix_context.h @@ -10,7 +10,7 @@ #include "audio_core/renderer/nodes/node_states.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { class SplitterContext; /* @@ -121,4 +121,4 @@ private: EdgeMatrix edge_matrix{}; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/mix/mix_info.cpp b/src/audio_core/renderer/mix/mix_info.cpp index 4d32438bd..fcda323a9 100755 --- a/src/audio_core/renderer/mix/mix_info.cpp +++ b/src/audio_core/renderer/mix/mix_info.cpp @@ -7,7 +7,7 @@ #include "audio_core/renderer/nodes/edge_matrix.h" #include "audio_core/renderer/splitter/splitter_context.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { MixInfo::MixInfo(std::span effect_order_buffer_, s32 effect_count_, BehaviorInfo& behavior) : effect_order_buffer{effect_order_buffer_}, effect_count{effect_count_}, @@ -117,4 +117,4 @@ bool MixInfo::HasAnyConnection() const { return dst_mix_id != UnusedMixId || dst_splitter_id != UnusedSplitterId; } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/mix/mix_info.h b/src/audio_core/renderer/mix/mix_info.h index b008a68bc..0f004d3ae 100755 --- a/src/audio_core/renderer/mix/mix_info.h +++ b/src/audio_core/renderer/mix/mix_info.h @@ -9,7 +9,7 @@ #include "audio_core/common/common.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { class EdgeMatrix; class SplitterContext; class EffectContext; @@ -121,4 +121,4 @@ public: const bool long_size_pre_delay_supported; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/nodes/bit_array.h b/src/audio_core/renderer/nodes/bit_array.h index e808da48a..182ba4615 100755 --- a/src/audio_core/renderer/nodes/bit_array.h +++ b/src/audio_core/renderer/nodes/bit_array.h @@ -7,7 +7,7 @@ #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * Represents an array of bits used for nodes and edges for the mixing graph. */ @@ -22,4 +22,4 @@ struct BitArray { u32 size{}; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/nodes/edge_matrix.cpp b/src/audio_core/renderer/nodes/edge_matrix.cpp index 3e3f9cea7..50271fd0e 100755 --- a/src/audio_core/renderer/nodes/edge_matrix.cpp +++ b/src/audio_core/renderer/nodes/edge_matrix.cpp @@ -3,7 +3,7 @@ #include "audio_core/renderer/nodes/edge_matrix.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { void EdgeMatrix::Initialize([[maybe_unused]] std::span buffer, [[maybe_unused]] const u64 node_buffer_size, const u32 count_) { @@ -35,4 +35,4 @@ u32 EdgeMatrix::GetNodeCount() const { return count; } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/nodes/edge_matrix.h b/src/audio_core/renderer/nodes/edge_matrix.h index f15311425..b6a249969 100755 --- a/src/audio_core/renderer/nodes/edge_matrix.h +++ b/src/audio_core/renderer/nodes/edge_matrix.h @@ -9,7 +9,7 @@ #include "common/alignment.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * An edge matrix, holding the connections for each node to every other node in the graph. */ @@ -79,4 +79,4 @@ private: u32 count; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/nodes/node_states.cpp b/src/audio_core/renderer/nodes/node_states.cpp index f1d704012..4da00ace2 100755 --- a/src/audio_core/renderer/nodes/node_states.cpp +++ b/src/audio_core/renderer/nodes/node_states.cpp @@ -4,7 +4,7 @@ #include "audio_core/renderer/nodes/node_states.h" #include "common/logging/log.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { void NodeStates::Initialize(std::span buffer_, [[maybe_unused]] const u64 node_buffer_size, const u32 count) { @@ -138,4 +138,4 @@ std::pair::reverse_iterator, size_t> NodeStates::GetSortedResuls( return {results.rbegin(), result_pos}; } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/nodes/node_states.h b/src/audio_core/renderer/nodes/node_states.h index 9869e6ab1..d7f0988de 100755 --- a/src/audio_core/renderer/nodes/node_states.h +++ b/src/audio_core/renderer/nodes/node_states.h @@ -10,7 +10,7 @@ #include "common/alignment.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * Graph utility functions for sorting and getting results from the DAG. */ @@ -192,4 +192,4 @@ private: Stack stack{}; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/performance/detail_aspect.cpp b/src/audio_core/renderer/performance/detail_aspect.cpp index 72a4e0799..1b19488f4 100755 --- a/src/audio_core/renderer/performance/detail_aspect.cpp +++ b/src/audio_core/renderer/performance/detail_aspect.cpp @@ -5,7 +5,7 @@ #include "audio_core/renderer/command/command_generator.h" #include "audio_core/renderer/performance/detail_aspect.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { DetailAspect::DetailAspect(CommandGenerator& command_generator_, const PerformanceEntryType entry_type, const s32 node_id_, @@ -22,4 +22,4 @@ DetailAspect::DetailAspect(CommandGenerator& command_generator_, } } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/performance/detail_aspect.h b/src/audio_core/renderer/performance/detail_aspect.h index 279cd623e..7edeb3226 100755 --- a/src/audio_core/renderer/performance/detail_aspect.h +++ b/src/audio_core/renderer/performance/detail_aspect.h @@ -7,7 +7,7 @@ #include "audio_core/renderer/performance/performance_manager.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { class CommandGenerator; /** @@ -29,4 +29,4 @@ public: s32 node_id; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/performance/entry_aspect.cpp b/src/audio_core/renderer/performance/entry_aspect.cpp index 41648e4d0..4c10ec501 100755 --- a/src/audio_core/renderer/performance/entry_aspect.cpp +++ b/src/audio_core/renderer/performance/entry_aspect.cpp @@ -5,7 +5,7 @@ #include "audio_core/renderer/command/command_generator.h" #include "audio_core/renderer/performance/entry_aspect.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { EntryAspect::EntryAspect(CommandGenerator& command_generator_, const PerformanceEntryType type, const s32 node_id_) @@ -20,4 +20,4 @@ EntryAspect::EntryAspect(CommandGenerator& command_generator_, const Performance } } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/performance/entry_aspect.h b/src/audio_core/renderer/performance/entry_aspect.h index 8fffb8a95..395eecd40 100755 --- a/src/audio_core/renderer/performance/entry_aspect.h +++ b/src/audio_core/renderer/performance/entry_aspect.h @@ -7,7 +7,7 @@ #include "audio_core/renderer/performance/performance_manager.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { class CommandGenerator; /** @@ -28,4 +28,4 @@ public: s32 node_id; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/performance/performance_detail.h b/src/audio_core/renderer/performance/performance_detail.h index e967fb4fe..ae4aea2b3 100755 --- a/src/audio_core/renderer/performance/performance_detail.h +++ b/src/audio_core/renderer/performance/performance_detail.h @@ -6,7 +6,7 @@ #include "audio_core/renderer/performance/performance_entry.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { enum class PerformanceDetailType : u8 { Invalid, @@ -47,4 +47,4 @@ struct PerformanceDetailVersion2 { static_assert(sizeof(PerformanceDetailVersion2) == 0x18, "PerformanceDetailVersion2 has the wrong size!"); -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/performance/performance_entry.h b/src/audio_core/renderer/performance/performance_entry.h index 841a59005..06a72b25d 100755 --- a/src/audio_core/renderer/performance/performance_entry.h +++ b/src/audio_core/renderer/performance/performance_entry.h @@ -5,7 +5,7 @@ #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { enum class PerformanceEntryType : u8 { Invalid, @@ -34,4 +34,4 @@ struct PerformanceEntryVersion2 { static_assert(sizeof(PerformanceEntryVersion2) == 0x18, "PerformanceEntryVersion2 has the wrong size!"); -} // namespace AudioCore::AudioRenderer +} // 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 db5a61499..dab1d34ec 100755 --- a/src/audio_core/renderer/performance/performance_entry_addresses.h +++ b/src/audio_core/renderer/performance/performance_entry_addresses.h @@ -5,7 +5,7 @@ #include "audio_core/common/common.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { struct PerformanceEntryAddresses { CpuAddr translated_address; @@ -14,4 +14,4 @@ struct PerformanceEntryAddresses { CpuAddr entry_processed_time_offset; }; -} // namespace AudioCore::AudioRenderer +} // 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 ba11bc294..224193cf9 100755 --- a/src/audio_core/renderer/performance/performance_frame_header.h +++ b/src/audio_core/renderer/performance/performance_frame_header.h @@ -5,7 +5,7 @@ #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { struct PerformanceFrameHeaderVersion1 { /* 0x00 */ u32 magic; // "PERF" @@ -33,4 +33,4 @@ struct PerformanceFrameHeaderVersion2 { static_assert(sizeof(PerformanceFrameHeaderVersion2) == 0x30, "PerformanceFrameHeaderVersion2 has the wrong size!"); -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/performance/performance_manager.cpp b/src/audio_core/renderer/performance/performance_manager.cpp index 7f49993eb..5915bc69a 100755 --- a/src/audio_core/renderer/performance/performance_manager.cpp +++ b/src/audio_core/renderer/performance/performance_manager.cpp @@ -6,7 +6,7 @@ #include "audio_core/renderer/performance/performance_manager.h" #include "common/common_funcs.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { void PerformanceManager::CreateImpl(const size_t version) { switch (version) { @@ -643,4 +643,4 @@ void PerformanceManagerImpl sink_infos_, const u32 sink_count_) { sink_infos = sink_infos_; @@ -18,4 +18,4 @@ u32 SinkContext::GetCount() const { return sink_count; } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/sink/sink_context.h b/src/audio_core/renderer/sink/sink_context.h index 6ef594993..9654f117f 100755 --- a/src/audio_core/renderer/sink/sink_context.h +++ b/src/audio_core/renderer/sink/sink_context.h @@ -8,7 +8,7 @@ #include "audio_core/renderer/sink/sink_info_base.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * Manages output sinks. */ @@ -44,4 +44,4 @@ private: u32 sink_count{}; }; -} // namespace AudioCore::AudioRenderer +} // 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 973cec938..70750eb3b 100755 --- a/src/audio_core/renderer/sink/sink_info_base.cpp +++ b/src/audio_core/renderer/sink/sink_info_base.cpp @@ -4,7 +4,7 @@ #include "audio_core/renderer/memory/pool_mapper.h" #include "audio_core/renderer/sink/sink_info_base.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { void SinkInfoBase::CleanUp() { type = Type::Invalid; @@ -48,4 +48,4 @@ u8* SinkInfoBase::GetParameter() { return parameter.data(); } -} // namespace AudioCore::AudioRenderer +} // 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 c1af31c11..d179170e4 100755 --- a/src/audio_core/renderer/sink/sink_info_base.h +++ b/src/audio_core/renderer/sink/sink_info_base.h @@ -11,7 +11,7 @@ #include "common/common_types.h" #include "common/fixed_point.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { struct UpsamplerInfo; class PoolMapper; @@ -174,4 +174,4 @@ protected: parameter{}; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/splitter/splitter_context.cpp b/src/audio_core/renderer/splitter/splitter_context.cpp index 8d5c67342..0e9b397ab 100755 --- a/src/audio_core/renderer/splitter/splitter_context.cpp +++ b/src/audio_core/renderer/splitter/splitter_context.cpp @@ -7,7 +7,7 @@ #include "audio_core/renderer/splitter/splitter_context.h" #include "common/alignment.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { SplitterDestinationData* SplitterContext::GetDesintationData(const s32 splitter_id, const s32 destination_id) { @@ -214,4 +214,4 @@ u64 SplitterContext::CalcWorkBufferSize(const BehaviorInfo& behavior, return size; } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/splitter/splitter_context.h b/src/audio_core/renderer/splitter/splitter_context.h index 4e463430b..9f72f5ad9 100755 --- a/src/audio_core/renderer/splitter/splitter_context.h +++ b/src/audio_core/renderer/splitter/splitter_context.h @@ -13,7 +13,7 @@ namespace AudioCore { struct AudioRendererParameterInternal; class WorkbufferAllocator; -namespace AudioRenderer { +namespace Renderer { class BehaviorInfo; /** @@ -185,5 +185,5 @@ private: bool splitter_bug_fixed{}; }; -} // namespace AudioRenderer +} // namespace Renderer } // 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 c277ad1ef..9f42c58e8 100755 --- a/src/audio_core/renderer/splitter/splitter_destinations_data.cpp +++ b/src/audio_core/renderer/splitter/splitter_destinations_data.cpp @@ -3,7 +3,7 @@ #include "audio_core/renderer/splitter/splitter_destinations_data.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { SplitterDestinationData::SplitterDestinationData(const s32 id_) : id{id_} {} @@ -84,4 +84,4 @@ void SplitterDestinationData::SetNext(SplitterDestinationData* next_) { next = next_; } -} // namespace AudioCore::AudioRenderer +} // 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 e08f190c3..c25f1c7c4 100755 --- a/src/audio_core/renderer/splitter/splitter_destinations_data.h +++ b/src/audio_core/renderer/splitter/splitter_destinations_data.h @@ -9,7 +9,7 @@ #include "audio_core/common/common.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * Represents a mixing node, can be connected to a previous and next destination forming a chain * that a certain mix buffer will pass through to output. @@ -132,4 +132,4 @@ private: bool need_update{}; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/splitter/splitter_info.cpp b/src/audio_core/renderer/splitter/splitter_info.cpp index 4d5a842b8..53556f22a 100755 --- a/src/audio_core/renderer/splitter/splitter_info.cpp +++ b/src/audio_core/renderer/splitter/splitter_info.cpp @@ -3,7 +3,7 @@ #include "audio_core/renderer/splitter/splitter_info.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { SplitterInfo::SplitterInfo(const s32 id_) : id{id_} {} @@ -76,4 +76,4 @@ void SplitterInfo::SetDestinations(SplitterDestinationData* destinations_) { destinations = destinations_; } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/splitter/splitter_info.h b/src/audio_core/renderer/splitter/splitter_info.h index 1ea22dc92..46e851922 100755 --- a/src/audio_core/renderer/splitter/splitter_info.h +++ b/src/audio_core/renderer/splitter/splitter_info.h @@ -6,7 +6,7 @@ #include "audio_core/renderer/splitter/splitter_destinations_data.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * Represents a splitter, wraps multiple output destinations to split an input mix into. */ @@ -104,4 +104,4 @@ private: u32 channel_count{}; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/system.cpp b/src/audio_core/renderer/system.cpp index faa91d8fa..011287aa5 100755 --- a/src/audio_core/renderer/system.cpp +++ b/src/audio_core/renderer/system.cpp @@ -4,12 +4,13 @@ #include #include +#include "audio_core/adsp/apps/audio_renderer/audio_renderer.h" +#include "audio_core/adsp/apps/audio_renderer/command_buffer.h" #include "audio_core/audio_core.h" #include "audio_core/common/audio_renderer_parameter.h" #include "audio_core/common/common.h" #include "audio_core/common/feature_support.h" #include "audio_core/common/workbuffer_allocator.h" -#include "audio_core/renderer/adsp/adsp.h" #include "audio_core/renderer/behavior/info_updater.h" #include "audio_core/renderer/command/command_buffer.h" #include "audio_core/renderer/command/command_generator.h" @@ -34,7 +35,7 @@ #include "core/hle/kernel/k_transfer_memory.h" #include "core/memory.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { u64 System::GetWorkBufferSize(const AudioRendererParameterInternal& params) { BehaviorInfo behavior; @@ -95,7 +96,8 @@ u64 System::GetWorkBufferSize(const AudioRendererParameterInternal& params) { } System::System(Core::System& core_, Kernel::KEvent* adsp_rendered_event_) - : core{core_}, adsp{core.AudioCore().GetADSP()}, adsp_rendered_event{adsp_rendered_event_} {} + : core{core_}, audio_renderer{core.AudioCore().ADSP().AudioRenderer()}, + adsp_rendered_event{adsp_rendered_event_} {} Result System::Initialize(const AudioRendererParameterInternal& params, Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size, @@ -443,7 +445,7 @@ void System::Stop() { Result System::Update(std::span input, std::span performance, std::span output) { std::scoped_lock l{lock}; - const auto start_time{core.CoreTiming().GetClockTicks()}; + const auto start_time{core.CoreTiming().GetGlobalTimeNs().count()}; std::memset(output.data(), 0, output.size()); InfoUpdater info_updater(input, output, process_handle, behavior); @@ -535,7 +537,7 @@ Result System::Update(std::span input, std::span performance, std: adsp_rendered_event->Clear(); num_times_updated++; - const auto end_time{core.CoreTiming().GetClockTicks()}; + const auto end_time{core.CoreTiming().GetGlobalTimeNs().count()}; ticks_spent_updating += end_time - start_time; return ResultSuccess; @@ -583,7 +585,7 @@ void System::SendCommandToDsp() { if (initialized) { if (active) { terminate_event.Reset(); - const auto remaining_command_count{adsp.GetRemainCommandCount(session_id)}; + const auto remaining_command_count{audio_renderer.GetRemainCommandCount(session_id)}; u64 command_size{0}; if (remaining_command_count) { @@ -607,26 +609,24 @@ void System::SendCommandToDsp() { time_limit_percent = 70.0f; } - ADSP::CommandBuffer command_buffer{ + AudioRenderer::CommandBuffer command_buffer{ .buffer{translated_addr}, .size{command_size}, .time_limit{ static_cast((time_limit_percent / 100) * 2'880'000.0 * (static_cast(render_time_limit_percent) / 100.0f))}, - .remaining_command_count{remaining_command_count}, - .reset_buffers{reset_command_buffers}, .applet_resource_user_id{applet_resource_user_id}, - .render_time_taken{adsp.GetRenderTimeTaken(session_id)}, + .reset_buffer{reset_command_buffers}, }; - adsp.SendCommandBuffer(session_id, command_buffer); + audio_renderer.SetCommandBuffer(session_id, command_buffer); reset_command_buffers = false; command_buffer_size = command_size; if (remaining_command_count == 0) { adsp_rendered_event->Signal(); } } else { - adsp.ClearRemainCount(session_id); + audio_renderer.ClearRemainCommandCount(session_id); terminate_event.Set(); } } @@ -635,7 +635,7 @@ void System::SendCommandToDsp() { u64 System::GenerateCommand(std::span in_command_buffer, [[maybe_unused]] u64 command_buffer_size_) { PoolMapper::ClearUseState(memory_pool_workbuffer, memory_pool_count); - const auto start_time{core.CoreTiming().GetClockTicks()}; + const auto start_time{core.CoreTiming().GetGlobalTimeNs().count()}; auto command_list_header{reinterpret_cast(in_command_buffer.data())}; @@ -732,10 +732,10 @@ u64 System::GenerateCommand(std::span in_command_buffer, effect_context.UpdateStateByDspShared(); } - const auto end_time{core.CoreTiming().GetClockTicks()}; + const auto end_time{core.CoreTiming().GetGlobalTimeNs().count()}; total_ticks_elapsed += end_time - start_time; num_command_lists_generated++; - render_start_tick = adsp.GetRenderingStartTick(session_id); + render_start_tick = audio_renderer.GetRenderingStartTick(session_id); frames_elapsed++; return command_buffer.size; @@ -819,4 +819,4 @@ u32 System::DropVoices(CommandBuffer& command_buffer, u32 estimated_process_time return voices_dropped; } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/system.h b/src/audio_core/renderer/system.h index 0a786be45..4c3afd345 100755 --- a/src/audio_core/renderer/system.h +++ b/src/audio_core/renderer/system.h @@ -34,12 +34,16 @@ class KTransferMemory; namespace AudioCore { struct AudioRendererParameterInternal; - -namespace AudioRenderer { -class CommandBuffer; namespace ADSP { class ADSP; +namespace AudioRenderer { +class AudioRenderer; } +} // namespace ADSP + +namespace Renderer { +using namespace ::AudioCore::ADSP; +class CommandBuffer; /** * Audio Renderer System, the main worker for audio rendering. @@ -213,8 +217,8 @@ public: private: /// Core system Core::System& core; - /// Reference to the ADSP for communication - ADSP::ADSP& adsp; + /// Reference to the ADSP's AudioRenderer for communication + ::AudioCore::ADSP::AudioRenderer::AudioRenderer& audio_renderer; /// Is this system initialized? bool initialized{}; /// Is this system currently active? @@ -319,5 +323,5 @@ private: f32 drop_voice_param{1.0f}; }; -} // namespace AudioRenderer +} // namespace Renderer } // namespace AudioCore diff --git a/src/audio_core/renderer/system_manager.cpp b/src/audio_core/renderer/system_manager.cpp index ee9a416fa..b4d1a1f0d 100755 --- a/src/audio_core/renderer/system_manager.cpp +++ b/src/audio_core/renderer/system_manager.cpp @@ -3,8 +3,8 @@ #include +#include "audio_core/adsp/adsp.h" #include "audio_core/audio_core.h" -#include "audio_core/renderer/adsp/adsp.h" #include "audio_core/renderer/system_manager.h" #include "common/microprofile.h" #include "common/thread.h" @@ -14,24 +14,21 @@ MICROPROFILE_DEFINE(Audio_RenderSystemManager, "Audio", "Render System Manager", MP_RGB(60, 19, 97)); -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { SystemManager::SystemManager(Core::System& core_) - : core{core_}, adsp{core.AudioCore().GetADSP()}, mailbox{adsp.GetRenderMailbox()} {} + : core{core_}, audio_renderer{core.AudioCore().ADSP().AudioRenderer()} {} SystemManager::~SystemManager() { Stop(); } -bool SystemManager::InitializeUnsafe() { +void SystemManager::InitializeUnsafe() { if (!active) { - if (adsp.Start()) { - active = true; - thread = std::jthread([this](std::stop_token stop_token) { ThreadFunc(stop_token); }); - } + active = true; + audio_renderer.Start(); + thread = std::jthread([this](std::stop_token stop_token) { ThreadFunc(stop_token); }); } - - return adsp.GetState() == ADSP::State::Started; } void SystemManager::Stop() { @@ -41,7 +38,7 @@ void SystemManager::Stop() { active = false; thread.request_stop(); thread.join(); - adsp.Stop(); + audio_renderer.Stop(); } bool SystemManager::Add(System& system_) { @@ -55,10 +52,7 @@ bool SystemManager::Add(System& system_) { { std::scoped_lock l{mutex1}; if (systems.empty()) { - if (!InitializeUnsafe()) { - LOG_ERROR(Service_Audio, "Failed to start the AudioRenderer SystemManager"); - return false; - } + InitializeUnsafe(); } } @@ -100,9 +94,9 @@ void SystemManager::ThreadFunc(std::stop_token stop_token) { } } - adsp.Signal(); - adsp.Wait(); + audio_renderer.Signal(); + audio_renderer.Wait(); } } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/system_manager.h b/src/audio_core/renderer/system_manager.h index 1e14102ec..61af485b1 100755 --- a/src/audio_core/renderer/system_manager.h +++ b/src/audio_core/renderer/system_manager.h @@ -18,11 +18,14 @@ struct EventType; class System; } // namespace Core -namespace AudioCore::AudioRenderer { -namespace ADSP { +namespace AudioCore::ADSP { class ADSP; -class AudioRenderer_Mailbox; -} // namespace ADSP +namespace AudioRenderer { +class AudioRenderer; +} // namespace AudioRenderer +} // namespace AudioCore::ADSP + +namespace AudioCore::Renderer { /** * Manages all audio renderers, responsible for triggering command list generation and signalling @@ -38,7 +41,7 @@ public: * * @return True if successfully initialized, otherwise false. */ - bool InitializeUnsafe(); + void InitializeUnsafe(); /** * Stop the system manager. @@ -80,10 +83,8 @@ private: std::mutex mutex2{}; /// Is the system manager thread active? std::atomic active{}; - /// Reference to the ADSP for communication - ADSP::ADSP& adsp; - /// AudioRenderer mailbox for communication - ADSP::AudioRenderer_Mailbox* mailbox{}; + /// Reference to the ADSP's AudioRenderer for communication + ::AudioCore::ADSP::AudioRenderer::AudioRenderer& audio_renderer; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/upsampler/upsampler_info.h b/src/audio_core/renderer/upsampler/upsampler_info.h index d651321f5..e9ea92a5b 100755 --- a/src/audio_core/renderer/upsampler/upsampler_info.h +++ b/src/audio_core/renderer/upsampler/upsampler_info.h @@ -9,7 +9,7 @@ #include "audio_core/renderer/upsampler/upsampler_state.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { class UpsamplerManager; /** @@ -32,4 +32,4 @@ struct UpsamplerInfo { std::array inputs{}; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/upsampler/upsampler_manager.cpp b/src/audio_core/renderer/upsampler/upsampler_manager.cpp index 3a84190b0..c659f0765 100755 --- a/src/audio_core/renderer/upsampler/upsampler_manager.cpp +++ b/src/audio_core/renderer/upsampler/upsampler_manager.cpp @@ -3,7 +3,7 @@ #include "audio_core/renderer/upsampler/upsampler_manager.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { UpsamplerManager::UpsamplerManager(const u32 count_, std::span infos_, std::span workbuffer_) @@ -41,4 +41,4 @@ void UpsamplerManager::Free(UpsamplerInfo* info) { info->enabled = false; } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/upsampler/upsampler_manager.h b/src/audio_core/renderer/upsampler/upsampler_manager.h index 5c1ca5c8f..ac7b85607 100755 --- a/src/audio_core/renderer/upsampler/upsampler_manager.h +++ b/src/audio_core/renderer/upsampler/upsampler_manager.h @@ -9,7 +9,7 @@ #include "audio_core/renderer/upsampler/upsampler_info.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * Manages and has utility functions for upsampler infos. */ @@ -42,4 +42,4 @@ private: std::mutex lock{}; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/upsampler/upsampler_state.h b/src/audio_core/renderer/upsampler/upsampler_state.h index ecba93bba..45691a3ca 100755 --- a/src/audio_core/renderer/upsampler/upsampler_state.h +++ b/src/audio_core/renderer/upsampler/upsampler_state.h @@ -8,7 +8,7 @@ #include "common/common_types.h" #include "common/fixed_point.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * Upsampling state used by the AudioRenderer across calls. */ @@ -37,4 +37,4 @@ struct UpsamplerState { u8 sample_index; }; -} // namespace AudioCore::AudioRenderer +} // 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 a5561659d..83d8b38f0 100755 --- a/src/audio_core/renderer/voice/voice_channel_resource.h +++ b/src/audio_core/renderer/voice/voice_channel_resource.h @@ -8,7 +8,7 @@ #include "audio_core/common/common.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * Represents one channel for mixing a voice. */ @@ -35,4 +35,4 @@ public: bool in_use{}; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/voice/voice_context.cpp b/src/audio_core/renderer/voice/voice_context.cpp index d8d0aa0dd..2a02d6657 100755 --- a/src/audio_core/renderer/voice/voice_context.cpp +++ b/src/audio_core/renderer/voice/voice_context.cpp @@ -6,7 +6,7 @@ #include "audio_core/renderer/voice/voice_context.h" #include "common/polyfill_ranges.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { VoiceState& VoiceContext::GetDspSharedState(const u32 index) { if (index >= dsp_states.size()) { @@ -84,4 +84,4 @@ void VoiceContext::UpdateStateByDspShared() { std::memcpy(cpu_states.data(), dsp_states.data(), voice_count * sizeof(VoiceState)); } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/voice/voice_context.h b/src/audio_core/renderer/voice/voice_context.h index ccf47fc69..9252016ed 100755 --- a/src/audio_core/renderer/voice/voice_context.h +++ b/src/audio_core/renderer/voice/voice_context.h @@ -10,7 +10,7 @@ #include "audio_core/renderer/voice/voice_state.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * Contains all voices, with utility functions for managing them. */ @@ -123,4 +123,4 @@ private: u32 active_count{}; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/voice/voice_info.cpp b/src/audio_core/renderer/voice/voice_info.cpp index 0b2f9656b..2d60ae9f4 100755 --- a/src/audio_core/renderer/voice/voice_info.cpp +++ b/src/audio_core/renderer/voice/voice_info.cpp @@ -6,7 +6,7 @@ #include "audio_core/renderer/voice/voice_info.h" #include "audio_core/renderer/voice/voice_state.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { VoiceInfo::VoiceInfo() { Initialize(); @@ -405,4 +405,4 @@ void VoiceInfo::ResetResources(VoiceContext& voice_context) const { } } -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/voice/voice_info.h b/src/audio_core/renderer/voice/voice_info.h index a4b4a8b83..f87ddd99b 100755 --- a/src/audio_core/renderer/voice/voice_info.h +++ b/src/audio_core/renderer/voice/voice_info.h @@ -12,7 +12,7 @@ #include "audio_core/renderer/memory/address_info.h" #include "common/common_types.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { class PoolMapper; class VoiceContext; struct VoiceState; @@ -377,4 +377,4 @@ public: u8 flush_buffer_count{}; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/audio_core/renderer/voice/voice_state.h b/src/audio_core/renderer/voice/voice_state.h index b6552c381..6c03df02b 100755 --- a/src/audio_core/renderer/voice/voice_state.h +++ b/src/audio_core/renderer/voice/voice_state.h @@ -9,7 +9,7 @@ #include "common/common_types.h" #include "common/fixed_point.h" -namespace AudioCore::AudioRenderer { +namespace AudioCore::Renderer { /** * Holds a state for a voice. One is kept host-side, and one is used by the AudioRenderer, * host-side is updated on the next iteration. @@ -67,4 +67,4 @@ struct VoiceState { s32 loop_count; }; -} // namespace AudioCore::AudioRenderer +} // namespace AudioCore::Renderer diff --git a/src/common/settings.h b/src/common/settings.h index d67c4b0fa..d64f3e730 100755 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -349,7 +349,8 @@ struct Values { Category::RendererDebug}; Setting disable_shader_loop_safety_checks{ linkage, false, "disable_shader_loop_safety_checks", Category::RendererDebug}; - bool graphics_AMD_workaround{}; // TODO: remove me once amd supports VK_EXT_depth_bias_control + // TODO: remove this once AMDVLK supports VK_EXT_depth_bias_control + bool renderer_amdvlk_depth_bias_workaround{}; // System SwitchableSetting language_index{linkage, diff --git a/src/core/core.cpp b/src/core/core.cpp index 48a00f5b3..a04f6371b 100755 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -377,8 +377,8 @@ struct System::Impl { } // Workarounds: - // Activate this in Super Smash Brothers, it only affects AMD cards using AMDVLK - Settings::values.graphics_AMD_workaround = program_id == 0x1006A800016E000ULL; + // Activate this in Super Smash Brothers Ultimate, it only affects AMD cards using AMDVLK + Settings::values.renderer_amdvlk_depth_bias_workaround = program_id == 0x1006A800016E000ULL; status = SystemResultStatus::Success; return status; @@ -440,7 +440,7 @@ struct System::Impl { } // Workarounds - Settings::values.graphics_AMD_workaround = false; + Settings::values.renderer_amdvlk_depth_bias_workaround = false; LOG_DEBUG(Core, "Shutdown OK"); } diff --git a/src/core/hle/service/audio/audin_u.cpp b/src/core/hle/service/audio/audin_u.cpp index 7d34db8cc..f1cd77c2d 100755 --- 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_) AudInU::~AudInU() = default; void AudInU::ListAudioIns(HLERequestContext& ctx) { - using namespace AudioCore::AudioRenderer; + using namespace AudioCore::Renderer; LOG_DEBUG(Service_Audio, "called"); @@ -240,7 +240,7 @@ void AudInU::ListAudioIns(HLERequestContext& ctx) { } void AudInU::ListAudioInsAutoFiltered(HLERequestContext& ctx) { - using namespace AudioCore::AudioRenderer; + using namespace AudioCore::Renderer; LOG_DEBUG(Service_Audio, "called"); diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp index 3598ba41b..e505b286e 100755 --- 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_) AudOutU::~AudOutU() = default; void AudOutU::ListAudioOuts(HLERequestContext& ctx) { - using namespace AudioCore::AudioRenderer; + using namespace AudioCore::Renderer; std::scoped_lock l{impl->mutex}; diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index 3f7639e26..f5077560c 100755 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp @@ -26,7 +26,7 @@ #include "core/hle/service/ipc_helpers.h" #include "core/memory.h" -using namespace AudioCore::AudioRenderer; +using namespace AudioCore::Renderer; namespace Service::Audio { diff --git a/src/core/hle/service/audio/audren_u.h b/src/core/hle/service/audio/audren_u.h index 8277be584..24efa16c9 100755 --- a/src/core/hle/service/audio/audren_u.h +++ b/src/core/hle/service/audio/audren_u.h @@ -28,7 +28,7 @@ private: void GetAudioDeviceServiceWithRevisionInfo(HLERequestContext& ctx); KernelHelpers::ServiceContext service_context; - std::unique_ptr impl; + std::unique_ptr impl; u32 num_audio_devices{0}; }; diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp index e32568b41..ef53007bc 100755 --- a/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp @@ -204,9 +204,7 @@ Id TextureImage(EmitContext& ctx, IR::TextureInstInfo info, const IR::Value& ind if (def.count > 1) { throw NotImplementedException("Indirect texture sample"); } - const Id sampler_id{def.id}; - const Id id{ctx.OpLoad(ctx.sampled_texture_buffer_type, sampler_id)}; - return ctx.OpImage(ctx.image_buffer_type, id); + return ctx.OpLoad(ctx.image_buffer_type, def.id); } else { const TextureDefinition& def{ctx.textures.at(info.descriptor_index)}; if (def.count > 1) { diff --git a/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp b/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp index fec13567e..8baaff063 100755 --- a/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp +++ b/src/shader_recompiler/backend/spirv/spirv_emit_context.cpp @@ -1242,9 +1242,8 @@ void EmitContext::DefineTextureBuffers(const Info& info, u32& binding) { } const spv::ImageFormat format{spv::ImageFormat::Unknown}; image_buffer_type = TypeImage(F32[1], spv::Dim::Buffer, 0U, false, false, 1, format); - sampled_texture_buffer_type = TypeSampledImage(image_buffer_type); - const Id type{TypePointer(spv::StorageClass::UniformConstant, sampled_texture_buffer_type)}; + const Id type{TypePointer(spv::StorageClass::UniformConstant, image_buffer_type)}; texture_buffers.reserve(info.texture_buffer_descriptors.size()); for (const TextureBufferDescriptor& desc : info.texture_buffer_descriptors) { if (desc.count != 1) { diff --git a/src/shader_recompiler/backend/spirv/spirv_emit_context.h b/src/shader_recompiler/backend/spirv/spirv_emit_context.h index 2fac3a13e..5925e0af1 100755 --- a/src/shader_recompiler/backend/spirv/spirv_emit_context.h +++ b/src/shader_recompiler/backend/spirv/spirv_emit_context.h @@ -206,7 +206,6 @@ public: Id output_u32{}; Id image_buffer_type{}; - Id sampled_texture_buffer_type{}; Id image_u32{}; std::array cbufs{}; diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 1df994d37..482dd8aec 100755 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -1021,7 +1021,7 @@ void RasterizerVulkan::UpdateDepthBias(Tegra::Engines::Maxwell3D::Regs& regs) { if (device.IsExtDepthBiasControlSupported()) { return true; } - if (!Settings::values.graphics_AMD_workaround) { + if (!Settings::values.renderer_amdvlk_depth_bias_workaround) { return false; } // the base formulas can be obtained from here: diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 60515ed9a..4a39bc34a 100755 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -2280,40 +2280,62 @@ void GMainWindow::OnTransferableShaderCacheOpenFile(u64 program_id) { QDesktopServices::openUrl(QUrl::fromLocalFile(qt_shader_cache_path)); } -static std::size_t CalculateRomFSEntrySize(const FileSys::VirtualDir& dir, bool full) { - std::size_t out = 0; - - for (const auto& subdir : dir->GetSubdirectories()) { - out += 1 + CalculateRomFSEntrySize(subdir, full); - } - - return out + (full ? dir->GetFiles().size() : 0); -} - -static bool RomFSRawCopy(QProgressDialog& dialog, const FileSys::VirtualDir& src, - const FileSys::VirtualDir& dest, std::size_t block_size, bool full) { +static bool RomFSRawCopy(size_t total_size, size_t& read_size, QProgressDialog& dialog, + const FileSys::VirtualDir& src, const FileSys::VirtualDir& dest, + bool full) { if (src == nullptr || dest == nullptr || !src->IsReadable() || !dest->IsWritable()) return false; if (dialog.wasCanceled()) return false; + std::vector buffer(CopyBufferSize); + auto last_timestamp = std::chrono::steady_clock::now(); + + const auto QtRawCopy = [&](const FileSys::VirtualFile& src_file, + const FileSys::VirtualFile& dest_file) { + if (src_file == nullptr || dest_file == nullptr) { + return false; + } + if (!dest_file->Resize(src_file->GetSize())) { + return false; + } + + for (std::size_t i = 0; i < src_file->GetSize(); i += buffer.size()) { + if (dialog.wasCanceled()) { + dest_file->Resize(0); + return false; + } + + using namespace std::literals::chrono_literals; + const auto new_timestamp = std::chrono::steady_clock::now(); + + if ((new_timestamp - last_timestamp) > 33ms) { + last_timestamp = new_timestamp; + dialog.setValue( + static_cast(std::min(read_size, total_size) * 100 / total_size)); + QCoreApplication::processEvents(); + } + + const auto read = src_file->Read(buffer.data(), buffer.size(), i); + dest_file->Write(buffer.data(), read, i); + + read_size += read; + } + + return true; + }; + if (full) { for (const auto& file : src->GetFiles()) { const auto out = VfsDirectoryCreateFileWrapper(dest, file->GetName()); - if (!FileSys::VfsRawCopy(file, out, block_size)) - return false; - dialog.setValue(dialog.value() + 1); - if (dialog.wasCanceled()) + if (!QtRawCopy(file, out)) return false; } } for (const auto& dir : src->GetSubdirectories()) { const auto out = dest->CreateSubdirectory(dir->GetName()); - if (!RomFSRawCopy(dialog, dir, out, block_size, full)) - return false; - dialog.setValue(dialog.value() + 1); - if (dialog.wasCanceled()) + if (!RomFSRawCopy(total_size, read_size, dialog, dir, out, full)) return false; } @@ -2669,10 +2691,9 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa } const auto full = res == selections.constFirst(); - const auto entry_size = CalculateRomFSEntrySize(extracted, full); - // The minimum required space is the size of the extracted RomFS + 1 GiB - const auto minimum_free_space = extracted->GetSize() + 0x40000000; + // The expected required space is the size of the RomFS + 1 GiB + const auto minimum_free_space = romfs->GetSize() + 0x40000000; if (full && Common::FS::GetFreeSpaceSize(path) < minimum_free_space) { QMessageBox::warning(this, tr("RomFS Extraction Failed!"), @@ -2683,12 +2704,15 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa return; } - QProgressDialog progress(tr("Extracting RomFS..."), tr("Cancel"), 0, - static_cast(entry_size), this); + QProgressDialog progress(tr("Extracting RomFS..."), tr("Cancel"), 0, 100, this); progress.setWindowModality(Qt::WindowModal); progress.setMinimumDuration(100); + progress.setAutoClose(false); + progress.setAutoReset(false); - if (RomFSRawCopy(progress, extracted, out, 0x400000, full)) { + size_t read_size = 0; + + if (RomFSRawCopy(romfs->GetSize(), read_size, progress, extracted, out, full)) { progress.close(); QMessageBox::information(this, tr("RomFS Extraction Succeeded!"), tr("The operation completed successfully."));