MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / removeSoundscape

Method removeSoundscape

Engine/source/sfx/sfxSoundscape.cpp:303–404  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

301//-----------------------------------------------------------------------------
302
303void SFXSoundscapeManager::removeSoundscape( SFXSoundscape* soundscape )
304{
305 AssertFatal( soundscape != getGlobalSoundscape(),
306 "SFXSoundscapeManager::removeSoundscape() - trying to remove the global soundscape" );
307
308 // Find the soundscape on the stack.
309
310 U32 index = 1;
311 for( ; index < mStack.size(); ++ index )
312 if( mStack[ index ] == soundscape )
313 break;
314
315 AssertFatal( index < mStack.size(),
316 "SFXSoundscapeManager::removeSoundscape() - soundscape not on stack" );
317
318 // Find out if the soundscape has the current reverb
319 // environment. If so, we need to change the reverb to
320 // the next one higher up the stack.
321
322 const bool isCurrentReverb = ( _findTopmostReverbOnStack( mStack ) == index );
323
324 // Remove the soundscape from the stack.
325
326 mStack.erase( index );
327
328 // Update reverb, if necessary.
329
330 if( isCurrentReverb )
331 {
332 S32 reverbIndex = _findTopmostReverbOnStack( mStack );
333 if( reverbIndex != -1 )
334 SFX->setReverb( mStack[ reverbIndex ]->getAmbience()->getEnvironment()->getReverb() );
335 }
336
337 // Deactivate states.
338
339 for( U32 i = 0; i < SFXAmbience::MaxStates; ++ i )
340 if( soundscape->mStates[ i ] )
341 {
342 soundscape->mStates[ i ]->deactivate();
343 soundscape->mStates[ i ] = NULL;
344 }
345
346 // If the soundscape is the only instance of its ambience, move
347 // it to the fade stack. Otherwise delete the soundscape.
348
349 if( soundscape->_isUnique() && soundscape->mSource != NULL )
350 {
351 #ifdef DEBUG_SPEW
352 Platform::outputDebugString( "[SFXSoundscapeManager] Moving ambience '%s' at index #%i to fade stack",
353 soundscape->getAmbience()->getName(), index );
354 #endif
355
356 soundscape->mSource->stop();
357 mFadeStack.push_back( soundscape );
358 }
359 else
360 {

Callers 2

updateMethod · 0.80
_onScopeOutMethod · 0.80

Calls 14

destructInPlaceFunction · 0.85
getEnvironmentMethod · 0.80
_isUniqueMethod · 0.80
_isOverriddenMethod · 0.80
sizeMethod · 0.45
eraseMethod · 0.45
setReverbMethod · 0.45
getAmbienceMethod · 0.45
deactivateMethod · 0.45
getNameMethod · 0.45
stopMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected