mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-09 18:43:51 +00:00
88 lines
2.9 KiB
C++
88 lines
2.9 KiB
C++
|
|
#include "audio/audio_coordinator.hpp"
|
||
|
|
#include "audio/audio_engine.hpp"
|
||
|
|
#include "audio/music_manager.hpp"
|
||
|
|
#include "audio/footstep_manager.hpp"
|
||
|
|
#include "audio/activity_sound_manager.hpp"
|
||
|
|
#include "audio/mount_sound_manager.hpp"
|
||
|
|
#include "audio/npc_voice_manager.hpp"
|
||
|
|
#include "audio/ambient_sound_manager.hpp"
|
||
|
|
#include "audio/ui_sound_manager.hpp"
|
||
|
|
#include "audio/combat_sound_manager.hpp"
|
||
|
|
#include "audio/spell_sound_manager.hpp"
|
||
|
|
#include "audio/movement_sound_manager.hpp"
|
||
|
|
#include "pipeline/asset_manager.hpp"
|
||
|
|
#include "core/logger.hpp"
|
||
|
|
|
||
|
|
namespace wowee {
|
||
|
|
namespace audio {
|
||
|
|
|
||
|
|
AudioCoordinator::AudioCoordinator() = default;
|
||
|
|
|
||
|
|
AudioCoordinator::~AudioCoordinator() {
|
||
|
|
shutdown();
|
||
|
|
}
|
||
|
|
|
||
|
|
bool AudioCoordinator::initialize() {
|
||
|
|
// Initialize AudioEngine (singleton)
|
||
|
|
if (!AudioEngine::instance().initialize()) {
|
||
|
|
LOG_WARNING("Failed to initialize AudioEngine - audio will be disabled");
|
||
|
|
audioAvailable_ = false;
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
audioAvailable_ = true;
|
||
|
|
|
||
|
|
// Create all audio managers (initialized later with asset manager)
|
||
|
|
musicManager_ = std::make_unique<MusicManager>();
|
||
|
|
footstepManager_ = std::make_unique<FootstepManager>();
|
||
|
|
activitySoundManager_ = std::make_unique<ActivitySoundManager>();
|
||
|
|
mountSoundManager_ = std::make_unique<MountSoundManager>();
|
||
|
|
npcVoiceManager_ = std::make_unique<NpcVoiceManager>();
|
||
|
|
ambientSoundManager_ = std::make_unique<AmbientSoundManager>();
|
||
|
|
uiSoundManager_ = std::make_unique<UiSoundManager>();
|
||
|
|
combatSoundManager_ = std::make_unique<CombatSoundManager>();
|
||
|
|
spellSoundManager_ = std::make_unique<SpellSoundManager>();
|
||
|
|
movementSoundManager_ = std::make_unique<MovementSoundManager>();
|
||
|
|
|
||
|
|
LOG_INFO("AudioCoordinator initialized with ", 10, " audio managers");
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
void AudioCoordinator::initializeWithAssets(pipeline::AssetManager* assetManager) {
|
||
|
|
if (!audioAvailable_ || !assetManager) return;
|
||
|
|
|
||
|
|
// MusicManager needs asset manager for zone music lookups
|
||
|
|
if (musicManager_) {
|
||
|
|
musicManager_->initialize(assetManager);
|
||
|
|
}
|
||
|
|
|
||
|
|
// Other managers may need asset manager for sound bank loading
|
||
|
|
// (Add similar calls as needed for other managers)
|
||
|
|
|
||
|
|
LOG_INFO("AudioCoordinator initialized with asset manager");
|
||
|
|
}
|
||
|
|
|
||
|
|
void AudioCoordinator::shutdown() {
|
||
|
|
// Reset all managers first (they may reference AudioEngine)
|
||
|
|
movementSoundManager_.reset();
|
||
|
|
spellSoundManager_.reset();
|
||
|
|
combatSoundManager_.reset();
|
||
|
|
uiSoundManager_.reset();
|
||
|
|
ambientSoundManager_.reset();
|
||
|
|
npcVoiceManager_.reset();
|
||
|
|
mountSoundManager_.reset();
|
||
|
|
activitySoundManager_.reset();
|
||
|
|
footstepManager_.reset();
|
||
|
|
musicManager_.reset();
|
||
|
|
|
||
|
|
// Shutdown audio engine last
|
||
|
|
if (audioAvailable_) {
|
||
|
|
AudioEngine::instance().shutdown();
|
||
|
|
audioAvailable_ = false;
|
||
|
|
}
|
||
|
|
|
||
|
|
LOG_INFO("AudioCoordinator shutdown complete");
|
||
|
|
}
|
||
|
|
|
||
|
|
} // namespace audio
|
||
|
|
} // namespace wowee
|