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 EventChannelSound
Blupi jumpsSoundChannel::Jump (needs verification)Jump sound
Blupi landsSoundChannel::Land (needs verification)Landing thud
Blupi diesSoundChannel::Die (needs verification)Death sound
Treasure collectedSoundChannel::Collect (needs verification)Pickup jingle
Key collectedSoundChannel::Key (needs verification)Key pickup
Shield collectedSoundChannel::Shield (needs verification)Shield sound
Level exit reachedSoundChannel::Win (needs verification)Level complete
Needs verification: Exact channel enum values for each game event require cross-referencing GalaxyEggbertGame.cpp call sites.

SoundChannel Enum

Defined in include/GalaxyEggbert/def/SoundChannel.hpp. Values SoundChannel0 through SoundChannel92 map directly to sound000.wavsound092.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.