Skip to content

Commit 4bfac1e

Browse files
committed
feat: BGSAudio, BSAudioManager, etc
1 parent 3a25f9d commit 4bfac1e

4 files changed

Lines changed: 44 additions & 4 deletions

File tree

include/RE/A/Actor.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ namespace RE
4343
class bhkCharacterStateChangeEvent;
4444
class bhkNonSupportContactEvent;
4545
class BSMovementDataChangedEvent;
46+
class BSSoundHandle;
4647
class BSSubGraphActivationUpdate;
4748
class BSTransformDeltaEvent;
4849
class CastPowerItem;
@@ -475,6 +476,13 @@ namespace RE
475476
return func(this, a_action, a_target);
476477
}
477478

479+
BSSoundHandle& PlaySoundByEditorName(BSSoundHandle& a_handle, const char* a_editorName, bool a_loop, std::uint32_t a_usageFlags) const
480+
{
481+
using func_t = decltype(&Actor::PlaySoundByEditorName);
482+
static REL::Relocation<func_t> func{ ID::Actor::PlaySoundByEditorName };
483+
return func(this, a_handle, a_editorName, a_loop, a_usageFlags);
484+
}
485+
478486
void RemovePerk(BGSPerk* a_perk)
479487
{
480488
using func_t = decltype(&Actor::RemovePerk);

include/RE/B/BGSAudio.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#pragma once
2+
3+
namespace RE
4+
{
5+
class BGSSoundDescriptorForm;
6+
7+
class BGSAudio
8+
{
9+
public:
10+
static BGSSoundDescriptorForm* GetSoundDescriptor(const char* a_formName)
11+
{
12+
using func_t = decltype(&BGSAudio::GetSoundDescriptor);
13+
static REL::Relocation<func_t> func{ ID::BGSAudio::GetSoundDescriptor };
14+
return func(a_formName);
15+
}
16+
};
17+
}

include/RE/B/BSAudioManager.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#pragma once
22

3+
#include "BSISoundDescriptor.h"
34
#include "RE/B/BSAudioCallbacks.h"
45
#include "RE/B/BSAudioInit.h"
56
#include "RE/B/BSISoundDescriptor.h"
@@ -37,18 +38,25 @@ namespace RE
3738
return *singleton;
3839
}
3940

40-
void GetSoundHandleByName(BSSoundHandle& a_handle, const char* a_soundName, float a_distance, std::uint32_t a_usageFlags, BSISoundDescriptor::ExtraResolutionData* a_data)
41+
bool GetSoundHandle(BSSoundHandle& a_handle, const BSISoundDescriptor* a_descriptor, float a_distance, std::uint32_t a_usageFlags, BSISoundDescriptor::ExtraResolutionData* a_data = nullptr)
42+
{
43+
using func_t = decltype(&BSAudioManager::GetSoundHandle);
44+
static REL::Relocation<func_t> func{ ID::BSAudioManager::GetSoundHandle };
45+
return func(this, a_handle, a_descriptor, a_distance, a_usageFlags, a_data);
46+
}
47+
48+
void GetSoundHandleByName(BSSoundHandle& a_handle, const char* a_soundName, float a_distance, std::uint32_t a_usageFlags, BSISoundDescriptor::ExtraResolutionData* a_data = nullptr)
4149
{
4250
using func_t = decltype(&BSAudioManager::GetSoundHandleByName);
4351
static REL::Relocation<func_t> func{ ID::BSAudioManager::GetSoundHandleByName };
44-
return func(this, a_handle, a_soundName, a_distance, a_usageFlags, a_data);
52+
func(this, a_handle, a_soundName, a_distance, a_usageFlags, a_data);
4553
}
4654

4755
void GetSoundHandleByFile(BSSoundHandle& a_handle, const BSResource::ID& a_file, std::uint32_t a_usageFlags, std::uint8_t a_priority)
4856
{
4957
using func_t = decltype(&BSAudioManager::GetSoundHandleByFile);
5058
static REL::Relocation<func_t> func{ ID::BSAudioManager::GetSoundHandleByFile };
51-
return func(this, a_handle, a_file, a_usageFlags, a_priority);
59+
func(this, a_handle, a_file, a_usageFlags, a_priority);
5260
}
5361

5462
// members

include/RE/IDs.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ namespace RE::ID
4242
inline constexpr REL::ID IsSneaking{ 2207655 };
4343
inline constexpr REL::ID Move{ 2229934 };
4444
inline constexpr REL::ID PerformAction{ 2231177 };
45+
inline constexpr REL::ID PlaySoundByEditorName{ 2230172 };
4546
inline constexpr REL::ID RemovePerk{ 2230122 };
4647
inline constexpr REL::ID Reset3D{ 2229913 };
4748
inline constexpr REL::ID RewardExperience{ 2230428 };
@@ -161,6 +162,11 @@ namespace RE::ID
161162
inline constexpr REL::ID SetParentGroupNumber{ 2189125 };
162163
}
163164

165+
namespace BGSAudio
166+
{
167+
inline constexpr REL::ID GetSoundDescriptor{ 2214758 };
168+
}
169+
164170
namespace BGSConstructibleObject
165171
{
166172
inline constexpr REL::ID PlayerPassesConditions{ 2197318 };
@@ -499,7 +505,8 @@ namespace RE::ID
499505
namespace BSAudioManager
500506
{
501507
inline constexpr REL::ID Singleton{ 2703058 };
502-
inline constexpr REL::ID GetSoundHandleByName{ 2267105 };
508+
inline constexpr REL::ID GetSoundHandle{ 2267105 };
509+
inline constexpr REL::ID GetSoundHandleByName{ 2267104 };
503510
inline constexpr REL::ID GetSoundHandleByFile{ 2267103 };
504511
}
505512

0 commit comments

Comments
 (0)