summaryrefslogtreecommitdiff
path: root/src/audio_core/sink_context.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio_core/sink_context.h')
-rw-r--r--src/audio_core/sink_context.h95
1 files changed, 0 insertions, 95 deletions
diff --git a/src/audio_core/sink_context.h b/src/audio_core/sink_context.h
deleted file mode 100644
index cc5a90d80..000000000
--- a/src/audio_core/sink_context.h
+++ /dev/null
@@ -1,95 +0,0 @@
1// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#pragma once
5
6#include <array>
7#include <vector>
8#include "audio_core/common.h"
9#include "common/common_funcs.h"
10#include "common/common_types.h"
11#include "common/swap.h"
12
13namespace AudioCore {
14
15using DownmixCoefficients = std::array<float_le, 4>;
16
17enum class SinkTypes : u8 {
18 Invalid = 0,
19 Device = 1,
20 Circular = 2,
21};
22
23enum class SinkSampleFormat : u32_le {
24 None = 0,
25 Pcm8 = 1,
26 Pcm16 = 2,
27 Pcm24 = 3,
28 Pcm32 = 4,
29 PcmFloat = 5,
30 Adpcm = 6,
31};
32
33class SinkInfo {
34public:
35 struct CircularBufferIn {
36 u64_le address;
37 u32_le size;
38 u32_le input_count;
39 u32_le sample_count;
40 u32_le previous_position;
41 SinkSampleFormat sample_format;
42 std::array<u8, AudioCommon::MAX_CHANNEL_COUNT> input;
43 bool in_use;
44 INSERT_PADDING_BYTES_NOINIT(5);
45 };
46 static_assert(sizeof(CircularBufferIn) == 0x28,
47 "SinkInfo::CircularBufferIn is in invalid size");
48
49 struct DeviceIn {
50 std::array<u8, 255> device_name;
51 INSERT_PADDING_BYTES_NOINIT(1);
52 s32_le input_count;
53 std::array<u8, AudioCommon::MAX_CHANNEL_COUNT> input;
54 INSERT_PADDING_BYTES_NOINIT(1);
55 bool down_matrix_enabled;
56 DownmixCoefficients down_matrix_coef;
57 };
58 static_assert(sizeof(DeviceIn) == 0x11c, "SinkInfo::DeviceIn is an invalid size");
59
60 struct InParams {
61 SinkTypes type{};
62 bool in_use{};
63 INSERT_PADDING_BYTES(2);
64 u32_le node_id{};
65 INSERT_PADDING_WORDS(6);
66 union {
67 // std::array<u8, 0x120> raw{};
68 DeviceIn device;
69 CircularBufferIn circular_buffer;
70 };
71 };
72 static_assert(sizeof(InParams) == 0x140, "SinkInfo::InParams are an invalid size!");
73};
74
75class SinkContext {
76public:
77 explicit SinkContext(std::size_t sink_count_);
78 ~SinkContext();
79
80 [[nodiscard]] std::size_t GetCount() const;
81
82 void UpdateMainSink(const SinkInfo::InParams& in);
83 [[nodiscard]] bool InUse() const;
84 [[nodiscard]] std::vector<u8> OutputBuffers() const;
85
86 [[nodiscard]] const DownmixCoefficients& GetDownmixCoefficients() const;
87
88private:
89 bool in_use{false};
90 s32 use_count{};
91 std::array<u8, AudioCommon::MAX_CHANNEL_COUNT> buffers{};
92 std::size_t sink_count{};
93 DownmixCoefficients downmix_coefficients{};
94};
95} // namespace AudioCore