Sound System

The FAKK sound system uses the MILES SOUND SYSTEM version 6.0.

MILES can be turned on and off with the cvar s_usemiles. If it is turned off, it will use the old quake sound system.

The old Quake sound system is mostly still there and should still work except the music code. Also the Quake sound system doesn’t use the same volume/min distance scheme so these values don’t carry over to the Quake system.

Adding a looping sound

Client side – animation

<frame #> loopsound <file name> <volume> <min distance>

Client side - script

$<entity name> loopsound <file name> <volume> <min distance>

Server side – from entity code

LoopSound( str sound_name, float volume, float min_distance );

Adding a sound

Client side - add to client part of animations in the tiki:

<frame #> sound <file name> <channel> <volume> <min_distance>

Client side – script

$<entity name> playsound <file name> <channel> <volume> <min distance>

Client side – code

S_StartLocalSound( sfxHandle_t sfxHandle );

or

S_StartSound( vec3_t origin, int entnum, int entchannel, sfxHandle_t sfxHandle,

float volume, float min_dist );

Server side – from entity code

Sound( str sound_name, int channel, float volume, float min_distance,

Vector *sound_origin );

NOTE: minimum distance values are specified in pixels. Basically how the minimum distance stuff works is that every time the distance doubles from the minimum distance the volume is halved. So from 0 up to the mindist the volume is 1, at mindist * 2 the volume is ½, at min_dist * 4 volume = ¼, and so on.

NOTE2: the channel, volume, and minimum distance parameters are all optional. They will default to other values if not specified. The channel will default to CHAN_AUTO.

The volume and minimum distance will default to whatever is specified for this particular sound in the global/sound0.txt file. If either of these is not specified in global/sound0.txt for this sound then the global default(s) will be used (also defined in sound0.txt).

Sound0.txt

This file specifies what values to use for the default volume and minimum distance values should be used overall and for specific sounds. This makes it so you don’t have to specify these values every place you play a sound. This file should be located in the global directory.

To change the global default values make sure the following commands are in this file:

defaultmindist <global default min distance #>

defaultvolume <global default volume>

To change the default values for a specific sound add the following:

sound <sound name including path>

mindist <minimum distance>

volume <volume>

ex.

sound sound/weapons/example1.wav

mindist 200.0

volume 1.0

Planned additions

- More use of hardware sounds
- Real reverb support
- Possibly occlusion/obstruction support