summaryrefslogtreecommitdiffstats
path: root/src/audio_core/hle/mixers.h
diff options
context:
space:
mode:
authorMerryMage <MerryMage@users.noreply.github.com>2016-04-27 08:22:39 +0200
committerMerryMage <MerryMage@users.noreply.github.com>2016-05-19 08:24:39 +0200
commit6542c606023164d5c9c028bb2a2409d91b3ecb9e (patch)
treed7405466a62e1e5e60c8f89c92f85c6346d0a395 /src/audio_core/hle/mixers.h
parentAudioCore: Implement time stretcher (#1737) (diff)
downloadyuzu-6542c606023164d5c9c028bb2a2409d91b3ecb9e.tar
yuzu-6542c606023164d5c9c028bb2a2409d91b3ecb9e.tar.gz
yuzu-6542c606023164d5c9c028bb2a2409d91b3ecb9e.tar.bz2
yuzu-6542c606023164d5c9c028bb2a2409d91b3ecb9e.tar.lz
yuzu-6542c606023164d5c9c028bb2a2409d91b3ecb9e.tar.xz
yuzu-6542c606023164d5c9c028bb2a2409d91b3ecb9e.tar.zst
yuzu-6542c606023164d5c9c028bb2a2409d91b3ecb9e.zip
Diffstat (limited to '')
-rw-r--r--src/audio_core/hle/mixers.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/audio_core/hle/mixers.h b/src/audio_core/hle/mixers.h
new file mode 100644
index 000000000..b52952eb5
--- /dev/null
+++ b/src/audio_core/hle/mixers.h
@@ -0,0 +1,63 @@
+// Copyright 2016 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <array>
+
+#include "audio_core/hle/common.h"
+#include "audio_core/hle/dsp.h"
+
+namespace DSP {
+namespace HLE {
+
+class Mixers final {
+public:
+ Mixers() {
+ Reset();
+ }
+
+ void Reset();
+
+ DspStatus Tick(DspConfiguration& config,
+ const IntermediateMixSamples& read_samples,
+ IntermediateMixSamples& write_samples,
+ const std::array<QuadFrame32, 3>& input);
+
+ StereoFrame16 GetOutput() const {
+ return current_frame;
+ }
+
+private:
+ StereoFrame16 current_frame = {};
+
+ using OutputFormat = DspConfiguration::OutputFormat;
+
+ struct {
+ std::array<float, 3> intermediate_mixer_volume = {};
+
+ bool mixer1_enabled = false;
+ bool mixer2_enabled = false;
+ std::array<QuadFrame32, 3> intermediate_mix_buffer = {};
+
+ OutputFormat output_format = OutputFormat::Stereo;
+
+ } state;
+
+ /// INTERNAL: Update our internal state based on the current config.
+ void ParseConfig(DspConfiguration& config);
+ /// INTERNAL: Read samples from shared memory that have been modified by the ARM11.
+ void AuxReturn(const IntermediateMixSamples& read_samples);
+ /// INTERNAL: Write samples to shared memory for the ARM11 to modify.
+ void AuxSend(IntermediateMixSamples& write_samples, const std::array<QuadFrame32, 3>& input);
+ /// INTERNAL: Mix current_frame.
+ void MixCurrentFrame();
+ /// INTERNAL: Downmix from quadraphonic to stereo based on status.output_format and accumulate into current_frame.
+ void DownmixAndMixIntoCurrentFrame(float gain, const QuadFrame32& samples);
+ /// INTERNAL: Generate DspStatus based on internal state.
+ DspStatus GetCurrentStatus() const;
+};
+
+} // namespace HLE
+} // namespace DSP