| 812 | //----------------------------------------------------------------------------- |
| 813 | |
| 814 | void 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 | { |
nothing calls this directly
no test coverage detected