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

Function S_SwitchDynamicTracks

code/client/snd_dma.cpp:4288–4319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4286
4287
4288static void S_SwitchDynamicTracks( MusicState_e eOldState, MusicState_e eNewState, qboolean bNewTrackStartsFullVolume )
4289{
4290 // copy old track into fader...
4291 //
4292 tMusic_Info[ eBGRNDTRACK_FADE ] = tMusic_Info[ eOldState ];
4293// tMusic_Info[ eBGRNDTRACK_FADE ].bActive = qtrue; // inherent
4294// tMusic_Info[ eBGRNDTRACK_FADE ].bExists = qtrue; // inherent
4295 tMusic_Info[ eBGRNDTRACK_FADE ].iXFadeVolumeSeekTime= Sys_Milliseconds();
4296 tMusic_Info[ eBGRNDTRACK_FADE ].iXFadeVolumeSeekTo = 0;
4297 //
4298 // ... and deactivate...
4299 //
4300 tMusic_Info[ eOldState ].bActive = qfalse;
4301 //
4302 // set new track to either full volume or fade up...
4303 //
4304 tMusic_Info[eNewState].bActive = qtrue;
4305 tMusic_Info[eNewState].iXFadeVolumeSeekTime = Sys_Milliseconds();
4306 tMusic_Info[eNewState].iXFadeVolumeSeekTo = 255;
4307 tMusic_Info[eNewState].iXFadeVolume = bNewTrackStartsFullVolume ? 255 : 0;
4308
4309 eMusic_StateActual = eNewState;
4310
4311
4312 if (s_debugdynamic->integer)
4313 {
4314 const char *psNewStateString = Music_BaseStateToString( eNewState, qtrue );
4315 psNewStateString = psNewStateString?psNewStateString:"<unknown>";
4316
4317 Com_Printf( S_COLOR_MAGENTA "S_SwitchDynamicTracks( \"%s\" )\n", psNewStateString );
4318 }
4319}
4320
4321// called by both the config-string parser and the console-command state-changer...
4322//

Callers 2

S_UpdateBackgroundTrackFunction · 0.70

Calls 3

Music_BaseStateToStringFunction · 0.70
Sys_MillisecondsFunction · 0.50
Com_PrintfFunction · 0.50

Tested by

no test coverage detected