Audio System

Free Eggbert supports two audio backends, selected at compile time via the _BASS flag in include/def.hpp.

Audio Backends

BackendFlagSource FileStatus
DirectSound / MCI _BASS=FALSE (default) src/sound.cpp Default / Active
BASS + BASSMIDI library _BASS=TRUE src/soundbass.cpp Alternative
🔍
Needs Verification
The README mentions BASS/BASSMIDI, but the current default is _BASS=FALSE (DirectSound/MCI path active). The documentation may be outdated; verify the current build configuration.

CSound Class

Header: include/sound.hpp
Implementation: src/sound.cpp (DirectSound) or src/soundbass.cpp (BASS)

The CSound class is responsible for loading and playing all audio. It is instantiated in src/blupi.cpp during application startup.

Key features:

  • Loads .blp sound files from gamefiles/SOUND/
  • Supports 3D positional audio — sounds play louder when the player is nearby
  • Music tracks loop and change when transitioning between regions
  • Vehicle sounds loop and vary in pitch based on vehicle state

DirectSound Backend (Default)

File: src/sound.cpp
Active when: _BASS=FALSE (default)

Uses the Win32 DirectSound API (via Free Direct / SDL3 abstraction on non-Windows platforms). Wraps DirectSound buffer management for loading and playback of WAV-format sound data.

WAV file loading is handled separately by src/wave.cpp (include/wave.hpp).

BASS Library Backend

File: src/soundbass.cpp
Active when: _BASS=TRUE

Uses the BASS audio library and BASSMIDI for MIDI music support. Library binaries are located in the bass/ subdirectory.

To switch to the BASS backend, change in include/def.hpp:

// Default (DirectSound/MCI):
#define _BASS FALSE

// To enable BASS library:
#define _BASS TRUE

Music

10 background music tracks: MUSIC000.BLP through MUSIC009.BLP in gamefiles/SOUND/ (uppercase extension on disk).

  • Music track selection is stored per-level in DescFile::music
  • Music stops and changes when transitioning between regions
  • Current music is tracked in DescSave::music

Sound Effects

93 sound effect files in gamefiles/SOUND/ (indices 0–92): SOUND000.BLPSOUND065.BLP (uppercase) and sound066.blpsound092.blp (lowercase). Plus a special SOUND_MOVIE=99 marker (not a real sample file).

Sound effects are organized by category. See the full Sound Effects Reference for all constants.

Sound Categories

CategoryExamples
UI/MenuSOUND_CLICK (0), SOUND_ERROR (27)
Movement / JumpingSOUND_JUMP0–2, SOUND_JUMPEND, SOUND_FALL
Footsteps (surface variants)Wood, metal, cave, slime, plastic, cheese, grass
HelicopterSOUND_HELICOSTART/HIGH/STOP/LOW
JeepSOUND_JEEPSTART/HIGH/STOP/LOW
WaterSOUND_PLOUF, SOUND_BLUP, SOUND_DROWN
Combat / BombsSOUND_BOUM, SOUND_GLU, SOUND_ELECTRO
Power-upsSOUND_STARTSHIELD/STOPSHIELD, SOUND_STARTPOWER/STOPPOWER
Collectibles / GoalsSOUND_TRESOR, SOUND_EGG, SOUND_ENDOK
Level mechanicsSOUND_DOOR, SOUND_TELEPORTE, SOUND_BRIDGE1/2
Character reactionsSOUND_VERTIGO, SOUND_BYE, SOUND_MOCKERY

Surface-Specific Footsteps

The game uses different landing/footstep sounds depending on the surface type Blupi is standing on. Each surface type has two sounds: a landing sound (JUMPEND*) and a step sound (JUMPTOC*).

SurfaceJUMPEND constantJUMPTOC constant
Default (stone)SOUND_JUMPEND (3)SOUND_JUMPTOC (4)
WoodSOUND_JUMPENDb (78)SOUND_JUMPTOCb (79)
MetalSOUND_JUMPENDm (80)SOUND_JUMPTOCm (81)
CaveSOUND_JUMPENDg (82)SOUND_JUMPTOCg (83)
SlimeSOUND_JUMPENDo (84)SOUND_JUMPTOCo (85)
PlasticSOUND_JUMPENDk (86)SOUND_JUMPTOCk (87)
CheeseSOUND_JUMPENDf (88)SOUND_JUMPTOCf (89)
GrassSOUND_JUMPENDh (90)SOUND_JUMPTOCh (91)

Future Audio Work

TODO
A potential future improvement from TODO.md: add a CMake option to select the audio backend explicitly: FREE_EGGBERT_AUDIO_BACKEND=DSOUND|BASS|STUB