-
-
Notifications
You must be signed in to change notification settings - Fork 4
Audio
Unified audio reference for all five Firestaff game engines.
Firestaff uses SDL3 for all audio output. The audio subsystem lives in
src/shared/ and src/audio/ and provides a common mixing and playback
interface that each game's audio module feeds into.
DM1 sound effects are stored in SND format within GRAPHICS.DAT. Effects
include footsteps, combat sounds, door mechanisms, spell casting, creature
noises, and environmental audio. Each effect is referenced by an index and
played through the SDL3 audio pipeline.
DM1 music is driven by a state machine implemented across four ReDMCSB functions:
| Function | Role |
|---|---|
| F0740 | Music initialization and SONG.DAT binding |
| F0741 | Music playback state management |
| F0742 | Map-based track selection (triggers on stairs/teleporter transitions) |
| F0743 | Per-tick music update and sequencing |
Key implementation details:
-
SONG.DATis bound at initialization time. - F0742 selects the music track based on the current dungeon level, triggered when the party uses stairs or teleporters.
- F0743 runs every game tick to advance the music sequence.
- The music state machine is wired into M11 via the
dm1MusicSource,dm1MusicState, anddm1MusicDriverfields inM11_GameViewState. - Header:
dm1_v1_f0740_f0743_music_source_pc34_compat.h.
Track status: the game-won track (C2) is proven playable. Other tracks remain fail-closed pending full verification.
CSB uses an AMG (Amiga Music Group) audio format for its music and sound data. CSB shares the DM1 sound-effect infrastructure for common effects but has its own music data and sequencing. The CSB audio path handles the Amiga-origin format differences (the CSB graphics are Amiga IMG1 nibble RLE, and the audio follows a similar Amiga lineage).
DM2 uses HMP (Human Machine Interfaces MIDI Protocol) files for music. HMP is a MIDI container format used by several DOS games of the era.
- Music tracks are stored as HMP files within the game data.
- The Firestaff HMP decoder extracts MIDI events and routes them through the SDL3 audio pipeline.
- Indoor and outdoor maps may have different music tracks.
- Weather events (thunder) have associated sound effects separate from the music system.
DM2 sound effects follow a similar SND-style approach but are stored within the GDAT (Graphics Data) container alongside graphical assets.
The Saturn audio system is fundamentally different from the DOS games:
The Sega Saturn's audio is driven by the SCSP, a Yamaha-designed sound processor with the following capabilities:
- 32 PCM/FM synthesis channels.
- Hardware DSP with 16 effect slots.
- 512 KB dedicated sound RAM.
- Independent from the main SH-2 CPUs.
| Component | Description |
|---|---|
| SDDRVS.TSK | Sound driver task -- the main Saturn sound driver binary |
| SCSP registers | Hardware register interface for channel control |
| SAL (Sound Abstraction Layer) | Software layer between game logic and SCSP hardware |
| MAP files | Sound map files that define instrument/sample mappings |
The Nexus audio pipeline in Firestaff decodes the Saturn sound data formats and routes them through SDL3, translating SCSP channel programming into PCM audio output.
Theron's Quest uses CD-DA tracks for its music. The game was released on CD-ROM, and music plays directly from audio tracks on the disc:
- Track 01: data track (game code and assets).
- Track 02 and onward: CD-DA audio tracks for in-game music.
- Track selection is driven by game state (dungeon level, events).
Firestaff handles CD-DA by reading the audio tracks from the disc image (CUE/BIN or equivalent format) and playing them through SDL3. Track 02 behavior and real-media startup are being hardened.
PC Engine sound effects use the console's PSG (Programmable Sound Generator) hardware. Firestaff decodes these from the game data and plays them through the SDL3 audio backend.