mirror of
https://github.com/isledecomp/isle.git
synced 2025-04-21 02:50:52 -04:00
Implement LegoSoundManager (#521)
* push code * begin work on subclass * fixes * Fixes --------- Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
parent
57d5949d84
commit
2158142b08
5 changed files with 86 additions and 10 deletions
LEGO1
lego/legoomni
omni/include
|
@ -24,8 +24,11 @@ private:
|
|||
void Init();
|
||||
void Destroy(MxBool p_fromDestructor);
|
||||
|
||||
undefined4 m_unk0x3c; // 0x3c
|
||||
LegoUnknown100d6b4c* m_unk0x40; // 0x40
|
||||
LPDIRECTSOUND3DLISTENER m_listener; // 0x3c
|
||||
LegoUnknown100d6b4c* m_unk0x40; // 0x40
|
||||
};
|
||||
|
||||
// GLOBAL: LEGO1 0x100db6d0
|
||||
// IID_IDirectSound3DListener
|
||||
|
||||
#endif // LEGOSOUNDMANAGER_H
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define LEGOUNKNOWN100D6B4C_H
|
||||
|
||||
#include "decomp.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
class LegoCacheSound;
|
||||
|
||||
|
@ -9,7 +10,15 @@ class LegoCacheSound;
|
|||
// SIZE 0x20
|
||||
class LegoUnknown100d6b4c {
|
||||
public:
|
||||
LegoUnknown100d6b4c();
|
||||
~LegoUnknown100d6b4c();
|
||||
|
||||
virtual MxResult Tickle(); // vtable+0x00
|
||||
|
||||
void FUN_1003dc40(LegoCacheSound** p_und);
|
||||
|
||||
private:
|
||||
undefined m_pad[0x1c];
|
||||
};
|
||||
|
||||
#endif // LEGOUNKNOWN100D6B4C_H
|
||||
|
|
|
@ -18,18 +18,64 @@ LegoSoundManager::~LegoSoundManager()
|
|||
void LegoSoundManager::Init()
|
||||
{
|
||||
m_unk0x40 = 0;
|
||||
m_unk0x3c = 0;
|
||||
m_listener = NULL;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100299b0
|
||||
// FUNCTION: LEGO1 0x100299b0
|
||||
void LegoSoundManager::Destroy(MxBool p_fromDestructor)
|
||||
{
|
||||
delete m_unk0x40;
|
||||
Init();
|
||||
|
||||
if (!p_fromDestructor) {
|
||||
MxSoundManager::Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100299f0
|
||||
// FUNCTION: LEGO1 0x100299f0
|
||||
MxResult LegoSoundManager::Create(MxU32 p_frequencyMS, MxBool p_createThread)
|
||||
{
|
||||
return MxSoundManager::Create(p_frequencyMS, p_createThread);
|
||||
MxBool locked = FALSE;
|
||||
MxResult result = FAILURE;
|
||||
|
||||
if (MxSoundManager::Create(10, FALSE) == SUCCESS) {
|
||||
m_criticalSection.Enter();
|
||||
locked = TRUE;
|
||||
|
||||
if (MxOmni::IsSound3D()) {
|
||||
if (m_dsBuffer->QueryInterface(IID_IDirectSound3DListener, (LPVOID*) &m_listener) != S_OK) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_unk0x40 = new LegoUnknown100d6b4c;
|
||||
result = SUCCESS;
|
||||
}
|
||||
|
||||
done:
|
||||
if (result != SUCCESS) {
|
||||
Destroy();
|
||||
}
|
||||
|
||||
if (locked) {
|
||||
m_criticalSection.Leave();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1002a390
|
||||
|
@ -38,11 +84,11 @@ void LegoSoundManager::Destroy()
|
|||
Destroy(FALSE);
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1002a3a0
|
||||
// FUNCTION: LEGO1 0x1002a3a0
|
||||
MxResult LegoSoundManager::Tickle()
|
||||
{
|
||||
MxMediaManager::Tickle();
|
||||
MxAutoLocker lock(&this->m_criticalSection);
|
||||
|
||||
return 0; // TODO: call something in unk0x40
|
||||
MxAutoLocker lock(&m_criticalSection);
|
||||
return m_unk0x40->Tickle();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,23 @@
|
|||
#include "legounknown100d6b4c.h"
|
||||
|
||||
// Inline constructor at 0x10029adb
|
||||
LegoUnknown100d6b4c::LegoUnknown100d6b4c()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1003cf20
|
||||
LegoUnknown100d6b4c::~LegoUnknown100d6b4c()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1003d050
|
||||
MxResult LegoUnknown100d6b4c::Tickle()
|
||||
{
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1003dc40
|
||||
void LegoUnknown100d6b4c::FUN_1003dc40(LegoCacheSound** p_und)
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
|
||||
MxS32 FUN_100aecf0(MxU32 p_undefined);
|
||||
|
||||
private:
|
||||
protected:
|
||||
void Init();
|
||||
void Destroy(MxBool p_fromDestructor);
|
||||
MxPresenter* FUN_100aebd0(const MxAtomId& p_atomId, MxU32 p_objectId);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue