feat: play audio notification when a whisper is received

Adds UiSoundManager::playWhisperReceived() which uses the dedicated
Whisper_TellMale/Female.wav files (or falls back to iSelectTarget.wav
if absent). The sound is triggered once per new incoming CHAT_MSG_WHISPER
message by scanning new chat history entries in the raid warning overlay
update loop.
This commit is contained in:
Kelsi 2026-03-12 06:12:37 -07:00
parent bcd984c1c5
commit 39bf8fb01e
3 changed files with 21 additions and 0 deletions

View file

@ -75,6 +75,9 @@ public:
void playTargetSelect(); void playTargetSelect();
void playTargetDeselect(); void playTargetDeselect();
// Chat notifications
void playWhisperReceived();
private: private:
struct UISample { struct UISample {
std::string path; std::string path;
@ -122,6 +125,7 @@ private:
std::vector<UISample> errorSounds_; std::vector<UISample> errorSounds_;
std::vector<UISample> selectTargetSounds_; std::vector<UISample> selectTargetSounds_;
std::vector<UISample> deselectTargetSounds_; std::vector<UISample> deselectTargetSounds_;
std::vector<UISample> whisperSounds_;
// State tracking // State tracking
float volumeScale_ = 1.0f; float volumeScale_ = 1.0f;

View file

@ -122,6 +122,14 @@ bool UiSoundManager::initialize(pipeline::AssetManager* assets) {
deselectTargetSounds_.resize(1); deselectTargetSounds_.resize(1);
loadSound("Sound\\Interface\\iDeselectTarget.wav", deselectTargetSounds_[0], assets); loadSound("Sound\\Interface\\iDeselectTarget.wav", deselectTargetSounds_[0], assets);
// Whisper notification (falls back to iSelectTarget if the dedicated file is absent)
whisperSounds_.resize(1);
if (!loadSound("Sound\\Interface\\Whisper_TellMale.wav", whisperSounds_[0], assets)) {
if (!loadSound("Sound\\Interface\\Whisper_TellFemale.wav", whisperSounds_[0], assets)) {
whisperSounds_ = selectTargetSounds_;
}
}
LOG_INFO("UISoundManager: Window sounds - Bag: ", (bagOpenLoaded && bagCloseLoaded) ? "YES" : "NO", LOG_INFO("UISoundManager: Window sounds - Bag: ", (bagOpenLoaded && bagCloseLoaded) ? "YES" : "NO",
", QuestLog: ", (questLogOpenLoaded && questLogCloseLoaded) ? "YES" : "NO", ", QuestLog: ", (questLogOpenLoaded && questLogCloseLoaded) ? "YES" : "NO",
", CharSheet: ", (charSheetOpenLoaded && charSheetCloseLoaded) ? "YES" : "NO"); ", CharSheet: ", (charSheetOpenLoaded && charSheetCloseLoaded) ? "YES" : "NO");
@ -225,5 +233,8 @@ void UiSoundManager::playError() { playSound(errorSounds_); }
void UiSoundManager::playTargetSelect() { playSound(selectTargetSounds_); } void UiSoundManager::playTargetSelect() { playSound(selectTargetSounds_); }
void UiSoundManager::playTargetDeselect() { playSound(deselectTargetSounds_); } void UiSoundManager::playTargetDeselect() { playSound(deselectTargetSounds_); }
// Chat notifications
void UiSoundManager::playWhisperReceived() { playSound(whisperSounds_); }
} // namespace audio } // namespace audio
} // namespace wowee } // namespace wowee

View file

@ -6325,6 +6325,7 @@ void GameScreen::renderRaidWarningOverlay(game::GameHandler& gameHandler) {
// Walk only the new messages (deque — iterate from back by skipping old ones) // Walk only the new messages (deque — iterate from back by skipping old ones)
size_t toScan = newCount - raidWarnChatSeenCount_; size_t toScan = newCount - raidWarnChatSeenCount_;
size_t startIdx = newCount > toScan ? newCount - toScan : 0; size_t startIdx = newCount > toScan ? newCount - toScan : 0;
auto* renderer = core::Application::getInstance().getRenderer();
for (size_t i = startIdx; i < newCount; ++i) { for (size_t i = startIdx; i < newCount; ++i) {
const auto& msg = chatHistory[i]; const auto& msg = chatHistory[i];
if (msg.type == game::ChatType::RAID_WARNING || if (msg.type == game::ChatType::RAID_WARNING ||
@ -6338,6 +6339,11 @@ void GameScreen::renderRaidWarningOverlay(game::GameHandler& gameHandler) {
if (raidWarnEntries_.size() > 3) if (raidWarnEntries_.size() > 3)
raidWarnEntries_.erase(raidWarnEntries_.begin()); raidWarnEntries_.erase(raidWarnEntries_.begin());
} }
// Whisper audio notification
if (msg.type == game::ChatType::WHISPER && renderer) {
if (auto* ui = renderer->getUiSoundManager())
ui->playWhisperReceived();
}
} }
raidWarnChatSeenCount_ = newCount; raidWarnChatSeenCount_ = newCount;
} }