Reading a sound bank
Generated from engine/assets/sound_bank_loader.h at 862e08b. The text under each declaration is the header's own comment, word for word. About the reference says how these pages are made.
#include "engine/assets/sound_bank_loader.h" · namespace labrador
struct SoundBankDefinition
Section titled “struct SoundBankDefinition”A bank definition, parsed: what the content says a bank holds, before anything has been opened.
IT IS A TYPE RATHER THAN A LOCAL BECAUSE THE SEAM NEEDS IT FIRST. A backend with no container - engine/audio/null/ - has no name table of its own and answers wave_index out of this list, so the definition has to be read before AudioDevice::open_wave_bank is called rather than after it. One consequence a reader might notice: a bank whose container is missing AND whose definition is malformed reports the malformed definition. It is the better of the two answers - the definition is in every clone, the container is not (T6).
std::vector<std::string> waves;Every wave the definition names, in the order it names them and with no duplicates: the waves array first, then any wave a sound effect instance names that the array did not list.
Effect
Section titled “Effect”{ std::string name; std::string wave;};One named effect instance and the wave it plays.
Declared as SoundBankDefinition::Effect.
effects
Section titled “effects”In creation order, which is handle order: the per-wave instances first if the definition asked for them, then the explicit ones.
source_path
Section titled “source_path”std::string source_path;Where this was read from, so the throws below can name it.
read_sound_bank_definition
Section titled “read_sound_bank_definition”Reads the bank definition at json_path.
Throws std::runtime_error naming the path if the file cannot be read or parsed, is the wrong shape, or names two effect instances the same (T6).
build_sound_bank
Section titled “build_sound_bank”Builds the SoundBank that plays wave_bank out of device, creating one voice per effect the definition names.
The voices are created here, against a bank the caller has already opened, which is why the handle is passed in rather than fetched back out. Throws std::out_of_range naming the definition and the wave if the bank does not hold one an effect names - which, on a backend that has a container, open_wave_bank will already have said first.
Related types
Section titled “Related types”Named in the public declarations above: AudioDevice, Effect, SoundBank.
In the samples and tests
Section titled “In the samples and tests”The files that include this header directly. A file can also reach it through another header.
samples/audio/tests.cpptests/assets/sound_bank_loader_tests.cpptests/audio/null_tests.cpp
Development documentation (unreleased). Built from Labrador 862e08b of 2026-10-08.