MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / _update

Method _update

Engine/source/sfx/sfxController.cpp:812–921  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

810//-----------------------------------------------------------------------------
811
812void SFXController::_update()
813{
814 Parent::_update();
815
816 SFXPlayList* playList = getPlayList();
817
818 // Check all sources against the current state setup and
819 // take appropriate actions.
820
821 for( U32 i = 0; i < mSources.size(); ++ i )
822 {
823 Source& source = mSources[ i ];
824
825 // If the source has already stopped playing,
826 // remove it.
827
828 if( !source.mPtr )
829 {
830 mSources.erase( i );
831 -- i;
832 continue;
833 }
834
835 if( !source.mState )
836 continue;
837
838 SFXPlayList::EStateMode stateMode = playList->getSlots().mStateMode[ mSources[ i ].mSlotIndex ];
839 if( !source.mState->isActive() )
840 {
841 if( source.mPtr->isPlaying() )
842 {
843 // The source is playing in an incompatible state.
844
845 if( stateMode == SFXPlayList::STATE_PauseInactive )
846 source.mPtr->pause();
847 else if( stateMode == SFXPlayList::STATE_StopInactive )
848 {
849 source.mPtr->stop();
850 mSources.erase( i );
851
852 -- i;
853 }
854 }
855 }
856 else
857 {
858 // Unpause a source that had its state become active again.
859
860 if( source.mPtr->isPaused() && stateMode == SFXPlayList::STATE_PauseInactive )
861 source.mPtr->play();
862 }
863 }
864
865 // Update interpreter.
866
867 bool endUpdate = false;
868 while( !endUpdate )
869 {

Callers

nothing calls this directly

Calls 12

sizeMethod · 0.45
eraseMethod · 0.45
isActiveMethod · 0.45
isPlayingMethod · 0.45
pauseMethod · 0.45
stopMethod · 0.45
isPausedMethod · 0.45
playMethod · 0.45
getDescriptionMethod · 0.45
emptyMethod · 0.45
resetMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected