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

Method _update

Engine/source/sfx/sfxController.cpp:814–923  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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