Skip to content

AUD audio

Formats

Stores sound effects, speech, and music consumed by the OpenTS audio layer.

Format
Kind
Binary format
Extension
.AUD
Role
Audio

Sound effects and music both play from .AUD files, but the two paths do not find those files the same way, and the difference decides where a modded sample has to be put.

A sound effect takes hold of its sample when the sound is registered and keeps that one pointer for the rest of the session. The pointer comes from an archive that was cached into memory, so the sample has to be a member of one: MIX archives covers what caching does, and a loose .AUD in the game directory is not reached by that path at all. Startup caches CONQUER.MIX and the shipped sound archives, and among the numbered expansion archives it caches the ECACHE set but not the EXPAND set. A sound whose sample is not found is still registered under its ID and simply never plays.

Music is streamed instead. A music track’s .AUD is opened by name through the ordinary file layer each time it plays and read a block at a time, so a loose file works and nothing is held in memory between plays. A track whose file cannot be opened is left out of shuffled and sequential play, and produces nothing when it is asked for directly.

A sound effect is played only while all of these hold, tested in this order:

  • the volume asked for is above zero, which for an ordinary sound effect means the player’s sound effect setting as well;
  • the sound took hold of a sample when it was registered;
  • the game was not started quiet;
  • an audio device is available.

Music is played only while all of these hold, tested in this order:

  • an audio device is available;
  • the game was not started quiet;
  • the music volume is above zero.

The one term the two lists do not share is the sample test, and a silent session reaches that as well as the quiet one. The shipped sound archives are cached only when a device is present and the game was not started quiet, so a sound whose sample lives in one of those holds nothing at all in a silent session. A sample in CONQUER.MIX or in an ECACHE archive is still taken hold of, since those are cached whatever the audio state, and that sound is silent on the quiet test rather than for want of a sample.

The start of the file supplies the playback rate, the size of the data, the size it uncompresses to, a set of flags and a compression code. Two flags are read: one marks the sample as stereo, the other marks it as sixteen bit. A rate above 20000 and below 24000 hertz is played as 22050 whatever the file asked for.

Only one compression method is decoded, the one the shipped files carry. Any other code, including the earlier Westwood delta compression, is not rejected — the data is passed to the mixer as raw samples and plays as noise. Within a compressed sample each frame is preceded by its compressed size, its uncompressed size and a fixed marker, and a frame whose marker does not match ends the sample there instead of failing the play.

Source files

Linked at revision 59fae722af8c.