diff options
Diffstat (limited to 'src/audio_core/mix_context.h')
| -rw-r--r-- | src/audio_core/mix_context.h | 113 |
1 files changed, 0 insertions, 113 deletions
diff --git a/src/audio_core/mix_context.h b/src/audio_core/mix_context.h deleted file mode 100644 index 3939c77e9..000000000 --- a/src/audio_core/mix_context.h +++ /dev/null | |||
| @@ -1,113 +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 "audio_core/splitter_context.h" | ||
| 10 | #include "common/common_funcs.h" | ||
| 11 | #include "common/common_types.h" | ||
| 12 | |||
| 13 | namespace AudioCore { | ||
| 14 | class BehaviorInfo; | ||
| 15 | class EffectContext; | ||
| 16 | |||
| 17 | class MixInfo { | ||
| 18 | public: | ||
| 19 | struct DirtyHeader { | ||
| 20 | u32_le magic{}; | ||
| 21 | u32_le mixer_count{}; | ||
| 22 | INSERT_PADDING_BYTES(0x18); | ||
| 23 | }; | ||
| 24 | static_assert(sizeof(DirtyHeader) == 0x20, "MixInfo::DirtyHeader is an invalid size"); | ||
| 25 | |||
| 26 | struct InParams { | ||
| 27 | float_le volume{}; | ||
| 28 | s32_le sample_rate{}; | ||
| 29 | s32_le buffer_count{}; | ||
| 30 | bool in_use{}; | ||
| 31 | INSERT_PADDING_BYTES(3); | ||
| 32 | s32_le mix_id{}; | ||
| 33 | s32_le effect_count{}; | ||
| 34 | u32_le node_id{}; | ||
| 35 | INSERT_PADDING_WORDS(2); | ||
| 36 | std::array<std::array<float_le, AudioCommon::MAX_MIX_BUFFERS>, AudioCommon::MAX_MIX_BUFFERS> | ||
| 37 | mix_volume{}; | ||
| 38 | s32_le dest_mix_id{}; | ||
| 39 | s32_le splitter_id{}; | ||
| 40 | INSERT_PADDING_WORDS(1); | ||
| 41 | }; | ||
| 42 | static_assert(sizeof(MixInfo::InParams) == 0x930, "MixInfo::InParams is an invalid size"); | ||
| 43 | }; | ||
| 44 | |||
| 45 | class ServerMixInfo { | ||
| 46 | public: | ||
| 47 | struct InParams { | ||
| 48 | float volume{}; | ||
| 49 | s32 sample_rate{}; | ||
| 50 | s32 buffer_count{}; | ||
| 51 | bool in_use{}; | ||
| 52 | s32 mix_id{}; | ||
| 53 | u32 node_id{}; | ||
| 54 | std::array<std::array<float_le, AudioCommon::MAX_MIX_BUFFERS>, AudioCommon::MAX_MIX_BUFFERS> | ||
| 55 | mix_volume{}; | ||
| 56 | s32 dest_mix_id{}; | ||
| 57 | s32 splitter_id{}; | ||
| 58 | s32 buffer_offset{}; | ||
| 59 | s32 final_mix_distance{}; | ||
| 60 | }; | ||
| 61 | ServerMixInfo(); | ||
| 62 | ~ServerMixInfo(); | ||
| 63 | |||
| 64 | [[nodiscard]] const ServerMixInfo::InParams& GetInParams() const; | ||
| 65 | [[nodiscard]] ServerMixInfo::InParams& GetInParams(); | ||
| 66 | |||
| 67 | bool Update(EdgeMatrix& edge_matrix, const MixInfo::InParams& mix_in, | ||
| 68 | BehaviorInfo& behavior_info, SplitterContext& splitter_context, | ||
| 69 | EffectContext& effect_context); | ||
| 70 | [[nodiscard]] bool HasAnyConnection() const; | ||
| 71 | void Cleanup(); | ||
| 72 | void SetEffectCount(std::size_t count); | ||
| 73 | void ResetEffectProcessingOrder(); | ||
| 74 | [[nodiscard]] s32 GetEffectOrder(std::size_t i) const; | ||
| 75 | |||
| 76 | private: | ||
| 77 | std::vector<s32> effect_processing_order; | ||
| 78 | InParams in_params{}; | ||
| 79 | bool UpdateConnection(EdgeMatrix& edge_matrix, const MixInfo::InParams& mix_in, | ||
| 80 | SplitterContext& splitter_context); | ||
| 81 | }; | ||
| 82 | |||
| 83 | class MixContext { | ||
| 84 | public: | ||
| 85 | MixContext(); | ||
| 86 | ~MixContext(); | ||
| 87 | |||
| 88 | void Initialize(const BehaviorInfo& behavior_info, std::size_t mix_count, | ||
| 89 | std::size_t effect_count); | ||
| 90 | void SortInfo(); | ||
| 91 | bool TsortInfo(SplitterContext& splitter_context); | ||
| 92 | |||
| 93 | [[nodiscard]] std::size_t GetCount() const; | ||
| 94 | [[nodiscard]] ServerMixInfo& GetInfo(std::size_t i); | ||
| 95 | [[nodiscard]] const ServerMixInfo& GetInfo(std::size_t i) const; | ||
| 96 | [[nodiscard]] ServerMixInfo& GetSortedInfo(std::size_t i); | ||
| 97 | [[nodiscard]] const ServerMixInfo& GetSortedInfo(std::size_t i) const; | ||
| 98 | [[nodiscard]] ServerMixInfo& GetFinalMixInfo(); | ||
| 99 | [[nodiscard]] const ServerMixInfo& GetFinalMixInfo() const; | ||
| 100 | [[nodiscard]] EdgeMatrix& GetEdgeMatrix(); | ||
| 101 | [[nodiscard]] const EdgeMatrix& GetEdgeMatrix() const; | ||
| 102 | |||
| 103 | private: | ||
| 104 | void CalcMixBufferOffset(); | ||
| 105 | void UpdateDistancesFromFinalMix(); | ||
| 106 | |||
| 107 | NodeStates node_states{}; | ||
| 108 | EdgeMatrix edge_matrix{}; | ||
| 109 | std::size_t info_count{}; | ||
| 110 | std::vector<ServerMixInfo> infos{}; | ||
| 111 | std::vector<ServerMixInfo*> sorted_info{}; | ||
| 112 | }; | ||
| 113 | } // namespace AudioCore | ||