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

Function S_AddLoopingSound

code/client/snd_dma.cpp:1875–1910  ·  view source on GitHub ↗

================== S_AddLoopingSound Called during entity generation for a frame Include velocity in case I get around to doing doppler... ================== */

Source from the content-addressed store, hash-verified

1873==================
1874*/
1875void S_AddLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfxHandle, soundChannel_t chan ) {
1876 /*const*/ sfx_t *sfx;
1877
1878 if ( !s_soundStarted || s_soundMuted ) {
1879 return;
1880 }
1881 if ( numLoopSounds >= MAX_LOOP_SOUNDS ) {
1882 //assert(numLoopSounds<MAX_LOOP_SOUNDS);
1883#ifndef FINAL_BUILD
1884 Com_Printf( "S_AddLoopingSound: MAX_LOOP_SOUNDS\n");
1885#endif
1886 return;
1887 }
1888
1889 if ( sfxHandle < 0 || sfxHandle >= s_numSfx ) {
1890 Com_Error( ERR_DROP, "S_AddLoopingSound: handle %i out of range", sfxHandle );
1891 }
1892
1893 sfx = &s_knownSfx[ sfxHandle ];
1894 if (!sfx->bInMemory){
1895 S_memoryLoad(sfx);
1896 }
1897 SND_TouchSFX(sfx);
1898
1899 if ( !sfx->iSoundLengthInSamples ) {
1900 Com_Error( ERR_DROP, "%s has length 0", sfx->sSoundName );
1901 }
1902 assert(!sfx->pMP3StreamHeader);
1903 VectorCopy( origin, loopSounds[numLoopSounds].origin );
1904// VectorCopy( velocity, loopSounds[numLoopSounds].velocity );
1905 loopSounds[numLoopSounds].sfx = sfx;
1906 loopSounds[numLoopSounds].volume = SOUND_MAXVOL;
1907 loopSounds[numLoopSounds].entnum = entityNum;
1908 loopSounds[numLoopSounds].entchan = chan;
1909 numLoopSounds++;
1910}
1911
1912/*
1913==================

Callers 2

S_StartLocalLoopingSoundFunction · 0.70
CL_CgameSystemCallsFunction · 0.70

Calls 5

VectorCopyFunction · 0.85
S_memoryLoadFunction · 0.70
SND_TouchSFXFunction · 0.70
Com_PrintfFunction · 0.50
Com_ErrorFunction · 0.50

Tested by

no test coverage detected