Actually there is something. Here the source code of svc_sound in the Quake1 source code.
Code:
==================
CL_ParseStartSoundPacket
==================
*/
void CL_ParseStartSoundPacket(void)
{
vec3_t pos;
int channel, ent;
int sound_num;
int volume;
float attenuation;
int i;
channel = MSG_ReadShort();
if (channel & SND_VOLUME)
volume = MSG_ReadByte ();
else
volume = DEFAULT_SOUND_PACKET_VOLUME;
if (channel & SND_ATTENUATION)
attenuation = MSG_ReadByte () / 64.0;
else
attenuation = DEFAULT_SOUND_PACKET_ATTENUATION;
sound_num = MSG_ReadByte ();
for (i=0 ; i<3 ; i++)
pos[i] = MSG_ReadCoord ();
ent = (channel>>3)&1023;
channel &= 7;
if (ent > MAX_EDICTS)
Host_EndGame ("CL_ParseStartSoundPacket: ent = %i", ent);
S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0, attenuation);
}
Code:
void S_StartSound(int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation)
{
channel_t *target_chan, *check;
sfxcache_t *sc;
int vol;
int ch_idx;
int skip;
if (!sound_started)
return;
if (!sfx)
return;
if (nosound.value)
return;
vol = fvol*255;
// pick a channel to play on
target_chan = SND_PickChannel(entnum, entchannel);
if (!target_chan)
return;
// spatialize
memset (target_chan, 0, sizeof(*target_chan));
VectorCopy(origin, target_chan->origin);
target_chan->dist_mult = attenuation / sound_nominal_clip_dist;
target_chan->master_vol = vol;
target_chan->entnum = entnum;
target_chan->entchannel = entchannel;
SND_Spatialize(target_chan);
if (!target_chan->leftvol && !target_chan->rightvol)
return; // not audible at all
// new channel
sc = S_LoadSound (sfx);
if (!sc)
{
target_chan->sfx = NULL;
return; // couldn't load the sound's data
}
target_chan->sfx = sfx;
target_chan->pos = 0.0;
target_chan->end = paintedtime + sc->length;
// if an identical sound has also been started this frame, offset the pos
// a bit to keep it from just making the first one louder
check = &channels[NUM_AMBIENTS];
for (ch_idx=NUM_AMBIENTS ; ch_idx < NUM_AMBIENTS + MAX_DYNAMIC_CHANNELS ; ch_idx++, check++)
{
if (check == target_chan)
continue;
if (check->sfx == sfx && !check->pos)
{
skip = rand () % (int)(0.1*shm->speed);
if (skip >= target_chan->end)
skip = target_chan->end - 1;
target_chan->pos += skip;
target_chan->end -= skip;
break;
}
}
}
Basically it seems to be an emit_sound() like.
svc_stopsound :
Code:
void S_StopSound(int entnum, int entchannel)
{
int i;
for (i=0 ; i<MAX_DYNAMIC_CHANNELS ; i++)
{
if (channels[i].entnum == entnum
&& channels[i].entchannel == entchannel)
{
channels[i].end = 0;
channels[i].sfx = NULL;
return;
}
}
}
I've found nothing about svc_fadesound.
__________________