Kelsidavis-WoWee/include/audio/spell_sound_manager.hpp

107 lines
3.2 KiB
C++
Raw Normal View History

Add comprehensive spell sound manager with 35+ magic sounds Implemented complete spell casting audio system with all magic schools: Magic schools supported: - Fire: Precast (Low/Medium/High), Cast, Fireball impacts - Frost: Precast (Low/Medium/High), Cast, Blizzard impacts - Holy: Precast (Low/Medium/High), Cast, Holy impacts (4 levels) - Nature: Precast (Low/Medium/High), Cast - Shadow: Precast (Low/Medium/High), Cast - Arcane: Precast, Arcane Missile impacts - Physical: Non-magical abilities Spell phases: - Precast: Channeling/preparation sounds (before cast) - Cast: Spell release sounds (when spell fires) - Impact: Spell hit sounds (when spell hits target) Power levels: - Low: Weak spells, low level abilities - Medium: Standard power spells - High: Powerful high-level spells Sound coverage (35+ sounds): - 16 precast sounds (Fire/Frost/Holy/Nature/Shadow × Low/Med/High + Arcane) - 5 cast sounds (one per school) - 16 impact sounds (Fireball ×3, Blizzard ×6, Holy ×4, Arcane Missile ×3) Technical details: - Loads 35+ sound files from Sound\Spells directory - Simple API: playPrecast(school, power), playCast(school), playImpact(school, power) - Convenience methods: playFireball(), playFrostbolt(), playHeal(), etc. - Random variation selection for impacts - Volume at 0.75 with global scale control - Ready for integration with spell casting system Usage examples: ```cpp // Full spell sequence spellSoundManager->playPrecast(MagicSchool::FIRE, SpellPower::HIGH); // ... cast time ... spellSoundManager->playCast(MagicSchool::FIRE); // ... projectile travel ... spellSoundManager->playImpact(MagicSchool::FIRE, SpellPower::HIGH); // Convenience methods spellSoundManager->playFireball(); spellSoundManager->playHeal(); ``` This adds essential magic feedback for spell casting gameplay!
2026-02-09 16:45:30 -08:00
#pragma once
#include <vector>
#include <memory>
#include <string>
#include <cstdint>
namespace wowee {
namespace pipeline {
class AssetManager;
}
namespace audio {
class SpellSoundManager {
public:
SpellSoundManager() = default;
~SpellSoundManager() = default;
// Initialization
bool initialize(pipeline::AssetManager* assets);
void shutdown();
// Volume control
void setVolumeScale(float scale);
// Magic school types
enum class MagicSchool {
FIRE,
FROST,
HOLY,
NATURE,
SHADOW,
ARCANE,
PHYSICAL // Non-magical abilities
};
// Spell power level
enum class SpellPower {
LOW, // Weak spells, low level
MEDIUM, // Standard spells
HIGH // Powerful spells
};
// Spell casting sounds
void playPrecast(MagicSchool school, SpellPower power); // Channeling/preparation
void playCast(MagicSchool school); // When spell fires
void playImpact(MagicSchool school, SpellPower power); // When spell hits target
// Specific spell sounds
void playFireball();
void playFrostbolt();
void playLightningBolt();
void playHeal();
void playShadowBolt();
private:
struct SpellSample {
std::string path;
std::vector<uint8_t> data;
bool loaded;
};
// Precast sound libraries (channeling)
std::vector<SpellSample> precastFireLowSounds_;
std::vector<SpellSample> precastFireMediumSounds_;
std::vector<SpellSample> precastFireHighSounds_;
std::vector<SpellSample> precastFrostLowSounds_;
std::vector<SpellSample> precastFrostMediumSounds_;
std::vector<SpellSample> precastFrostHighSounds_;
std::vector<SpellSample> precastHolyLowSounds_;
std::vector<SpellSample> precastHolyMediumSounds_;
std::vector<SpellSample> precastHolyHighSounds_;
std::vector<SpellSample> precastNatureLowSounds_;
std::vector<SpellSample> precastNatureMediumSounds_;
std::vector<SpellSample> precastNatureHighSounds_;
std::vector<SpellSample> precastShadowLowSounds_;
std::vector<SpellSample> precastShadowMediumSounds_;
std::vector<SpellSample> precastShadowHighSounds_;
std::vector<SpellSample> precastArcaneSounds_;
// Cast sound libraries (spell release)
std::vector<SpellSample> castFireSounds_;
std::vector<SpellSample> castFrostSounds_;
std::vector<SpellSample> castHolySounds_;
std::vector<SpellSample> castNatureSounds_;
std::vector<SpellSample> castShadowSounds_;
// Impact sound libraries (spell hits)
std::vector<SpellSample> impactFireballSounds_;
std::vector<SpellSample> impactBlizzardSounds_;
std::vector<SpellSample> impactHolySounds_;
std::vector<SpellSample> impactArcaneMissileSounds_;
// State tracking
float volumeScale_ = 1.0f;
bool initialized_ = false;
// Helper methods
bool loadSound(const std::string& path, SpellSample& sample, pipeline::AssetManager* assets);
void playSound(const std::vector<SpellSample>& library, float volumeMultiplier = 1.0f);
void playRandomSound(const std::vector<SpellSample>& library, float volumeMultiplier = 1.0f);
};
} // namespace audio
} // namespace wowee