mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-25 09:24:17 +00: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:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user