| 4917 | } |
| 4918 | |
| 4919 | static void S_UpdateBackgroundTrack( void ) |
| 4920 | { |
| 4921 | if (bMusic_IsDynamic) |
| 4922 | { |
| 4923 | if (s_debugdynamic->integer == 2) |
| 4924 | { |
| 4925 | DynamicMusicInfoPrint(); |
| 4926 | } |
| 4927 | |
| 4928 | S_CheckDynamicMusicState(); |
| 4929 | |
| 4930 | if (eMusic_StateActual != eBGRNDTRACK_SILENCE) |
| 4931 | { |
| 4932 | MusicInfo_t *pMusicInfoCurrent = &tMusic_Info[ (eMusic_StateActual == eBGRNDTRACK_FADE)?eBGRNDTRACK_EXPLORE:eMusic_StateActual ]; |
| 4933 | MusicInfo_t *pMusicInfoFadeOut = &tMusic_Info[ eBGRNDTRACK_FADE ]; |
| 4934 | |
| 4935 | if ( pMusicInfoCurrent->s_backgroundFile == -1) |
| 4936 | { |
| 4937 | int iRawEnd = s_rawend; |
| 4938 | S_UpdateBackgroundTrack_Actual( pMusicInfoCurrent, qtrue, s_musicVolume->value ); |
| 4939 | |
| 4940 | /* static int iPrevFrontVol = 0; |
| 4941 | if (iPrevFrontVol != pMusicInfoCurrent->iXFadeVolume) |
| 4942 | { |
| 4943 | iPrevFrontVol = pMusicInfoCurrent->iXFadeVolume; |
| 4944 | Com_Printf("front vol = %d\n",pMusicInfoCurrent->iXFadeVolume); |
| 4945 | } |
| 4946 | */ |
| 4947 | if (pMusicInfoFadeOut->bActive) |
| 4948 | { |
| 4949 | s_rawend = iRawEnd; |
| 4950 | S_UpdateBackgroundTrack_Actual( pMusicInfoFadeOut, qfalse, s_musicVolume->value ); // inactive-checked internally |
| 4951 | /* |
| 4952 | static int iPrevFadeVol = 0; |
| 4953 | if (iPrevFadeVol != pMusicInfoFadeOut->iXFadeVolume) |
| 4954 | { |
| 4955 | iPrevFadeVol = pMusicInfoFadeOut->iXFadeVolume; |
| 4956 | Com_Printf("fade vol = %d\n",pMusicInfoFadeOut->iXFadeVolume); |
| 4957 | } |
| 4958 | */ |
| 4959 | // |
| 4960 | // only do this for the fader!... |
| 4961 | // |
| 4962 | if (pMusicInfoFadeOut->iXFadeVolume == 0) |
| 4963 | { |
| 4964 | pMusicInfoFadeOut->bActive = qfalse; |
| 4965 | } |
| 4966 | } |
| 4967 | |
| 4968 | float fRemainingTimeInSeconds = MP3Stream_GetRemainingTimeInSeconds( &pMusicInfoCurrent->chMP3_Bgrnd.MP3StreamHeader ); |
| 4969 | // Com_Printf("Remaining: %3.3f\n",fRemainingTimeInSeconds); |
| 4970 | |
| 4971 | if ( fRemainingTimeInSeconds < fDYNAMIC_XFADE_SECONDS*2 ) |
| 4972 | { |
| 4973 | // now either loop current track, switch if finishing a transition, or stop if finished a death... |
| 4974 | // |
| 4975 | if (pMusicInfoCurrent->bTrackSwitchPending) |
| 4976 | { |
no test coverage detected