Kelsidavis-WoWee/include/audio/combat_sound_manager.hpp
Kelsi 9741c8ee7c Implement comprehensive audio control panel with tabbed settings interface
Adds complete audio volume controls for all 11 audio systems with master volume. Reorganizes settings window into Video, Audio, and Gameplay tabs for better UX.

Audio Features:
- Master volume control affecting all audio systems
- Individual volume sliders for: Music, Ambient, UI, Combat, Spell, Movement, Footsteps, NPC Voices, Mounts, Activity sounds
- Real-time volume adjustment with master volume multiplier
- Restore defaults button per tab

Technical Changes:
- Added getVolumeScale() getters to all audio managers
- Integrated all 10 audio managers into renderer (UI, Combat, Spell, Movement added)
- Expanded game_screen.hpp with 11 pending volume variables
- Reorganized settings window using ImGui tab bars (Video/Audio/Gameplay)
- Audio settings uses scrollable child window for 11 volume controls
- Settings window expanded to 520x720px to accommodate comprehensive controls
2026-02-09 17:07:22 -08:00

130 lines
4.2 KiB
C++

#pragma once
#include <vector>
#include <memory>
#include <string>
#include <cstdint>
namespace wowee {
namespace pipeline {
class AssetManager;
}
namespace audio {
class CombatSoundManager {
public:
CombatSoundManager() = default;
~CombatSoundManager() = default;
// Initialization
bool initialize(pipeline::AssetManager* assets);
void shutdown();
// Volume control
void setVolumeScale(float scale);
float getVolumeScale() const { return volumeScale_; }
// Weapon swing sounds (whoosh sounds before impact)
enum class WeaponSize {
SMALL, // 1H weapons (daggers, swords, maces)
MEDIUM, // 2H weapons (2H swords, axes)
LARGE // 2H heavy weapons (polearms, staves)
};
void playWeaponSwing(WeaponSize size, bool isCrit = false);
void playWeaponMiss(bool twoHanded = false);
// Impact sounds (when weapon hits target)
enum class ImpactType {
FLESH, // Hit unarmored/cloth
CHAIN, // Hit chain armor
PLATE, // Hit plate armor
SHIELD, // Hit shield
METAL_WEAPON, // Parry/weapon clash
WOOD, // Hit wooden objects
STONE // Hit stone/rock
};
void playImpact(WeaponSize weaponSize, ImpactType impactType, bool isCrit = false);
// Emote sounds
void playClap();
// Player character vocals
enum class PlayerRace {
BLOOD_ELF_MALE,
BLOOD_ELF_FEMALE,
DRAENEI_MALE,
DRAENEI_FEMALE
};
void playPlayerAttackGrunt(PlayerRace race);
void playPlayerWound(PlayerRace race, bool isCrit = false);
void playPlayerDeath(PlayerRace race);
private:
struct CombatSample {
std::string path;
std::vector<uint8_t> data;
bool loaded;
};
// Weapon swing sound libraries
std::vector<CombatSample> swingSmallSounds_;
std::vector<CombatSample> swingMediumSounds_;
std::vector<CombatSample> swingLargeSounds_;
std::vector<CombatSample> swingSmallCritSounds_;
std::vector<CombatSample> swingMediumCritSounds_;
std::vector<CombatSample> swingLargeCritSounds_;
std::vector<CombatSample> missWhoosh1HSounds_;
std::vector<CombatSample> missWhoosh2HSounds_;
// Impact sound libraries (using 1H axe as base - similar across weapon types)
std::vector<CombatSample> hitFleshSounds_;
std::vector<CombatSample> hitChainSounds_;
std::vector<CombatSample> hitPlateSounds_;
std::vector<CombatSample> hitShieldSounds_;
std::vector<CombatSample> hitMetalWeaponSounds_;
std::vector<CombatSample> hitWoodSounds_;
std::vector<CombatSample> hitStoneSounds_;
std::vector<CombatSample> hitFleshCritSounds_;
std::vector<CombatSample> hitChainCritSounds_;
std::vector<CombatSample> hitPlateCritSounds_;
std::vector<CombatSample> hitShieldCritSounds_;
// Emote sounds
std::vector<CombatSample> clapSounds_;
// Player character vocal libraries
std::vector<CombatSample> bloodElfMaleAttackSounds_;
std::vector<CombatSample> bloodElfMaleWoundSounds_;
std::vector<CombatSample> bloodElfMaleWoundCritSounds_;
std::vector<CombatSample> bloodElfMaleDeathSounds_;
std::vector<CombatSample> bloodElfFemaleAttackSounds_;
std::vector<CombatSample> bloodElfFemaleWoundSounds_;
std::vector<CombatSample> bloodElfFemaleDeathSounds_;
std::vector<CombatSample> draeneiMaleAttackSounds_;
std::vector<CombatSample> draeneiMaleWoundSounds_;
std::vector<CombatSample> draeneiMaleWoundCritSounds_;
std::vector<CombatSample> draeneiMaleDeathSounds_;
std::vector<CombatSample> draeneiFemaleAttackSounds_;
std::vector<CombatSample> draeneiFemaleWoundSounds_;
std::vector<CombatSample> draeneiFemaleWoundCritSounds_;
std::vector<CombatSample> draeneiFemaleDeathSounds_;
// State tracking
float volumeScale_ = 1.0f;
bool initialized_ = false;
// Helper methods
bool loadSound(const std::string& path, CombatSample& sample, pipeline::AssetManager* assets);
void playSound(const std::vector<CombatSample>& library, float volumeMultiplier = 1.0f);
void playRandomSound(const std::vector<CombatSample>& library, float volumeMultiplier = 1.0f);
};
} // namespace audio
} // namespace wowee