mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Smooth login music start and lower auth-screen volume
Add configurable fade-in support to MusicManager playback paths and use it for auth/login intro tracks to avoid abrupt starts. Apply a login-only 20% music attenuation while the auth screen is active, then restore the previous music volume when leaving login so in-game volume remains unchanged.
This commit is contained in:
parent
3368dbb9ec
commit
44a947163d
4 changed files with 90 additions and 20 deletions
|
|
@ -18,8 +18,8 @@ public:
|
|||
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 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);
|
||||
void stopMusic(float fadeMs = 2000.0f);
|
||||
void crossfadeTo(const std::string& mpqPath, float fadeMs = 3000.0f);
|
||||
void crossfadeToFile(const std::string& filePath, float fadeMs = 3000.0f);
|
||||
|
|
@ -34,6 +34,7 @@ public:
|
|||
const std::string& getCurrentTrack() const { return currentTrack; }
|
||||
|
||||
private:
|
||||
float effectiveMusicVolume() const;
|
||||
pipeline::AssetManager* assetManager = nullptr;
|
||||
std::string currentTrack;
|
||||
bool currentTrackIsFile = false;
|
||||
|
|
@ -47,6 +48,10 @@ private:
|
|||
bool pendingIsFile = false;
|
||||
float fadeTimer = 0.0f;
|
||||
float fadeDuration = 0.0f;
|
||||
bool fadingIn = false;
|
||||
float fadeInTimer = 0.0f;
|
||||
float fadeInDuration = 0.0f;
|
||||
float fadeInTargetVolume = 0.0f;
|
||||
|
||||
std::unordered_map<std::string, std::vector<uint8_t>> musicDataCache_;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue