From ebd19dec99d9809a669f63294745d7c8facc6d31 Mon Sep 17 00:00:00 2001 From: Kelebek1 Date: Thu, 31 Aug 2023 15:09:15 +0100 Subject: Rework ADSP into a wrapper for apps --- src/audio_core/renderer/command/mix/clear_mix.cpp | 14 +++++++------- src/audio_core/renderer/command/mix/clear_mix.h | 13 +++++++------ src/audio_core/renderer/command/mix/copy_mix.cpp | 14 +++++++------- src/audio_core/renderer/command/mix/copy_mix.h | 13 +++++++------ .../renderer/command/mix/depop_for_mix_buffers.cpp | 14 +++++++------- .../renderer/command/mix/depop_for_mix_buffers.h | 13 +++++++------ src/audio_core/renderer/command/mix/depop_prepare.cpp | 14 +++++++------- src/audio_core/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 +++++++------ src/audio_core/renderer/command/mix/mix_ramp.cpp | 13 +++++++------ src/audio_core/renderer/command/mix/mix_ramp.h | 13 +++++++------ src/audio_core/renderer/command/mix/mix_ramp_grouped.cpp | 13 +++++++------ src/audio_core/renderer/command/mix/mix_ramp_grouped.h | 13 +++++++------ src/audio_core/renderer/command/mix/volume.cpp | 12 ++++++------ src/audio_core/renderer/command/mix/volume.h | 13 +++++++------ src/audio_core/renderer/command/mix/volume_ramp.cpp | 13 +++++++------ src/audio_core/renderer/command/mix/volume_ramp.h | 13 +++++++------ 18 files changed, 124 insertions(+), 112 deletions(-) (limited to 'src/audio_core/renderer/command/mix') diff --git a/src/audio_core/renderer/command/mix/clear_mix.cpp b/src/audio_core/renderer/command/mix/clear_mix.cpp index 4f649d6a8..060d7cb28 100644 --- a/src/audio_core/renderer/command/mix/clear_mix.cpp +++ b/src/audio_core/renderer/command/mix/clear_mix.cpp @@ -3,22 +3,22 @@ #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 956ec0b65..650fa1a8a 100644 --- a/src/audio_core/renderer/command/mix/clear_mix.h +++ b/src/audio_core/renderer/command/mix/clear_mix.h @@ -8,11 +8,12 @@ #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 1d49f1644..5d386f95a 100644 --- a/src/audio_core/renderer/command/mix/copy_mix.cpp +++ b/src/audio_core/renderer/command/mix/copy_mix.cpp @@ -1,18 +1,18 @@ // 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 a59007fb6..ae247c3f8 100644 --- a/src/audio_core/renderer/command/mix/copy_mix.h +++ b/src/audio_core/renderer/command/mix/copy_mix.h @@ -8,11 +8,12 @@ #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 c2bc10061..caedb56b7 100644 --- a/src/audio_core/renderer/command/mix/depop_for_mix_buffers.cpp +++ b/src/audio_core/renderer/command/mix/depop_for_mix_buffers.cpp @@ -1,11 +1,11 @@ // 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 e7268ff27..699d38988 100644 --- a/src/audio_core/renderer/command/mix/depop_for_mix_buffers.h +++ b/src/audio_core/renderer/command/mix/depop_for_mix_buffers.h @@ -9,11 +9,12 @@ #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 69bb78ccc..2faf4681a 100644 --- a/src/audio_core/renderer/command/mix/depop_prepare.cpp +++ b/src/audio_core/renderer/command/mix/depop_prepare.cpp @@ -1,15 +1,15 @@ // 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 a5465da9a..161a94461 100644 --- a/src/audio_core/renderer/command/mix/depop_prepare.h +++ b/src/audio_core/renderer/command/mix/depop_prepare.h @@ -8,11 +8,12 @@ #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 8ecf9b05a..8bd689b88 100644 --- a/src/audio_core/renderer/command/mix/mix.cpp +++ b/src/audio_core/renderer/command/mix/mix.cpp @@ -5,11 +5,11 @@ #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 0201cf171..64c812382 100644 --- a/src/audio_core/renderer/command/mix/mix.h +++ b/src/audio_core/renderer/command/mix/mix.h @@ -8,11 +8,12 @@ #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 d67123cd8..2f6500da5 100644 --- a/src/audio_core/renderer/command/mix/mix_ramp.cpp +++ b/src/audio_core/renderer/command/mix/mix_ramp.cpp @@ -1,12 +1,12 @@ // 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 52f74a273..92209b53a 100644 --- a/src/audio_core/renderer/command/mix/mix_ramp.h +++ b/src/audio_core/renderer/command/mix/mix_ramp.h @@ -9,11 +9,12 @@ #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 43dbef9fc..64138a9bf 100644 --- a/src/audio_core/renderer/command/mix/mix_ramp_grouped.cpp +++ b/src/audio_core/renderer/command/mix/mix_ramp_grouped.cpp @@ -1,13 +1,14 @@ // 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 3b0ce67ef..9621e42a3 100644 --- a/src/audio_core/renderer/command/mix/mix_ramp_grouped.h +++ b/src/audio_core/renderer/command/mix/mix_ramp_grouped.h @@ -9,11 +9,12 @@ #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 b045fb062..92baf6cc3 100644 --- a/src/audio_core/renderer/command/mix/volume.cpp +++ b/src/audio_core/renderer/command/mix/volume.cpp @@ -1,12 +1,12 @@ // 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 6ae9fb794..fbb8156ca 100644 --- a/src/audio_core/renderer/command/mix/volume.h +++ b/src/audio_core/renderer/command/mix/volume.h @@ -8,11 +8,12 @@ #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 424307148..fdc751957 100644 --- a/src/audio_core/renderer/command/mix/volume_ramp.cpp +++ b/src/audio_core/renderer/command/mix/volume_ramp.cpp @@ -1,11 +1,11 @@ // 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 77b61547e..d9794fb95 100644 --- a/src/audio_core/renderer/command/mix/volume_ramp.h +++ b/src/audio_core/renderer/command/mix/volume_ramp.h @@ -8,11 +8,12 @@ #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 -- cgit v1.2.3