summaryrefslogtreecommitdiffstats
path: root/src/audio_core/renderer/command/data_source/pcm_int16.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio_core/renderer/command/data_source/pcm_int16.h')
-rw-r--r--src/audio_core/renderer/command/data_source/pcm_int16.h110
1 files changed, 110 insertions, 0 deletions
diff --git a/src/audio_core/renderer/command/data_source/pcm_int16.h b/src/audio_core/renderer/command/data_source/pcm_int16.h
new file mode 100644
index 000000000..5de1ad60d
--- /dev/null
+++ b/src/audio_core/renderer/command/data_source/pcm_int16.h
@@ -0,0 +1,110 @@
+// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <string>
+
+#include "audio_core/common/wave_buffer.h"
+#include "audio_core/renderer/command/icommand.h"
+#include "common/common_types.h"
+
+namespace AudioCore::AudioRenderer {
+namespace ADSP {
+class CommandListProcessor;
+}
+
+/**
+ * AudioRenderer command to decode PCM s16-encoded version 1 wavebuffers
+ * into the output_index mix buffer.
+ */
+struct PcmInt16DataSourceVersion1Command : ICommand {
+ /**
+ * Print this command's information to a string.
+ *
+ * @param processor - The CommandListProcessor processing this command.
+ * @param string - The string to print into.
+ */
+ void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+
+ /**
+ * Process this command.
+ *
+ * @param processor - The CommandListProcessor processing this command.
+ */
+ void Process(const ADSP::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;
+
+ /// 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)
+ u16 flags;
+ /// Wavebuffer sample rate
+ u32 sample_rate;
+ /// Pitch used for sample rate conversion
+ f32 pitch;
+ /// Target channel to read within the wavebuffer
+ s8 channel_index;
+ /// Number of channels within the wavebuffer
+ s8 channel_count;
+ /// Wavebuffers containing the wavebuffer address, context address, looping information etc
+ std::array<WaveBufferVersion2, MaxWaveBuffers> wave_buffers;
+ /// Voice state, updated each call and written back to game
+ CpuAddr voice_state;
+};
+
+/**
+ * AudioRenderer command to decode PCM s16-encoded version 2 wavebuffers
+ * into the output_index mix buffer.
+ */
+struct PcmInt16DataSourceVersion2Command : ICommand {
+ /**
+ * Print this command's information to a string.
+ * @param processor - The CommandListProcessor processing this command.
+ * @param string - The string to print into.
+ */
+ void Dump(const ADSP::CommandListProcessor& processor, std::string& string) override;
+
+ /**
+ * Process this command.
+ * @param processor - The CommandListProcessor processing this command.
+ */
+ void Process(const ADSP::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;
+
+ /// 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)
+ u16 flags;
+ /// Wavebuffer sample rate
+ u32 sample_rate;
+ /// Pitch used for sample rate conversion
+ f32 pitch;
+ /// Target channel to read within the wavebuffer
+ s8 channel_index;
+ /// Number of channels within the wavebuffer
+ s8 channel_count;
+ /// Wavebuffers containing the wavebuffer address, context address, looping information etc
+ std::array<WaveBufferVersion2, MaxWaveBuffers> wave_buffers;
+ /// Voice state, updated each call and written back to game
+ CpuAddr voice_state;
+};
+
+} // namespace AudioCore::AudioRenderer