AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   SVC_SOUND, SVC_STOPSOUND, SVC_FADESOUND (https://forums.alliedmods.net/showthread.php?t=105971)

ot_207 10-10-2009 10:30

SVC_SOUND, SVC_STOPSOUND, SVC_FADESOUND
 
I am interested in these messages if anyone can tell me some details about the arguments that they have

Arkshine 10-10-2009 10:34

Re: SVC_SOUND, SVC_STOPSOUND, SVC_FADESOUND
 
I've tried to search informations a long time ago, without success. :/

ot_207 10-10-2009 10:39

Re: SVC_SOUND, SVC_STOPSOUND, SVC_FADESOUND
 
Quote:

Originally Posted by Arkshine (Post 957634)
I've tried to search informations a long time ago, without success. :/

Not even in HLSDK? (I don't have it right now because I am not at my computer.)

Arkshine 10-10-2009 10:40

Re: SVC_SOUND, SVC_STOPSOUND, SVC_FADESOUND
 
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.

ot_207 10-10-2009 10:44

Re: SVC_SOUND, SVC_STOPSOUND, SVC_FADESOUND
 
Thanks a lot!

Arkshine 10-10-2009 12:25

Re: SVC_SOUND, SVC_STOPSOUND, SVC_FADESOUND
 
Quote:

[OT] Mersy bocu!
I lol'd when i've read that. :D


All times are GMT -4. The time now is 22:32.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.