mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 15:50:20 +00:00
- Implement AmbientSoundManager with tavern/outdoor ambience - Fix audio buffer limit (5s → 60s) for long ambient loops - Set log level to INFO to eliminate DEBUG spam (130MB → 3.2MB logs) - Remove excessive terrain/model/network logging - Fix ambient sound timer sharing and pitch parameter bugs
47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
|
|
namespace wowee {
|
|
namespace pipeline { class AssetManager; }
|
|
|
|
namespace audio {
|
|
|
|
class MusicManager {
|
|
public:
|
|
MusicManager();
|
|
~MusicManager();
|
|
|
|
bool initialize(pipeline::AssetManager* assets);
|
|
void shutdown();
|
|
|
|
void playMusic(const std::string& mpqPath, bool loop = true);
|
|
void playFilePath(const std::string& filePath, bool loop = true);
|
|
void stopMusic(float fadeMs = 2000.0f);
|
|
void crossfadeTo(const std::string& mpqPath, float fadeMs = 3000.0f);
|
|
void update(float deltaTime);
|
|
void setVolume(int volume);
|
|
int getVolume() const { return volumePercent; }
|
|
void setUnderwaterMode(bool underwater);
|
|
|
|
bool isPlaying() const { return playing; }
|
|
bool isInitialized() const { return assetManager != nullptr; }
|
|
const std::string& getCurrentTrack() const { return currentTrack; }
|
|
|
|
private:
|
|
pipeline::AssetManager* assetManager = nullptr;
|
|
std::string currentTrack;
|
|
bool currentTrackIsFile = false;
|
|
bool playing = false;
|
|
int volumePercent = 30;
|
|
bool underwaterMode = false;
|
|
|
|
// Crossfade state
|
|
bool crossfading = false;
|
|
std::string pendingTrack;
|
|
float fadeTimer = 0.0f;
|
|
float fadeDuration = 0.0f;
|
|
};
|
|
|
|
} // namespace audio
|
|
} // namespace wowee
|