mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-04 16:23:52 +00:00
Add audio volume controls to settings
This commit is contained in:
parent
12a7604450
commit
1530900bc7
9 changed files with 79 additions and 5 deletions
|
|
@ -30,6 +30,8 @@ public:
|
|||
void playWaterEnter();
|
||||
void playWaterExit();
|
||||
void playMeleeSwing();
|
||||
void setVolumeScale(float scale) { volumeScale = scale; }
|
||||
float getVolumeScale() const { return volumeScale; }
|
||||
|
||||
private:
|
||||
struct Sample {
|
||||
|
|
@ -66,6 +68,7 @@ private:
|
|||
std::chrono::steady_clock::time_point lastMeleeSwingAt{};
|
||||
bool meleeSwingWarned = false;
|
||||
std::string voiceProfileKey;
|
||||
float volumeScale = 1.0f;
|
||||
|
||||
void preloadCandidates(std::vector<Sample>& out, const std::vector<std::string>& candidates);
|
||||
void preloadLandingSet(FootstepSurface surface, const std::string& material);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ public:
|
|||
|
||||
void update(float deltaTime);
|
||||
void playFootstep(FootstepSurface surface, bool sprinting);
|
||||
void setVolumeScale(float scale) { volumeScale = scale; }
|
||||
float getVolumeScale() const { return volumeScale; }
|
||||
|
||||
bool isInitialized() const { return assetManager != nullptr; }
|
||||
bool hasAnySamples() const { return sampleCount > 0; }
|
||||
|
|
@ -61,6 +63,7 @@ private:
|
|||
std::chrono::steady_clock::time_point lastPlayTime = std::chrono::steady_clock::time_point{};
|
||||
|
||||
std::mt19937 rng;
|
||||
float volumeScale = 1.0f;
|
||||
};
|
||||
|
||||
} // namespace audio
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ public:
|
|||
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; }
|
||||
|
||||
bool isPlaying() const { return playing; }
|
||||
bool isInitialized() const { return assetManager != nullptr; }
|
||||
|
|
@ -32,9 +34,11 @@ private:
|
|||
|
||||
pipeline::AssetManager* assetManager = nullptr;
|
||||
std::string currentTrack;
|
||||
bool currentTrackIsFile = false;
|
||||
std::string tempFilePath;
|
||||
ProcessHandle playerPid = INVALID_PROCESS;
|
||||
bool playing = false;
|
||||
int volumePercent = 30;
|
||||
|
||||
// Crossfade state
|
||||
bool crossfading = false;
|
||||
|
|
|
|||
|
|
@ -131,6 +131,8 @@ public:
|
|||
double getLastWMORenderMs() const { return lastWMORenderMs; }
|
||||
double getLastM2RenderMs() const { return lastM2RenderMs; }
|
||||
audio::MusicManager* getMusicManager() { return musicManager.get(); }
|
||||
audio::FootstepManager* getFootstepManager() { return footstepManager.get(); }
|
||||
audio::ActivitySoundManager* getActivitySoundManager() { return activitySoundManager.get(); }
|
||||
|
||||
private:
|
||||
core::Window* window = nullptr;
|
||||
|
|
|
|||
|
|
@ -61,6 +61,8 @@ private:
|
|||
bool pendingVsync = false;
|
||||
int pendingResIndex = 0;
|
||||
bool pendingShadows = true;
|
||||
int pendingMusicVolume = 30;
|
||||
int pendingSfxVolume = 100;
|
||||
|
||||
/**
|
||||
* Render player info window
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue