fix sDefaultAmbience intialization.

we don't want to spool that up before the SFX subsystem has kicked in
This commit is contained in:
AzaezelX 2022-05-16 19:22:25 -05:00
parent 22db2d4291
commit ff0e418132
2 changed files with 15 additions and 11 deletions

View file

@ -73,7 +73,7 @@ extern F32 gDecalBias;
extern GFXTexHandle gLevelAccuMap; extern GFXTexHandle gLevelAccuMap;
/// Default SFXAmbience used to reset the global soundscape. /// Default SFXAmbience used to reset the global soundscape.
static SFXAmbience sDefaultAmbience; extern SFXAmbience* sDefaultAmbience;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -256,7 +256,7 @@ void LevelInfo::unpackUpdate(NetConnection *conn, BitStream *stream)
if( mSoundAmbience ) if( mSoundAmbience )
mSoundscape->setAmbience( mSoundAmbience ); mSoundscape->setAmbience( mSoundAmbience );
else else
mSoundscape->setAmbience( &sDefaultAmbience ); mSoundscape->setAmbience( sDefaultAmbience );
} }
SFX->setDistanceModel( mSoundDistanceModel ); SFX->setDistanceModel( mSoundDistanceModel );
@ -302,7 +302,7 @@ bool LevelInfo::onAdd()
void LevelInfo::onRemove() void LevelInfo::onRemove()
{ {
if( mSoundscape ) if( mSoundscape )
mSoundscape->setAmbience( &sDefaultAmbience ); mSoundscape->setAmbience( sDefaultAmbience );
Parent::onRemove(); Parent::onRemove();
} }

View file

@ -69,6 +69,8 @@ MODULE_END;
SFXSystem* SFXSystem::smSingleton = NULL; SFXSystem* SFXSystem::smSingleton = NULL;
/// Default SFXAmbience used to reset the global soundscape.
SFXAmbience *sDefaultAmbience;
// Excludes Null and Blocked as these are not passed out to the control layer. // Excludes Null and Blocked as these are not passed out to the control layer.
ImplementEnumType( SFXStatus, ImplementEnumType( SFXStatus,
@ -365,6 +367,7 @@ void SFXSystem::init()
// Create the system. // Create the system.
smSingleton = new SFXSystem(); smSingleton = new SFXSystem();
sDefaultAmbience = new SFXAmbience();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -384,6 +387,7 @@ void SFXSystem::destroy()
// Destroy the stream thread pool // Destroy the stream thread pool
SFXInternal::SFXThreadPool::deleteSingleton(); SFXInternal::SFXThreadPool::deleteSingleton();
delete(sDefaultAmbience);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------