CommonLibSSE (Parapets fork)
BSAudioManager.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/B/BSAtomic.h"
4 #include "RE/B/BSAudioInit.h"
5 #include "RE/B/BSSoundMessage.h"
6 #include "RE/B/BSTHashMap.h"
7 #include "RE/B/BSTList.h"
8 #include "RE/N/NiAVObject.h"
9 
10 namespace RE
11 {
12  class BSAudio;
13  class BSAudioManagerThread;
14  class BSGameSound;
15  class BSISoundDescriptor;
16  class BSISoundOutputModel;
17  class BSSoundInfo;
18  class SoundMessageList;
19  class SoundMessageStack;
20  struct BSSoundHandle;
21 
23  {
24  public:
25  enum class Flags : std::uint32_t
26  {
27  ManagerInitialized = 1 << 0,
28  PlatformInitialized = 1 << 1,
29  PlatformInitFailed = 1 << 2,
30  CacheEnabled = 1 << 3,
31  ShuttingDown = 1 << 4,
32  RunDisabled = 1 << 5
33  };
34 
35  [[nodiscard]] static BSAudioManager* GetSingleton();
36  [[nodiscard]] static BSAudio* QPlatformInstance();
37 
38  void ClearCache();
39  void ComposeMessage(SOUND_MSG a_message, std::uint32_t a_id = 0, std::int32_t a_iData = 0, void* a_pData = nullptr, NiPointer<NiAVObject> a_spData = nullptr, const NiPoint3& a_vector3 = {});
40  bool GetSoundHandle(BSSoundHandle& a_soundHandle, BSISoundDescriptor* a_descriptor, std::uint32_t a_flags = 0x1A);
41  void KillAll(bool a_waitForCompletion = false, std::uint32_t a_waitTicks = 1000);
42  bool Play(FormID a_soundFormID);
43  bool Play(BSISoundDescriptor* a_descriptor);
44  void PrecacheDescriptor(const BSISoundDescriptor* a_descriptor, std::uint32_t a_flags);
45  void SetCacheEnabled(bool a_enabled);
46 
47  [[nodiscard]] constexpr bool GetCacheEnabled() const noexcept { return flags.all(Flags::CacheEnabled); }
48 
49  // members
50  std::uint32_t frontQueue; // 000
51  std::uint32_t backQueue; // 004
60  std::uint32_t audioCacheSize; // 0F0
61  std::uint32_t ownerThreadID; // 0F4
63  std::uint32_t unk100; // 100
64  std::uint32_t audioHWThread; // 104
66  std::uint32_t maxCacheSize; // 160
67  std::uint32_t maxAudioCacheSize; // 164
68  std::uint32_t maxSizeForCachedSound; // 168
70  float masterVolume; // 170
71  std::uint32_t asyncReadPriorityThreshold; // 174
73  };
74  static_assert(sizeof(BSAudioManager) == 0x190);
75 }
Definition: BSAudioManagerThread.h:8
Definition: BSAudioManager.h:23
BSTHashMap< std::uint32_t, BSGameSound * > activeSounds
Definition: BSAudioManager.h:55
SoundMessageStack * processedMessages
Definition: BSAudioManager.h:54
float masterVolume
Definition: BSAudioManager.h:70
BSAudioManagerThread * ownerThread
Definition: BSAudioManager.h:62
BSAudioCallbacks audioCallbacks
Definition: BSAudioManager.h:72
SoundMessageList * messageQueues[2]
Definition: BSAudioManager.h:52
BSAudioInit initSettings
Definition: BSAudioManager.h:65
std::uint32_t asyncReadPriorityThreshold
Definition: BSAudioManager.h:71
bool Play(BSISoundDescriptor *a_descriptor)
std::uint32_t frontQueue
Definition: BSAudioManager.h:50
bool GetSoundHandle(BSSoundHandle &a_soundHandle, BSISoundDescriptor *a_descriptor, std::uint32_t a_flags=0x1A)
std::uint32_t audioHWThread
Definition: BSAudioManager.h:64
void SetCacheEnabled(bool a_enabled)
bool Play(FormID a_soundFormID)
void KillAll(bool a_waitForCompletion=false, std::uint32_t a_waitTicks=1000)
std::uint32_t maxSizeForCachedSound
Definition: BSAudioManager.h:68
constexpr bool GetCacheEnabled() const noexcept
Definition: BSAudioManager.h:47
Flags
Definition: BSAudioManager.h:26
stl::enumeration< Flags, std::uint32_t > flags
Definition: BSAudioManager.h:69
void PrecacheDescriptor(const BSISoundDescriptor *a_descriptor, std::uint32_t a_flags)
std::uint32_t backQueue
Definition: BSAudioManager.h:51
void ComposeMessage(SOUND_MSG a_message, std::uint32_t a_id=0, std::int32_t a_iData=0, void *a_pData=nullptr, NiPointer< NiAVObject > a_spData=nullptr, const NiPoint3 &a_vector3={})
std::uint32_t maxCacheSize
Definition: BSAudioManager.h:66
BSTHashMap< std::uint32_t, BSSoundInfo * > stateMap
Definition: BSAudioManager.h:56
std::uint32_t unk100
Definition: BSAudioManager.h:63
std::uint32_t maxAudioCacheSize
Definition: BSAudioManager.h:67
static BSAudioManager * GetSingleton()
SoundMessageStack * freeMessages
Definition: BSAudioManager.h:53
BSTHashMap< std::uint32_t, NiPointer< NiAVObject > > movingSounds
Definition: BSAudioManager.h:57
BSTHashMap< const NiAVObject *, const BSISoundOutputModel * > objectOutputOverrides
Definition: BSAudioManager.h:58
std::uint32_t audioCacheSize
Definition: BSAudioManager.h:60
BSTList< BSGameSound * > audioCache
Definition: BSAudioManager.h:59
std::uint32_t ownerThreadID
Definition: BSAudioManager.h:61
static BSAudio * QPlatformInstance()
Definition: BSAudio.h:18
Definition: BSISoundDescriptor.h:14
Definition: BSTList.h:41
Definition: BSTHashMap.h:21
Definition: NiPoint3.h:6
Definition: NiSmartPointer.h:9
Definition: SoundMessageList.h:8
Definition: SoundMessageStack.h:8
constexpr bool all(Args... a_args) const noexcept requires(std
Definition: PCH.h:329
Definition: AbsorbEffect.h:6
SOUND_MSG
Definition: BSSoundMessage.h:12
std::uint32_t FormID
Definition: BSCoreTypes.h:5
Definition: BSAudioInit.h:16
Definition: BSAudioInit.h:30
Definition: BSSoundHandle.h:10