2026-02-02 12:24:50 -08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <string>
|
2026-02-11 18:25:04 -08:00
|
|
|
#include <cstdint>
|
|
|
|
|
#include <unordered_map>
|
|
|
|
|
#include <vector>
|
2026-02-02 12:24:50 -08:00
|
|
|
|
|
|
|
|
namespace wowee {
|
|
|
|
|
namespace pipeline { class AssetManager; }
|
|
|
|
|
|
|
|
|
|
namespace audio {
|
|
|
|
|
|
|
|
|
|
class MusicManager {
|
|
|
|
|
public:
|
|
|
|
|
MusicManager();
|
|
|
|
|
~MusicManager();
|
|
|
|
|
|
|
|
|
|
bool initialize(pipeline::AssetManager* assets);
|
|
|
|
|
void shutdown();
|
|
|
|
|
|
2026-02-20 20:34:06 -08:00
|
|
|
void playMusic(const std::string& mpqPath, bool loop = true, float fadeInMs = 0.0f);
|
|
|
|
|
void playFilePath(const std::string& filePath, bool loop = true, float fadeInMs = 0.0f);
|
2026-02-02 12:24:50 -08:00
|
|
|
void stopMusic(float fadeMs = 2000.0f);
|
|
|
|
|
void crossfadeTo(const std::string& mpqPath, float fadeMs = 3000.0f);
|
Add original music to login rotation and zone playlists
11 original tracks in assets/Original Music/ now play on the login
screen and in thematically matched zones across Eastern Kingdoms and
Kalimdor. Added crossfadeToFile to MusicManager for local file
playback during zone transitions. New zones: Tirisfal, Undercity,
Barrens, STV, Duskwood, Burning Steppes, Searing Gorge, Ironforge,
Loch Modan, Orgrimmar, Durotar, Mulgore, Thunder Bluff, Darkshore,
Teldrassil, Darnassus.
2026-02-15 05:53:27 -08:00
|
|
|
void crossfadeToFile(const std::string& filePath, float fadeMs = 3000.0f);
|
2026-02-02 12:24:50 -08:00
|
|
|
void update(float deltaTime);
|
2026-02-05 17:32:21 -08:00
|
|
|
void setVolume(int volume);
|
|
|
|
|
int getVolume() const { return volumePercent; }
|
2026-02-09 14:50:14 -08:00
|
|
|
void setUnderwaterMode(bool underwater);
|
2026-02-11 18:25:04 -08:00
|
|
|
void preloadMusic(const std::string& mpqPath);
|
2026-02-02 12:24:50 -08:00
|
|
|
|
|
|
|
|
bool isPlaying() const { return playing; }
|
|
|
|
|
bool isInitialized() const { return assetManager != nullptr; }
|
|
|
|
|
const std::string& getCurrentTrack() const { return currentTrack; }
|
|
|
|
|
|
|
|
|
|
private:
|
2026-02-20 20:34:06 -08:00
|
|
|
float effectiveMusicVolume() const;
|
2026-02-02 12:24:50 -08:00
|
|
|
pipeline::AssetManager* assetManager = nullptr;
|
|
|
|
|
std::string currentTrack;
|
2026-02-05 17:32:21 -08:00
|
|
|
bool currentTrackIsFile = false;
|
2026-02-02 12:24:50 -08:00
|
|
|
bool playing = false;
|
2026-02-05 17:32:21 -08:00
|
|
|
int volumePercent = 30;
|
2026-02-09 14:50:14 -08:00
|
|
|
bool underwaterMode = false;
|
2026-02-02 12:24:50 -08:00
|
|
|
|
|
|
|
|
// Crossfade state
|
|
|
|
|
bool crossfading = false;
|
|
|
|
|
std::string pendingTrack;
|
Add original music to login rotation and zone playlists
11 original tracks in assets/Original Music/ now play on the login
screen and in thematically matched zones across Eastern Kingdoms and
Kalimdor. Added crossfadeToFile to MusicManager for local file
playback during zone transitions. New zones: Tirisfal, Undercity,
Barrens, STV, Duskwood, Burning Steppes, Searing Gorge, Ironforge,
Loch Modan, Orgrimmar, Durotar, Mulgore, Thunder Bluff, Darkshore,
Teldrassil, Darnassus.
2026-02-15 05:53:27 -08:00
|
|
|
bool pendingIsFile = false;
|
2026-02-02 12:24:50 -08:00
|
|
|
float fadeTimer = 0.0f;
|
|
|
|
|
float fadeDuration = 0.0f;
|
2026-02-20 20:34:06 -08:00
|
|
|
bool fadingIn = false;
|
|
|
|
|
float fadeInTimer = 0.0f;
|
|
|
|
|
float fadeInDuration = 0.0f;
|
|
|
|
|
float fadeInTargetVolume = 0.0f;
|
2026-03-09 16:30:42 -07:00
|
|
|
// Fade-out state (for stopMusic with fadeMs > 0)
|
|
|
|
|
bool fadingOut = false;
|
|
|
|
|
float fadeOutTimer = 0.0f;
|
|
|
|
|
float fadeOutDuration = 0.0f;
|
|
|
|
|
float fadeOutStartVolume = 0.0f;
|
2026-02-11 18:25:04 -08:00
|
|
|
|
|
|
|
|
std::unordered_map<std::string, std::vector<uint8_t>> musicDataCache_;
|
2026-02-02 12:24:50 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace audio
|
|
|
|
|
} // namespace wowee
|