diff --git a/Engine/source/T3D/levelInfo.cpp b/Engine/source/T3D/levelInfo.cpp index d10077cea..8edb6993f 100644 --- a/Engine/source/T3D/levelInfo.cpp +++ b/Engine/source/T3D/levelInfo.cpp @@ -73,7 +73,7 @@ extern F32 gDecalBias; extern GFXTexHandle gLevelAccuMap; /// 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 ) mSoundscape->setAmbience( mSoundAmbience ); else - mSoundscape->setAmbience( &sDefaultAmbience ); + mSoundscape->setAmbience( sDefaultAmbience ); } SFX->setDistanceModel( mSoundDistanceModel ); @@ -302,7 +302,7 @@ bool LevelInfo::onAdd() void LevelInfo::onRemove() { if( mSoundscape ) - mSoundscape->setAmbience( &sDefaultAmbience ); + mSoundscape->setAmbience( sDefaultAmbience ); Parent::onRemove(); } diff --git a/Engine/source/sfx/sfxSystem.cpp b/Engine/source/sfx/sfxSystem.cpp index d23880bfd..9c864842f 100644 --- a/Engine/source/sfx/sfxSystem.cpp +++ b/Engine/source/sfx/sfxSystem.cpp @@ -69,6 +69,8 @@ MODULE_END; 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. ImplementEnumType( SFXStatus, @@ -364,7 +366,8 @@ void SFXSystem::init() // register them in the provider initialization. // Create the system. - smSingleton = new SFXSystem(); + smSingleton = new SFXSystem(); + sDefaultAmbience = new SFXAmbience(); } //----------------------------------------------------------------------------- @@ -384,6 +387,7 @@ void SFXSystem::destroy() // Destroy the stream thread pool SFXInternal::SFXThreadPool::deleteSingleton(); + delete(sDefaultAmbience); } //----------------------------------------------------------------------------- @@ -1617,10 +1621,10 @@ DefineEngineFunction( sfxPlayOnce, S32, (StringTableEntry assetId, const char* a { SFXDescription* description = NULL; if (assetId == StringTable->EmptyString()) - { - Con::errorf( "sfxPlayOnce - Must Define a sound asset"); - return 0; - } + { + Con::errorf( "sfxPlayOnce - Must Define a sound asset"); + return 0; + } SFXSource* source = NULL; @@ -1639,10 +1643,10 @@ DefineEngineFunction( sfxPlayOnce, S32, (StringTableEntry assetId, const char* a MatrixF transform; transform.set(EulerF(0, 0, 0), Point3F(dAtof(arg0), dAtof(arg1), dAtof(arg2))); source = SFX->playOnce(tempSoundAsset->getSfxProfile(), &transform, NULL, dAtof(arg3)); - } } - else - { + } + else + { Con::errorf("sfxPlayOnce - Could not locate assetId '%s'", assetId); return 0; }