Skip to content

SoundBankObject

Generated from engine/audio/sound_bank_object.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.

Browse the audio module

#include "engine/audio/sound_bank_object.h" · namespace labrador

Anything that makes noise, inherited for the plumbing: it holds the bank handle and forwards the calls, so a subclass writes play_wave(x) instead of audio_resources->sound_bank(handle)->play_wave(x).

Names go in at construction and handles come out; the play calls take handles only. A subclass therefore resolves what it can make a noise with once, in its constructor, and keeps the handles as members - which is why the resolve helpers are here and the name-taking play calls are not.

SoundBankObject() = default;

A subclass that has not been given an AudioResources, which every object drawn by this engine has to be capable of being: draw objects are default-constructible. Nothing can fill the table in afterwards - set_sound_bank changes which bank, not which table it comes out of - so an object built this way is permanently unusable, and both ways of touching it throw std::logic_error saying so. That is T6 rather than a null dereference in somebody else's frame.

SoundBankObject(const std::string& sound_bank_name,
const AudioResources* audio_resources);

Throws std::out_of_range naming the bank if nothing loaded it, and std::logic_error for a null table.

SoundBank* sound_bank() const;

resolve_wave · resolve_effect (protected)

Section titled “resolve_wave · resolve_effect (protected)”
SoundBank::WaveHandle resolve_wave(const std::string& wave_name) const;
SoundBank::EffectHandle resolve_effect(const std::string& effect_name) const;

Load-time. Each throws std::out_of_range naming what was asked for if the bank does not have it, so a misspelt sound fails while the menu is being built rather than staying silent on the press that wanted it.

play_wave · play_effect · stop_effect · pause_effect · resume_effect · set_effect_volume · set_effect_pitch · set_effect_pan · effect_state · is_effect_looping (protected)

Section titled “play_wave · play_effect · stop_effect · pause_effect · resume_effect · set_effect_volume · set_effect_pitch · set_effect_pan · effect_state · is_effect_looping (protected)”
void play_wave(SoundBank::WaveHandle wave,
float volume = 1.0f, float pitch = 0.0f, float pan = 0.0f) const;
void play_effect(SoundBank::EffectHandle effect,
bool loop = false, float volume = 1.0f, float pitch = 0.0f,
float pan = 0.0f) const;
void stop_effect(SoundBank::EffectHandle effect,
bool immediate = false) const;
void pause_effect(SoundBank::EffectHandle effect) const;
void resume_effect(SoundBank::EffectHandle effect) const;
void set_effect_volume(SoundBank::EffectHandle effect, float volume) const;
void set_effect_pitch(SoundBank::EffectHandle effect, float pitch) const;
void set_effect_pan(SoundBank::EffectHandle effect, float pan) const;
SoundState effect_state(SoundBank::EffectHandle effect) const;
bool is_effect_looping(SoundBank::EffectHandle effect) const;
void set_sound_bank(const std::string& sound_bank_name);

Points this object at a different bank. Every handle resolved from the old one is meaningless against the new one, so a caller doing this re-resolves everything it holds.

Named in the public declarations above: AudioResources, SoundBank, SoundState.

The files that include this header directly. A file can also reach it through another header.

Development documentation (unreleased). Built from Labrador 862e08b of 2026-10-08.