diff options
Diffstat (limited to 'src/audio_core/sink_context.h')
-rw-r--r-- | src/audio_core/sink_context.h | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/audio_core/sink_context.h b/src/audio_core/sink_context.h index d7aa72ba7..05541becb 100644 --- a/src/audio_core/sink_context.h +++ b/src/audio_core/sink_context.h @@ -11,6 +11,8 @@ namespace AudioCore { +using DownmixCoefficients = std::array<float_le, 4>; + enum class SinkTypes : u8 { Invalid = 0, Device = 1, @@ -40,7 +42,7 @@ public: bool in_use; INSERT_UNION_PADDING_BYTES(5); }; - static_assert(sizeof(SinkInfo::CircularBufferIn) == 0x28, + static_assert(sizeof(CircularBufferIn) == 0x28, "SinkInfo::CircularBufferIn is in invalid size"); struct DeviceIn { @@ -50,9 +52,9 @@ public: std::array<u8, AudioCommon::MAX_CHANNEL_COUNT> input; INSERT_UNION_PADDING_BYTES(1); bool down_matrix_enabled; - std::array<float_le, 4> down_matrix_coef; + DownmixCoefficients down_matrix_coef; }; - static_assert(sizeof(SinkInfo::DeviceIn) == 0x11c, "SinkInfo::DeviceIn is an invalid size"); + static_assert(sizeof(DeviceIn) == 0x11c, "SinkInfo::DeviceIn is an invalid size"); struct InParams { SinkTypes type{}; @@ -62,28 +64,33 @@ public: INSERT_PADDING_WORDS(6); union { // std::array<u8, 0x120> raw{}; - SinkInfo::DeviceIn device; - SinkInfo::CircularBufferIn circular_buffer; + DeviceIn device; + CircularBufferIn circular_buffer; }; }; - static_assert(sizeof(SinkInfo::InParams) == 0x140, "SinkInfo::InParams are an invalid size!"); + static_assert(sizeof(InParams) == 0x140, "SinkInfo::InParams are an invalid size!"); }; class SinkContext { public: - explicit SinkContext(std::size_t sink_count); + explicit SinkContext(std::size_t sink_count_); ~SinkContext(); - std::size_t GetCount() const; + [[nodiscard]] std::size_t GetCount() const; + + void UpdateMainSink(const SinkInfo::InParams& in); + [[nodiscard]] bool InUse() const; + [[nodiscard]] std::vector<u8> OutputBuffers() const; - void UpdateMainSink(SinkInfo::InParams& in); - bool InUse() const; - std::vector<u8> OutputBuffers() const; + [[nodiscard]] bool HasDownMixingCoefficients() const; + [[nodiscard]] const DownmixCoefficients& GetDownmixCoefficients() const; private: bool in_use{false}; s32 use_count{}; std::array<u8, AudioCommon::MAX_CHANNEL_COUNT> buffers{}; std::size_t sink_count{}; + bool has_downmix_coefs{false}; + DownmixCoefficients downmix_coefficients{}; }; } // namespace AudioCore |