The SNDINFO lump (and ambient sounds)
ZDoom has support for special lump called "SNDINFO". This is similar to
the SNDINFO lump used by Hexen and is a normal text file embedded inside a
wad file. It can contain two parts: The first part maps long sound names to
the actual lump in a WAD that contain the sounds (logical sound mappings).
The second part defines ambient sounds for use with thing types 14001-14065.
Comments are also possible by beginning them with '//'. Everything after
the comment marker until the end of the line will be ignored by ZDoom.
(If you have used Hexen's SNDINFO lump, note that comments do not
begin with ';'.) Unlike in Hexen, SNDINFOs are cumulative and will be
processed in the order they appear in a wad. This means that if you just
want to define a few ambient sounds or redefine a few of the basic game
sounds, you don't need to duplicate the entire contents of the SNDINFO lump
in zdoom.wad.
Logical sound mappings are fairly simple. They are just a logical sound
name followed by the name of the actual sound to play. For example, here is
an excerpt from zdoom.wad's SNDINFO lump:
doors/dr1_open dsdoropn
doors/dr1_clos dsdorcls
doors/dr2_open dsbdopn
doors/dr2_clos dsbdcls
The names on the left are the logical sound names, and the names on the
right are the lumps they represent. Logical sound names must not start with
a dollar sign ($), and if they contain spaces, must be enclosed in quotes
("). Logical sound names are not case-sensitive, so "misc/keytry" and
"Misc/KeyTry" are considered to be the same thing. Unlike regular Doom, sound
need not begin with the letters "ds".
It is safe to have more than one logical sound reference the same sound
lump, and in fact, I do this with several sounds in zdoom.wad.
Commands all begin with a dollar sign ($). Currently, only one is
defined: $AMBIENT.
$AMBIENT
Ambient is used to define an ambient sound and attach it to a map
thing. There are two different types of ambient sounds available: point
and world. Point sounds are attached to specific map things and will
only be heard by the player when he is near the map thing. World sounds
can be heard no matter where on the level a player is. Using either
type of ambient sound in your levels requires that you define them with
the $ambient command in the SNDINFO lump and also that you include a
corresponding thing on all maps that you want to use them. In the case
of point sounds, the thing is used as the exact location for the sound.
For world sounds, the presence of a thing indicates that that sound
should be played on that level. (Thus you can define several world
sounds and only have a few of them play on any given level.)
Both Heretic and Hexen use world sounds, while point sounds are new to
ZDoom.
The $ambient command has six parts. These are:
- The command itself ($ambient).
- The ambient sound it defines (1-64). ZDoom supports up to 64 ambient
sounds, and this number is used to indicate which of those 64 this
command is describing. To use this ambient sound in a map, add 14000
to this number, and use that as the type of the thing in your level
editor. (Refer to your level editor's documentation if you don't now
how to use things that aren't in the original Doom.) For instance,
if this number is 1, then use a map thing of 14001 anywhere you want
this sound to be used.
- The sound's logical name. This must have already been defined with a
logical sound mapping (see above). By using the same logical name
with different ambient sounds, it is possible to use the same sound
with different parameters. (See demo.wad for an example of this.)
- The sound's type. This can be either "point" or "surround". "Point"
indicates that this should be a point sound, while "surround"
indicates that this is a world sound that should be played on the
surround channel. The type can also be omitted entirely which
indicates that this is a normal world sound.
- How frequently the sound is played. This can be "continuous",
"periodic", or "random".
Continuous means that the sound should be continously played (not
recommended for world sounds, but possible anyway).
Periodic indicates that the sound should be played at a specific
interval and is followed by the number of seconds that should elapse
between repeats of the sound.
Random indicates that the sound will repeat at a random interval. It
is followed by two numbers indicating the minimum number of seconds
that must elapse before the sound is played again and the maximum
number of seconds that may pass before the sound is again played (in
that order).
- The sound's relative volume (0.0-1.0). 0.0 means that the sound is
silent and never played. 1.0 means full volume. For point sounds,
this is the volume that the sound will be played at when the player
is standing right next to the corresponding thing. The further away
the player is, the quieter the sound becomes. For world sounds, this
is the volume that the sound will be played at no matter where the
player is standing.
That may be confusing, so I will describe the first two $ambient definitions
in demo.wad in an attemp to make their use easier to understand:
$AMBIENT 1 ForceFieldHum POINT CONTINUOUS 1.0
This line defines ambient sound 1. It uses the logical sound ForceFieldHum.
The logical name is folled by the word "point," so ZDoom knows that this is
a point sound, and it will play it at any thing of type 14001 (or 14065 with
first parameter of 1) on the map. Following this is "continuous," which
indicates that the sound will automatically repeat when it finishes. The 1.0
at the end of the line means that the sound is played at full volume.
$AMBIENT 2 Scream RANDOM 20.0 50.0 1.0
This line defines ambient sound 2. It uses the logical sound Scream. Because
the sound's type is omitted, it is treated as a normal world sound that will
be audible throughout the entire map. The next part is "random 20.0 50.0."
This means that the sound will repeat in a random time interval no shorter
than 20 seconds and no longer than 50 seconds. The 1.0 at the end means that
the sound will be played at full volume.