mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 00:14:22 +00:00
BETA matches for SoundManagers (#1646)
--------- Co-authored-by: jonschz <jonschz@users.noreply.github.com>
This commit is contained in:
@@ -46,10 +46,13 @@ typedef set<LegoCacheSoundEntry, Set100d6b4cComparator> Set100d6b4c;
|
||||
typedef list<LegoCacheSoundEntry> List100d6b4c;
|
||||
|
||||
// VTABLE: LEGO1 0x100d6b4c
|
||||
// VTABLE: BETA10 0x101becac
|
||||
// SIZE 0x20
|
||||
class LegoCacheSoundManager {
|
||||
public:
|
||||
// FUNCTION: BETA10 0x100d0a60
|
||||
LegoCacheSoundManager() {}
|
||||
|
||||
~LegoCacheSoundManager();
|
||||
|
||||
virtual MxResult Tickle(); // vtable+0x00
|
||||
@@ -66,6 +69,9 @@ private:
|
||||
List100d6b4c m_list; // 0x14
|
||||
};
|
||||
|
||||
// SYNTHETIC: BETA10 0x100d06b0
|
||||
// LegoCacheSoundManager::`scalar deleting destructor'
|
||||
|
||||
// TODO: Function names subject to change.
|
||||
|
||||
// clang-format off
|
||||
|
@@ -17,15 +17,15 @@ public:
|
||||
void Destroy() override; // vtable+0x18
|
||||
MxResult Create(MxU32 p_frequencyMS, MxBool p_createThread) override; // vtable+0x30
|
||||
|
||||
// SYNTHETIC: LEGO1 0x10029920
|
||||
// SYNTHETIC: BETA10 0x100d0660
|
||||
// LegoSoundManager::`scalar deleting destructor'
|
||||
|
||||
void UpdateListener(const float* p_position, const float* p_direction, const float* p_up, const float* p_velocity);
|
||||
|
||||
// FUNCTION: BETA10 0x1000f350
|
||||
LegoCacheSoundManager* GetCacheSoundManager() { return m_cacheSoundManager; }
|
||||
|
||||
// SYNTHETIC: LEGO1 0x10029920
|
||||
// SYNTHETIC: BETA10 0x100d0660
|
||||
// LegoSoundManager::`scalar deleting destructor'
|
||||
|
||||
private:
|
||||
void Init();
|
||||
void Destroy(MxBool p_fromDestructor);
|
||||
|
@@ -7,6 +7,7 @@ DECOMP_SIZE_ASSERT(LegoCacheSoundEntry, 0x08)
|
||||
DECOMP_SIZE_ASSERT(LegoCacheSoundManager, 0x20)
|
||||
|
||||
// FUNCTION: LEGO1 0x1003cf20
|
||||
// STUB: BETA10 0x100d0700
|
||||
LegoCacheSoundManager::~LegoCacheSoundManager()
|
||||
{
|
||||
LegoCacheSound* sound;
|
||||
@@ -28,6 +29,7 @@ LegoCacheSoundManager::~LegoCacheSoundManager()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1003d050
|
||||
// STUB: BETA10 0x100652f0
|
||||
MxResult LegoCacheSoundManager::Tickle()
|
||||
{
|
||||
#ifdef COMPAT_MODE
|
||||
|
@@ -9,18 +9,21 @@
|
||||
DECOMP_SIZE_ASSERT(LegoSoundManager, 0x44)
|
||||
|
||||
// FUNCTION: LEGO1 0x100298a0
|
||||
// FUNCTION: BETA10 0x100cffb0
|
||||
LegoSoundManager::LegoSoundManager()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10029940
|
||||
// FUNCTION: BETA10 0x100d0027
|
||||
LegoSoundManager::~LegoSoundManager()
|
||||
{
|
||||
Destroy(TRUE);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100299a0
|
||||
// FUNCTION: BETA10 0x100d0099
|
||||
void LegoSoundManager::Init()
|
||||
{
|
||||
m_cacheSoundManager = NULL;
|
||||
@@ -28,6 +31,7 @@ void LegoSoundManager::Init()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100299b0
|
||||
// FUNCTION: BETA10 0x100d00c9
|
||||
void LegoSoundManager::Destroy(MxBool p_fromDestructor)
|
||||
{
|
||||
delete m_cacheSoundManager;
|
||||
@@ -42,38 +46,45 @@ void LegoSoundManager::Destroy(MxBool p_fromDestructor)
|
||||
// FUNCTION: BETA10 0x100d0129
|
||||
MxResult LegoSoundManager::Create(MxU32 p_frequencyMS, MxBool p_createThread)
|
||||
{
|
||||
MxBool locked = FALSE;
|
||||
MxResult result = FAILURE;
|
||||
MxBool locked = FALSE;
|
||||
|
||||
if (MxSoundManager::Create(10, FALSE) == SUCCESS) {
|
||||
ENTER(m_criticalSection);
|
||||
locked = TRUE;
|
||||
if (MxSoundManager::Create(10, FALSE) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (MxOmni::IsSound3D()) {
|
||||
if (m_dsBuffer->QueryInterface(IID_IDirectSound3DListener, (LPVOID*) &m_listener) != DS_OK) {
|
||||
goto done;
|
||||
}
|
||||
ENTER(m_criticalSection);
|
||||
locked = TRUE;
|
||||
|
||||
MxOmni* omni = MxOmni::GetInstance();
|
||||
LPDIRECTSOUND sound;
|
||||
|
||||
if (omni && omni->GetSoundManager() && (sound = omni->GetSoundManager()->GetDirectSound())) {
|
||||
DSCAPS caps;
|
||||
memset(&caps, 0, sizeof(DSCAPS));
|
||||
caps.dwSize = sizeof(DSCAPS);
|
||||
|
||||
if (sound->GetCaps(&caps) == S_OK && caps.dwMaxHw3DAllBuffers == 0) {
|
||||
m_listener->SetDistanceFactor(0.026315790f, 0);
|
||||
m_listener->SetRolloffFactor(10, 0);
|
||||
}
|
||||
}
|
||||
if (MxOmni::IsSound3D()) {
|
||||
if (m_dsBuffer->QueryInterface(IID_IDirectSound3DListener, (LPVOID*) &m_listener) != DS_OK) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
m_cacheSoundManager = new LegoCacheSoundManager;
|
||||
assert(m_cacheSoundManager);
|
||||
result = SUCCESS;
|
||||
#ifdef BETA10
|
||||
m_listener->SetDistanceFactor(0.026315790f, 0);
|
||||
m_listener->SetRolloffFactor(10, 0);
|
||||
#else
|
||||
MxOmni* omni = MxOmni::GetInstance();
|
||||
LPDIRECTSOUND sound;
|
||||
|
||||
if (omni && omni->GetSoundManager() && (sound = omni->GetSoundManager()->GetDirectSound())) {
|
||||
DSCAPS caps;
|
||||
memset(&caps, 0, sizeof(DSCAPS));
|
||||
caps.dwSize = sizeof(DSCAPS);
|
||||
|
||||
if (sound->GetCaps(&caps) == S_OK && caps.dwMaxHw3DAllBuffers == 0) {
|
||||
m_listener->SetDistanceFactor(0.026315790f, 0);
|
||||
m_listener->SetRolloffFactor(10, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
m_cacheSoundManager = new LegoCacheSoundManager;
|
||||
assert(m_cacheSoundManager);
|
||||
result = SUCCESS;
|
||||
|
||||
done:
|
||||
if (result != SUCCESS) {
|
||||
Destroy();
|
||||
@@ -112,29 +123,24 @@ void LegoSoundManager::UpdateListener(
|
||||
const float* p_velocity
|
||||
)
|
||||
{
|
||||
if (m_listener != NULL) {
|
||||
if (p_position != NULL) {
|
||||
m_listener->SetPosition(p_position[0], p_position[1], p_position[2], DS3D_DEFERRED);
|
||||
}
|
||||
if (!m_listener) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (p_direction != NULL && p_up != NULL) {
|
||||
m_listener->SetOrientation(
|
||||
p_direction[0],
|
||||
p_direction[1],
|
||||
p_direction[2],
|
||||
p_up[0],
|
||||
p_up[1],
|
||||
p_up[2],
|
||||
DS3D_DEFERRED
|
||||
);
|
||||
}
|
||||
if (p_position != NULL) {
|
||||
m_listener->SetPosition(p_position[0], p_position[1], p_position[2], DS3D_DEFERRED);
|
||||
}
|
||||
|
||||
if (p_velocity != NULL) {
|
||||
m_listener->SetVelocity(p_velocity[0], p_velocity[1], p_velocity[2], DS3D_DEFERRED);
|
||||
}
|
||||
if (p_direction != NULL && p_up != NULL) {
|
||||
m_listener
|
||||
->SetOrientation(p_direction[0], p_direction[1], p_direction[2], p_up[0], p_up[1], p_up[2], DS3D_DEFERRED);
|
||||
}
|
||||
|
||||
if (p_position != NULL || (p_direction != NULL && p_up != NULL) || p_velocity != NULL) {
|
||||
m_listener->CommitDeferredSettings();
|
||||
}
|
||||
if (p_velocity != NULL) {
|
||||
m_listener->SetVelocity(p_velocity[0], p_velocity[1], p_velocity[2], DS3D_DEFERRED);
|
||||
}
|
||||
|
||||
if (p_position != NULL || (p_direction != NULL && p_up != NULL) || p_velocity != NULL) {
|
||||
m_listener->CommitDeferredSettings();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user