CommonLibSSE (Parapets fork)
BSGameSound.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/B/BSAudioMonitor.h"
4 #include "RE/B/BSTArray.h"
5 #include "RE/I/ID.h"
6 #include "RE/M/MemoryManager.h"
7 #include "RE/N/NiPoint3.h"
9 
10 namespace RE
11 {
12  class BSISoundCategory;
13  class BSISoundOutputModel;
14 
16  {
17  public:
18  inline static constexpr auto RTTI = RTTI_BSGameSound;
19 
20  enum class Flags
21  {
22  HasBeenOpened = 1 << 0,
23  IsSoundFinished = 1 << 4,
24  IsPlaying = 1 << 5,
25  IsPaused = 1 << 6,
26  IsValid = 1 << 8,
27  IsPlayable = 1 << 11,
28  IsOpening = 1 << 12,
29  IsValidBeam = 1 << 15,
30  IsAsyncOpening = 1 << 18,
31  IsInDecay = 1 << 19,
32  PositionSet = 1 << 20,
33  };
34 
35  enum class SoundType
36  {
37  Music = 1 << 5,
38  };
39 
40  // add
41  virtual void OutputModelChangedImpl(); // 00 - { return; }
42 
43  virtual ~BSGameSound(); // 01
44 
45  virtual bool IsSoundFinished() const; // 02
46  virtual void SetSoundFinished(bool a_set); // 03
47  virtual std::uint32_t GetCurrentPlaybackPosition() const = 0; // 04
48  virtual bool PriorityTest(const BSGameSound* a_other) const; // 05
49  virtual bool SyncOpen() = 0; // 06
50  virtual bool StartAsyncOpen() = 0; // 07
51  virtual bool TestAsyncOpenReady() = 0; // 08
52  virtual bool FinishAsyncOpen() = 0; // 09
53  virtual bool HandleExternalOpen() = 0; // 0A
54  virtual bool Prepare(); // 0B
55  virtual void Copy(BSGameSound* a_other, bool a_updateImpl); // 0C
56  virtual void UpdateEmitterPosition() = 0; // 0D
57  virtual bool Update(); // 0E
58  virtual void SetEmitterPositionImpl(const NiPoint3& a_position) = 0; // 0F
59  virtual void GetEmitterPositionImpl(NiPoint3& a_position) const = 0; // 10
60  virtual void Unk_11(float a_arg1, float a_arg2) = 0; // 11
61  virtual void SetAttenuationCurve(std::uint16_t a_val1, std::uint16_t a_val2, std::uint16_t a_val3, std::uint16_t a_val4, std::uint16_t a_val5) = 0; // 12
62  virtual void DoApplyFrequency(); // 13
63  virtual void Seek(std::uint32_t a_milliseconds) = 0; // 14
64  virtual void PlayImpl() = 0; // 15
65  virtual void PauseImpl() = 0; // 16
66  virtual void StopImpl() = 0; // 17
67  virtual void SetVolumeImpl() = 0; // 18
68 
70 
71  void SetOutputModel(BSISoundOutputModel* a_outputModel);
72  void SetVolume(float a_volume);
73 
74  [[nodiscard]] constexpr float GetFrequency() const noexcept { return frequency * 0.01f; }
75  [[nodiscard]] constexpr bool HasBeenOpened() const noexcept { return flags.all(Flags::HasBeenOpened); }
76  [[nodiscard]] constexpr bool IsAsyncOpening() const noexcept { return flags.all(Flags::IsAsyncOpening); }
77  [[nodiscard]] constexpr bool IsInDecay() const noexcept { return flags.all(Flags::IsInDecay); }
78  [[nodiscard]] constexpr bool IsOpening() const noexcept { return flags.all(Flags::IsOpening); }
79  [[nodiscard]] constexpr bool IsMusic() const noexcept { return soundType.all(SoundType::Music); }
80  [[nodiscard]] constexpr bool IsPaused() const noexcept { return flags.all(Flags::IsPaused); }
81  [[nodiscard]] constexpr bool IsPlayable() const noexcept { return flags.all(Flags::IsPlayable); }
82  [[nodiscard]] constexpr bool IsPlaying() const noexcept { return flags.all(Flags::IsPlaying); }
83  [[nodiscard]] constexpr bool IsValid() const noexcept { return flags.all(Flags::IsValid); }
84  [[nodiscard]] constexpr bool IsValidBeam() const noexcept { return flags.all(Flags::IsValidBeam); }
85  [[nodiscard]] constexpr const BSISoundCategory* QCategory() const noexcept { return category; }
86  [[nodiscard]] constexpr bool QPositionSet() const noexcept { return flags.all(Flags::PositionSet); }
87 
88  using UnkCallbackFunc = void(void*, std::uint32_t);
89 
90  // members
93  std::byte pad2C[4]; // 2C
96  std::uint32_t unk4C; // 4C
98  std::uint32_t unk54; // 54
99  std::uint32_t unk58; // 58
101  std::uint32_t durationMilliseconds; // 60
102  std::uint16_t staticAttenuation; // 64
103  std::uint16_t unk66; // 66
104  std::uint16_t systemAttenuation; // 68
105  std::uint16_t unk6A; // 6A
106  std::uint16_t unk6C; // 6C
107  std::byte pad6E[2]; // 6E
108  float volume; // 70
109  float unk74; // 74
110  float unk78; // 78
111  std::uint32_t unk7C; // 7C
112  float listenerDistance; // 80
113  std::uint32_t unk84; // 84
114  std::uint64_t unk88; // 88
116  std::uint64_t unk98; // 98
117  std::uint64_t unkA0; // A0
118  std::uint32_t priority; // A8
119  std::uint32_t unkAC; // AC
122  std::uint8_t frequency; // C0
123  std::uint8_t freqVariance; // C1
124  std::byte padC2[6]; // C2
125  };
126  static_assert(sizeof(BSGameSound) == 0xC8);
127 }
Definition: BSGameSound.h:16
std::uint64_t unk98
Definition: BSGameSound.h:116
void SetVolume(float a_volume)
std::byte padC2[6]
Definition: BSGameSound.h:124
virtual std::uint32_t GetCurrentPlaybackPosition() const =0
std::uint64_t unk88
Definition: BSGameSound.h:114
std::uint16_t systemAttenuation
Definition: BSGameSound.h:104
std::uint8_t frequency
Definition: BSGameSound.h:122
static constexpr auto RTTI
Definition: BSGameSound.h:18
BSISoundCategory * category
Definition: BSGameSound.h:120
virtual void UpdateEmitterPosition()=0
float listenerDistance
Definition: BSGameSound.h:112
virtual void SetVolumeImpl()=0
constexpr bool HasBeenOpened() const noexcept
Definition: BSGameSound.h:75
BSTSmallArray< BSAudioMonitor::Request, 2 > requests
Definition: BSGameSound.h:91
std::uint32_t priority
Definition: BSGameSound.h:118
std::uint32_t unkAC
Definition: BSGameSound.h:119
virtual bool IsSoundFinished() const
NiPoint3 beamEnd
Definition: BSGameSound.h:92
stl::enumeration< Flags, std::uint32_t > flags
Definition: BSGameSound.h:100
virtual void SetAttenuationCurve(std::uint16_t a_val1, std::uint16_t a_val2, std::uint16_t a_val3, std::uint16_t a_val4, std::uint16_t a_val5)=0
virtual bool StartAsyncOpen()=0
virtual bool FinishAsyncOpen()=0
virtual void GetEmitterPositionImpl(NiPoint3 &a_position) const =0
virtual void Copy(BSGameSound *a_other, bool a_updateImpl)
constexpr bool IsMusic() const noexcept
Definition: BSGameSound.h:79
std::uint8_t freqVariance
Definition: BSGameSound.h:123
std::uint64_t unkA0
Definition: BSGameSound.h:117
void(void *, std::uint32_t) UnkCallbackFunc
Definition: BSGameSound.h:88
stl::enumeration< SoundType, std::uint32_t > soundType
Definition: BSGameSound.h:97
virtual void SetSoundFinished(bool a_set)
SoundMessageList soundMessageList
Definition: BSGameSound.h:94
std::byte pad2C[4]
Definition: BSGameSound.h:93
float unk78
Definition: BSGameSound.h:110
std::uint32_t unk4C
Definition: BSGameSound.h:96
virtual void Seek(std::uint32_t a_milliseconds)=0
virtual bool Prepare()
void SetOutputModel(BSISoundOutputModel *a_outputModel)
std::uint16_t unk6C
Definition: BSGameSound.h:106
constexpr bool IsPlayable() const noexcept
Definition: BSGameSound.h:81
UnkCallbackFunc * unk90
Definition: BSGameSound.h:115
virtual bool TestAsyncOpenReady()=0
std::uint16_t staticAttenuation
Definition: BSGameSound.h:102
std::uint32_t durationMilliseconds
Definition: BSGameSound.h:101
std::byte pad6E[2]
Definition: BSGameSound.h:107
virtual void Unk_11(float a_arg1, float a_arg2)=0
BSISoundOutputModel * outputModel
Definition: BSGameSound.h:121
std::uint16_t unk66
Definition: BSGameSound.h:103
constexpr float GetFrequency() const noexcept
Definition: BSGameSound.h:74
std::uint32_t unk54
Definition: BSGameSound.h:98
virtual void OutputModelChangedImpl()
constexpr bool IsOpening() const noexcept
Definition: BSGameSound.h:78
constexpr bool IsInDecay() const noexcept
Definition: BSGameSound.h:77
virtual void StopImpl()=0
constexpr bool IsValid() const noexcept
Definition: BSGameSound.h:83
float unk74
Definition: BSGameSound.h:109
virtual bool PriorityTest(const BSGameSound *a_other) const
constexpr bool QPositionSet() const noexcept
Definition: BSGameSound.h:86
virtual bool Update()
std::uint32_t unk58
Definition: BSGameSound.h:99
constexpr bool IsValidBeam() const noexcept
Definition: BSGameSound.h:84
Flags
Definition: BSGameSound.h:21
virtual void SetEmitterPositionImpl(const NiPoint3 &a_position)=0
virtual void PauseImpl()=0
constexpr bool IsPaused() const noexcept
Definition: BSGameSound.h:80
constexpr const BSISoundCategory * QCategory() const noexcept
Definition: BSGameSound.h:85
virtual void DoApplyFrequency()
std::uint32_t unk7C
Definition: BSGameSound.h:111
SoundType
Definition: BSGameSound.h:36
float volume
Definition: BSGameSound.h:108
virtual void PlayImpl()=0
virtual bool HandleExternalOpen()=0
constexpr bool IsPlaying() const noexcept
Definition: BSGameSound.h:82
BSResource::ID resourceID
Definition: BSGameSound.h:95
constexpr bool IsAsyncOpening() const noexcept
Definition: BSGameSound.h:76
virtual ~BSGameSound()
std::uint16_t unk6A
Definition: BSGameSound.h:105
virtual bool SyncOpen()=0
std::uint32_t unk84
Definition: BSGameSound.h:113
Definition: BSISoundCategory.h:6
Definition: BSISoundOutputModel.h:6
Definition: BSTArray.h:377
Definition: NiPoint3.h:6
Definition: SoundMessageList.h:8
constexpr bool all(Args... a_args) const noexcept requires(std
Definition: PCH.h:329
Definition: AbsorbEffect.h:6
constexpr REL::ID RTTI_BSGameSound
Definition: Offsets_RTTI.h:1717
Definition: ID.h:10