MCPcopy Create free account
hub / github.com/JACoders/OpenJK / S_UpdateBackgroundTrack

Function S_UpdateBackgroundTrack

code/client/snd_dma.cpp:4919–5035  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4917}
4918
4919static 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 {

Callers 2

S_UpdateFunction · 0.70
AL_UpdateRawSamplesFunction · 0.70

Calls 11

Q_stricmpFunction · 0.85
SeekToMethod · 0.80
RewindMethod · 0.80
DynamicMusicInfoPrintFunction · 0.70
S_CheckDynamicMusicStateFunction · 0.70
S_SwitchDynamicTracksFunction · 0.70
S_StartBackgroundTrackFunction · 0.70
Sys_MillisecondsFunction · 0.50

Tested by

no test coverage detected