CommonLibSSE (Parapets fork)
BGSSoundOutput.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "RE/F/FormTypes.h"
5 #include "RE/T/TESForm.h"
6 
7 namespace RE
8 {
9  class BGSSoundOutput :
10  public TESForm, // 00
11  public BSISoundOutputModel // 20
12  {
13  public:
14  inline static constexpr auto RTTI = RTTI_BGSSoundOutput;
15  inline static constexpr auto FORMTYPE = FormType::SoundOutputModel;
16 
17  enum class Type // MNAM
18  {
19  kUsesHRTF = 0,
21  };
22 
23  struct RecordFlags
24  {
25  enum RecordFlag : std::uint32_t
26  {
27  kDeleted = 1 << 5,
28  kIgnored = 1 << 12
29  };
30  };
31 
32  struct Data // NAM1
33  {
34  public:
35  enum class Flag
36  {
37  kNone = 0,
38  kAttenuatesWithDistance = 1 << 0,
39  kAllowsRumble = 1 << 1
40  };
41 
42  // members
44  std::uint8_t unk1; // 1
45  std::uint8_t unk2; // 2
46  std::uint8_t reverbSendPct; // 3
47  };
48  static_assert(sizeof(Data) == 0x4);
49 
51  {
52  public:
53  struct DataType
54  {
55  public:
56  // members
57  float minDistance; // 00
58  float maxDistance; // 04
59  std::uint8_t curve[5]; // 08
60  std::uint8_t pad15; // 0D
61  std::uint16_t pad16; // 0E
62  };
63  static_assert(sizeof(DataType) == 0x10);
64 
66 
67  // override (BSIAttenuationCharacteristics)
68  float GetMaxDistance() const override; // 01 - { return data.maxDistance; }
69  float GetMinDistance() const override; // 02 - { return data.minDistance; }
70  std::uint8_t GetCurveValue(std::uint32_t a_idx) const override; // 03 - { return a_idx >= 5 ? 0 : data.curve[a_idx]; }
71 
72  // members
73  DataType data; // 00
74  };
75  static_assert(sizeof(DynamicAttenuationCharacteristics) == 0x18);
76 
77  struct SpeakerArrays // ONAM
78  {
79  public:
80  struct Channel
81  {
82  public:
83  // members
84  std::uint8_t l; // 0
85  std::uint8_t r; // 1
86  std::uint8_t c; // 2
87  std::uint8_t lfe; // 3
88  std::uint8_t rl; // 4
89  std::uint8_t rr; // 5
90  std::uint8_t bl; // 6
91  std::uint8_t br; // 7
92  };
93  static_assert(sizeof(Channel) == 0x8);
94 
95  // members
97  };
98  static_assert(sizeof(SpeakerArrays) == 0x18);
99 
100  ~BGSSoundOutput() override; // 00
101 
102  // override (TESForm)
103  void ClearData() override; // 05
104  bool Load(TESFile* a_mod) override; // 06
105  void InitItemImpl() override; // 13
106 
107  // override (BSISoundOutputModel)
108  bool DoGetUsesHRTF() const override; // 01 - { return type == kUsesHRTF; }
109  bool DoGetHasSpeakerBias() const override; // 02 - { return type == kDefinedSpeakerOutput; }
110  bool DoGetSpeakerBias(std::uint32_t a_arg1, std::uint32_t a_arg2, float (&a_arg3)[8]) const override; // 03
111  bool DoGetAttenuatesWithDistance() const override; // 04 - { return data.flags & 1; }
112  bool DoGetAudibility(float a_distance) const override; // 05 - { float maxDistance = attenuationValues ? attenuationValues->GetMaxDistance() : 3.4028235e38; return a_distance > maxDistance; }
113  std::uint32_t DoGetSupportedInputChannels() const override; // 06 - { return 2; }
114  const BSIAttenuationCharacteristics* DoGetAttenuation() const override; // 07 - { return attenuationValues; }
115  float DoGetReverbSendLevel() const override; // 08 - { return data.reverbSendPct * 0.0099999998; }
116  [[nodiscard]] bool DoGetSupportsMonitor(std::uint32_t a_arg1) const override; // 09
117 
118  // members
119  Data data; // 28 - NAM1
123  };
124  static_assert(sizeof(BGSSoundOutput) == 0x40);
125 }
Definition: BGSSoundOutput.h:12
float DoGetReverbSendLevel() const override
void ClearData() override
std::uint32_t DoGetSupportedInputChannels() const override
void InitItemImpl() override
Data data
Definition: BGSSoundOutput.h:119
bool DoGetUsesHRTF() const override
SpeakerArrays * speakerOutputs
Definition: BGSSoundOutput.h:122
Type
Definition: BGSSoundOutput.h:18
DynamicAttenuationCharacteristics * attenuation
Definition: BGSSoundOutput.h:121
const BSIAttenuationCharacteristics * DoGetAttenuation() const override
stl::enumeration< Type, std::uint32_t > type
Definition: BGSSoundOutput.h:120
bool DoGetHasSpeakerBias() const override
static constexpr auto FORMTYPE
Definition: BGSSoundOutput.h:15
bool DoGetSupportsMonitor(std::uint32_t a_arg1) const override
bool Load(TESFile *a_mod) override
bool DoGetSpeakerBias(std::uint32_t a_arg1, std::uint32_t a_arg2, float(&a_arg3)[8]) const override
~BGSSoundOutput() override
static constexpr auto RTTI
Definition: BGSSoundOutput.h:14
bool DoGetAudibility(float a_distance) const override
bool DoGetAttenuatesWithDistance() const override
Definition: BSISoundOutputModel.h:6
Definition: TESFile.h:14
Definition: TESForm.h:34
Definition: AbsorbEffect.h:6
constexpr REL::ID RTTI_BGSSoundOutput
Definition: Offsets_RTTI.h:1543
Definition: BGSSoundOutput.h:33
stl::enumeration< Flag, std::uint8_t > flags
Definition: BGSSoundOutput.h:43
std::uint8_t unk1
Definition: BGSSoundOutput.h:44
std::uint8_t reverbSendPct
Definition: BGSSoundOutput.h:46
std::uint8_t unk2
Definition: BGSSoundOutput.h:45
Flag
Definition: BGSSoundOutput.h:36
std::uint8_t pad15
Definition: BGSSoundOutput.h:60
std::uint8_t curve[5]
Definition: BGSSoundOutput.h:59
std::uint16_t pad16
Definition: BGSSoundOutput.h:61
std::uint8_t GetCurveValue(std::uint32_t a_idx) const override
DataType data
Definition: BGSSoundOutput.h:73
Definition: BGSSoundOutput.h:24
RecordFlag
Definition: BGSSoundOutput.h:26
@ kDeleted
Definition: BGSSoundOutput.h:27
@ kIgnored
Definition: BGSSoundOutput.h:28
Definition: BGSSoundOutput.h:81
std::uint8_t c
Definition: BGSSoundOutput.h:86
std::uint8_t r
Definition: BGSSoundOutput.h:85
std::uint8_t rr
Definition: BGSSoundOutput.h:89
std::uint8_t bl
Definition: BGSSoundOutput.h:90
std::uint8_t l
Definition: BGSSoundOutput.h:84
std::uint8_t lfe
Definition: BGSSoundOutput.h:87
std::uint8_t rl
Definition: BGSSoundOutput.h:88
std::uint8_t br
Definition: BGSSoundOutput.h:91
Definition: BGSSoundOutput.h:78
Channel channels[3]
Definition: BGSSoundOutput.h:93
Definition: BSISoundOutputModel.h:11