diff --git a/LEGO1/lego/legoomni/include/legosoundmanager.h b/LEGO1/lego/legoomni/include/legosoundmanager.h index ad46bf8f..72638c63 100644 --- a/LEGO1/lego/legoomni/include/legosoundmanager.h +++ b/LEGO1/lego/legoomni/include/legosoundmanager.h @@ -19,7 +19,7 @@ public: // SYNTHETIC: LEGO1 0x10029920 // LegoSoundManager::`scalar deleting destructor' - void FUN_1002a410(const float* p_pos, const float* p_dir, const float* p_up, const float* p_vel); + void UpdateListener(const float* p_position, const float* p_direction, const float* p_up, const float* p_velocity); inline LegoCacheSoundManager* GetCacheSoundManager() { return m_cacheSoundManager; } diff --git a/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp b/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp index 5f6c1a95..f2da166c 100644 --- a/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp +++ b/LEGO1/lego/legoomni/src/audio/lego3dsound.cpp @@ -47,10 +47,10 @@ MxResult Lego3DSound::Create(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char return FAILURE; } - m_ds3dBuffer->SetMinDistance(15.0f, 0); - m_ds3dBuffer->SetMaxDistance(100.0f, 0); - m_ds3dBuffer->SetPosition(0.0f, 0.0f, -40.0f, 0); - m_ds3dBuffer->SetConeOutsideVolume(-10000, 0); + m_ds3dBuffer->SetMinDistance(15.0f, DS3D_IMMEDIATE); + m_ds3dBuffer->SetMaxDistance(100.0f, DS3D_IMMEDIATE); + m_ds3dBuffer->SetPosition(0.0f, 0.0f, -40.0f, DS3D_IMMEDIATE); + m_ds3dBuffer->SetConeOutsideVolume(-10000, DS3D_IMMEDIATE); } if (m_ds3dBuffer == NULL || p_name == NULL) { @@ -86,7 +86,7 @@ MxResult Lego3DSound::Create(LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char if (MxOmni::IsSound3D()) { const float* position = m_positionROI->GetWorldPosition(); - m_ds3dBuffer->SetPosition(position[0], position[1], position[2], 0); + m_ds3dBuffer->SetPosition(position[0], position[1], position[2], DS3D_IMMEDIATE); } LegoEntity* entity = m_roi->GetEntity(); @@ -147,7 +147,7 @@ MxU32 Lego3DSound::UpdatePosition(LPDIRECTSOUNDBUFFER p_directSoundBuffer) } if (m_ds3dBuffer != NULL) { - m_ds3dBuffer->SetPosition(position[0], position[1], position[2], 0); + m_ds3dBuffer->SetPosition(position[0], position[1], position[2], DS3D_IMMEDIATE); } else { MxS32 newVolume = m_volume; @@ -209,8 +209,8 @@ MxS32 Lego3DSound::SetDistance(MxS32 p_min, MxS32 p_max) return -1; } - m_ds3dBuffer->SetMinDistance(p_min, 0); - m_ds3dBuffer->SetMaxDistance(p_max, 0); + m_ds3dBuffer->SetMinDistance(p_min, DS3D_IMMEDIATE); + m_ds3dBuffer->SetMaxDistance(p_max, DS3D_IMMEDIATE); return 0; } diff --git a/LEGO1/lego/legoomni/src/audio/legocachsound.cpp b/LEGO1/lego/legoomni/src/audio/legocachsound.cpp index 2a6b70ca..b426da5a 100644 --- a/LEGO1/lego/legoomni/src/audio/legocachsound.cpp +++ b/LEGO1/lego/legoomni/src/audio/legocachsound.cpp @@ -34,6 +34,7 @@ void LegoCacheSound::Init() } // STUB: LEGO1 0x10006710 +// FUNCTION: BETA10 0x10066505 MxResult LegoCacheSound::FUN_10006710() { // TODO diff --git a/LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp b/LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp index 942f8040..2832d825 100644 --- a/LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp +++ b/LEGO1/lego/legoomni/src/audio/legosoundmanager.cpp @@ -97,8 +97,38 @@ MxResult LegoSoundManager::Tickle() return m_cacheSoundManager->Tickle(); } -// STUB: LEGO1 0x1002a410 -void LegoSoundManager::FUN_1002a410(const float* p_pos, const float* p_dir, const float* p_up, const float* p_vel) +// FUNCTION: LEGO1 0x1002a410 +// FUNCTION: BETA10 0x100d03a5 +void LegoSoundManager::UpdateListener( + const float* p_position, + const float* p_direction, + const float* p_up, + const float* p_velocity +) { - // TODO + if (m_listener != NULL) { + if (p_position != NULL) { + m_listener->SetPosition(p_position[0], p_position[1], p_position[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_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(); + } + } } diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 19ff9fa3..fde5a979 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -2812,7 +2812,7 @@ void LegoAnimationManager::FUN_10064b50(MxLong p_time) viewROI->WrappedSetLocalTransform(mat); VideoManager()->Get3DManager()->Moved(*viewROI); - SoundManager()->FUN_1002a410( + SoundManager()->UpdateListener( viewROI->GetWorldPosition(), viewROI->GetWorldDirection(), viewROI->GetWorldUp(), diff --git a/LEGO1/lego/legoomni/src/common/legoutils.cpp b/LEGO1/lego/legoomni/src/common/legoutils.cpp index 62783224..7e431d03 100644 --- a/LEGO1/lego/legoomni/src/common/legoutils.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutils.cpp @@ -369,7 +369,7 @@ void FUN_1003eda0() LegoROI* viewROI = VideoManager()->GetViewROI(); if (viewROI) { viewROI->FUN_100a5a30(vec); - SoundManager()->FUN_1002a410( + SoundManager()->UpdateListener( viewROI->GetWorldPosition(), viewROI->GetWorldDirection(), viewROI->GetWorldUp(), diff --git a/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp b/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp index b07bb02a..3db91002 100644 --- a/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp @@ -159,7 +159,7 @@ void LegoCameraController::FUN_100123e0(const Matrix4& p_transform, MxU32 p_und) pov->WrappedSetLocalTransform(mat); m_lego3DView->Moved(*pov); - SoundManager()->FUN_1002a410( + SoundManager()->UpdateListener( pov->GetWorldPosition(), pov->GetWorldDirection(), pov->GetWorldUp(), diff --git a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp index 7f5fef34..87274d00 100644 --- a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp @@ -421,7 +421,7 @@ MxResult LegoNavController::UpdateLocation(const char* p_location) viewROI->WrappedSetLocalTransform(mat); VideoManager()->Get3DManager()->Moved(*viewROI); - SoundManager()->FUN_1002a410( + SoundManager()->UpdateListener( viewROI->GetWorldPosition(), viewROI->GetWorldDirection(), viewROI->GetWorldUp(), @@ -458,7 +458,7 @@ MxResult LegoNavController::UpdateLocation(MxU32 p_location) viewROI->WrappedSetLocalTransform(mat); VideoManager()->Get3DManager()->Moved(*viewROI); - SoundManager()->FUN_1002a410( + SoundManager()->UpdateListener( viewROI->GetWorldPosition(), viewROI->GetWorldDirection(), viewROI->GetWorldUp(), diff --git a/LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp index 0575056d..d2fedcb6 100644 --- a/LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp @@ -156,7 +156,7 @@ MxResult LegoPointOfViewController::Tickle() pov->WrappedSetLocalTransform(mat); m_lego3DView->Moved(*pov); - SoundManager()->FUN_1002a410( + SoundManager()->UpdateListener( pov->GetWorldPosition(), pov->GetWorldDirection(), pov->GetWorldUp(), @@ -172,7 +172,7 @@ MxResult LegoPointOfViewController::Tickle() vel.Clear(); pov->FUN_100a5a30(vel); - SoundManager()->FUN_1002a410( + SoundManager()->UpdateListener( pov->GetWorldPosition(), pov->GetWorldDirection(), pov->GetWorldUp(),