summaryrefslogtreecommitdiffstats
path: root/src/audio_core/renderer/effect/buffer_mixer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio_core/renderer/effect/buffer_mixer.h')
-rw-r--r--src/audio_core/renderer/effect/buffer_mixer.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/audio_core/renderer/effect/buffer_mixer.h b/src/audio_core/renderer/effect/buffer_mixer.h
new file mode 100644
index 000000000..23eed4a8b
--- /dev/null
+++ b/src/audio_core/renderer/effect/buffer_mixer.h
@@ -0,0 +1,75 @@
+// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <array>
+
+#include "audio_core/common/common.h"
+#include "audio_core/renderer/effect/effect_info_base.h"
+#include "common/common_types.h"
+
+namespace AudioCore::AudioRenderer {
+
+class BufferMixerInfo : public EffectInfoBase {
+public:
+ struct ParameterVersion1 {
+ /* 0x00 */ std::array<s8, MaxMixBuffers> inputs;
+ /* 0x18 */ std::array<s8, MaxMixBuffers> outputs;
+ /* 0x30 */ std::array<f32, MaxMixBuffers> volumes;
+ /* 0x90 */ u32 mix_count;
+ };
+ static_assert(sizeof(ParameterVersion1) <= sizeof(EffectInfoBase::InParameterVersion1),
+ "BufferMixerInfo::ParameterVersion1 has the wrong size!");
+
+ struct ParameterVersion2 {
+ /* 0x00 */ std::array<s8, MaxMixBuffers> inputs;
+ /* 0x18 */ std::array<s8, MaxMixBuffers> outputs;
+ /* 0x30 */ std::array<f32, MaxMixBuffers> volumes;
+ /* 0x90 */ u32 mix_count;
+ };
+ static_assert(sizeof(ParameterVersion2) <= sizeof(EffectInfoBase::InParameterVersion2),
+ "BufferMixerInfo::ParameterVersion2 has the wrong size!");
+
+ /**
+ * Update the info with new parameters, version 1.
+ *
+ * @param error_info - Used to write call result code.
+ * @param in_params - New parameters to update the info with.
+ * @param pool_mapper - Pool for mapping buffers.
+ */
+ void Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion1& in_params,
+ const PoolMapper& pool_mapper) override;
+
+ /**
+ * Update the info with new parameters, version 2.
+ *
+ * @param error_info - Used to write call result code.
+ * @param in_params - New parameters to update the info with.
+ * @param pool_mapper - Pool for mapping buffers.
+ */
+ void Update(BehaviorInfo::ErrorInfo& error_info, const InParameterVersion2& in_params,
+ const PoolMapper& pool_mapper) override;
+
+ /**
+ * Update the info after command generation. Usually only changes its state.
+ */
+ void UpdateForCommandGeneration() override;
+
+ /**
+ * Initialize a new result state. Version 2 only, unused.
+ *
+ * @param result_state - Result state to initialize.
+ */
+ void InitializeResultState(EffectResultState& result_state) override;
+
+ /**
+ * Update the host-side state with the ADSP-side state. Version 2 only, unused.
+ *
+ * @param cpu_state - Host-side result state to update.
+ * @param dsp_state - AudioRenderer-side result state to update from.
+ */
+ void UpdateResultState(EffectResultState& cpu_state, EffectResultState& dsp_state) override;
+};
+
+} // namespace AudioCore::AudioRenderer