.WAV -- Innerloop Audio (ILSF/ADPCM)

1. Architectural Role & Engine Purpose

The WAV (Waveform Audio File) format stores all positional 3D sound effects, weapon audio (gunshots, reloads, silencer clicks), environmental ambient loops (wind howling, electrical hums), and mission dialogue speech in Project I.G.I. 1.

Audio files adhere to the Microsoft RIFF WAVE specification, standardizing on uncompressed 16-bit linear PCM at 22,050 Hz or 44,100 Hz. Mono audio tracks are streamed into hardware-accelerated DirectSound3D buffers for realistic spatial panning and distance attenuation.

2. Binary File Layout & Memory Map Diagram

A WAV file contains standard RIFF chunks with format metadata, loop points, and raw PCM audio samples:

WAV AUDIO — RIFF WAVE 16-BIT PCM LAYOUT 0x00: RIFF WAVE Master Header (12 Bytes) RIFF WAVE FourCC "RIFF" | Total File Size - 8 | Format FourCC "WAVE" riff[4], file_size, wave[4] 0x0C: fmt Chunk (24 Bytes) PCM FORMAT Format Tag (1=PCM) | Channels (1=Mono Positional, 2=Stereo Ambient) | Sample Rate (22050/44100) | BitsPerSample (16) fmt[4], size(16), audio_fmt(1), channels, sample_rate, byte_rate, align, bits_per_sample(16) data Chunk: Contiguous 16-Bit Signed PCM Audio Samples PCM SAMPLES FourCC "data" | Payload Size (uint32) | Raw 16-bit signed little-endian PCM sample values Uncompressed streaming into DirectSound3D secondary audio hardware buffers

3. DirectSound3D Positional Spatialization Pipeline Diagram

When an event emits sound, the audio engine computes distance falloff and updates DirectSound 3D buffers:

WAV AUDIO — DIRECTSOUND3D POSITIONAL SPATIALIZATION 1. SOUND EVENT • Guard Fires Weapon • World Coordinate XYZ • Sample: AK47_SHOT.WAV 2. VOICE POOL • Allocate Voice (32 Max) • Load 16-bit PCM Mono • Create DirectSound3D 3. 3D SPATIALIZATION • SetPosition(X, Y, Z) • MinDist=5m, MaxDist=300m • Calculate HRTF Panning 4. MIXER OUTPUT • Hardware Sound Card • Doppler Pitch Shift • Muffled Wall Attenuation

4. Architectural Mechanics & Engine Implementation Details

Innerloop designed the audio architecture for stealth tactical awareness:

  • Mono Spatialization: All in-game sound effects are strictly mono. Mono samples allow DirectSound3D to compute HRTF panning and distance falloff. Stereo is reserved exclusively for non-positional music.
  • Environmental Occlusion: Sound rays test the collision octree (.ctr). If solid concrete walls occlude the sound source, high frequencies are rolled off, allowing players to hear guards talking through doors with realistic muffled attenuation.

5. C++ Struct Definitions

#pragma pack(push, 1)
struct WavRiffHeader {
    char     riff[4];       // "RIFF"
    uint32_t file_size;     // Size - 8
    char     wave[4];       // "WAVE"
};

struct WavFmtChunk {
    char     fmt[4];        // "fmt "
    uint32_t chunk_size;    // 16
    uint16_t audio_format;  // 1 = PCM
    uint16_t num_channels;  // 1=Mono, 2=Stereo
    uint32_t sample_rate;   // 22050 or 44100
    uint32_t byte_rate;     // SampleRate * BlockAlign
    uint16_t block_align;   // Channels * 2
    uint16_t bits_per_sample;// 16
};
static_assert(sizeof(WavFmtChunk) == 24, "WavFmtChunk must be 24 bytes");
#pragma pack(pop)