SoundManager
93-channel sound player wrapping Urho3D Sound and SoundSource.
Overview
SoundManager loads and plays the game's 93 WAV sound effects
(sound000.wav through sound092.wav from Content/Data/Sound/).
Each file maps 1-to-1 to a SoundChannel enum value.
A global mute flag (enabled_) gates all playback.
Header: src/GalaxyEggbert/Game/SoundManager.hpp
Constants
static constexpr int kNumChannels = 93; // sound000–sound092
Internal Storage
private:
bool enabled_;
std::array<Sound*, kNumChannels> sounds_;
std::array<SoundSource*, kNumChannels> sources_;
Each SoundSource is attached to the scene root node.
Sounds are loaded once at construction and kept in memory for the session.
API
class SoundManager {
public:
SoundManager(Context* context, Scene* scene);
void Play(SoundChannel channel);
void SetEnabled(bool enabled);
bool IsEnabled() const;
};
Wired Events
| Game Event | Channel | Sound |
|---|---|---|
| Blupi jumps | SoundChannel::Jump (needs verification) | Jump sound |
| Blupi lands | SoundChannel::Land (needs verification) | Landing thud |
| Blupi dies | SoundChannel::Die (needs verification) | Death sound |
| Treasure collected | SoundChannel::Collect (needs verification) | Pickup jingle |
| Key collected | SoundChannel::Key (needs verification) | Key pickup |
| Shield collected | SoundChannel::Shield (needs verification) | Shield sound |
| Level exit reached | SoundChannel::Win (needs verification) | Level complete |
GalaxyEggbertGame.cpp call sites.
SoundChannel Enum
Defined in include/GalaxyEggbert/def/SoundChannel.hpp.
Values SoundChannel0 through SoundChannel92
map directly to sound000.wav–sound092.wav.
Numeric IDs must not change (they may be stored in level or save data).
Web Platform Note
Web/Emscripten builds require a user gesture before the browser allows audio.
Urho3D handles this via its built-in audio subsystem; no extra code in SoundManager is needed.