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