mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-03 20:03:50 +00:00
refactor: decouple Application singleton by extracting core subsystems and updating interfaces
- Add `audio::AudioCoordinator` interface and implementation - Modify `Application` to reduce singleton usage and move controller responsibilities: - application.hpp - application.cpp - Update UI and audio headers/sources: - game_screen.hpp - game_screen.cpp - ui_manager.hpp - audio_coordinator.hpp - audio_coordinator.cpp - Project config touched: - CMakeLists.txt
This commit is contained in:
parent
9b38e64f84
commit
d43397163e
8 changed files with 179 additions and 3 deletions
66
include/audio/audio_coordinator.hpp
Normal file
66
include/audio/audio_coordinator.hpp
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace wowee {
|
||||
namespace pipeline { class AssetManager; }
|
||||
namespace audio {
|
||||
|
||||
class MusicManager;
|
||||
class FootstepManager;
|
||||
class ActivitySoundManager;
|
||||
class MountSoundManager;
|
||||
class NpcVoiceManager;
|
||||
class AmbientSoundManager;
|
||||
class UiSoundManager;
|
||||
class CombatSoundManager;
|
||||
class SpellSoundManager;
|
||||
class MovementSoundManager;
|
||||
|
||||
/// Coordinates all audio subsystems.
|
||||
/// Extracted from Renderer to separate audio lifecycle from rendering.
|
||||
/// Owned by Application; Renderer and UI components access through Application.
|
||||
class AudioCoordinator {
|
||||
public:
|
||||
AudioCoordinator();
|
||||
~AudioCoordinator();
|
||||
|
||||
/// Initialize the audio engine and all managers.
|
||||
/// @return true if audio is available (engine initialized successfully)
|
||||
bool initialize();
|
||||
|
||||
/// Initialize managers that need AssetManager (music lookups, sound banks).
|
||||
void initializeWithAssets(pipeline::AssetManager* assetManager);
|
||||
|
||||
/// Shutdown all audio managers and engine.
|
||||
void shutdown();
|
||||
|
||||
// Accessors for all audio managers (same interface as Renderer had)
|
||||
MusicManager* getMusicManager() { return musicManager_.get(); }
|
||||
FootstepManager* getFootstepManager() { return footstepManager_.get(); }
|
||||
ActivitySoundManager* getActivitySoundManager() { return activitySoundManager_.get(); }
|
||||
MountSoundManager* getMountSoundManager() { return mountSoundManager_.get(); }
|
||||
NpcVoiceManager* getNpcVoiceManager() { return npcVoiceManager_.get(); }
|
||||
AmbientSoundManager* getAmbientSoundManager() { return ambientSoundManager_.get(); }
|
||||
UiSoundManager* getUiSoundManager() { return uiSoundManager_.get(); }
|
||||
CombatSoundManager* getCombatSoundManager() { return combatSoundManager_.get(); }
|
||||
SpellSoundManager* getSpellSoundManager() { return spellSoundManager_.get(); }
|
||||
MovementSoundManager* getMovementSoundManager() { return movementSoundManager_.get(); }
|
||||
|
||||
private:
|
||||
std::unique_ptr<MusicManager> musicManager_;
|
||||
std::unique_ptr<FootstepManager> footstepManager_;
|
||||
std::unique_ptr<ActivitySoundManager> activitySoundManager_;
|
||||
std::unique_ptr<MountSoundManager> mountSoundManager_;
|
||||
std::unique_ptr<NpcVoiceManager> npcVoiceManager_;
|
||||
std::unique_ptr<AmbientSoundManager> ambientSoundManager_;
|
||||
std::unique_ptr<UiSoundManager> uiSoundManager_;
|
||||
std::unique_ptr<CombatSoundManager> combatSoundManager_;
|
||||
std::unique_ptr<SpellSoundManager> spellSoundManager_;
|
||||
std::unique_ptr<MovementSoundManager> movementSoundManager_;
|
||||
|
||||
bool audioAvailable_ = false;
|
||||
};
|
||||
|
||||
} // namespace audio
|
||||
} // namespace wowee
|
||||
Loading…
Add table
Add a link
Reference in a new issue