Implement bird/cricket ambient sounds and remove stale renderer TODO
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run

- Add birdSounds_ and cricketSounds_ AmbientSample vectors to
  AmbientSoundManager, loaded from WoW MPQ paths:
  BirdAmbience/BirdChirp01-06.wav (up to 6 variants, daytime) and
  Insect/InsectMorning.wav + InsectNight.wav (nighttime). Missing files
  are silently skipped so the game runs without an MPQ too.
- updatePeriodicSounds() now plays a randomly chosen loaded variant
  at the scheduled interval instead of the previous no-op placeholder.
- Remove stale "TODO Phase 6: Vulkan underwater overlay" comment from
  Renderer::initialize(); the feature has been fully implemented in
  renderOverlay() / the swim effects pipeline since that comment was
  written.
This commit is contained in:
Kelsi 2026-03-09 19:00:42 -07:00
parent 6cba3f5c95
commit 3eded6772d
3 changed files with 42 additions and 7 deletions

View file

@ -83,6 +83,34 @@ bool AmbientSoundManager::initialize(pipeline::AssetManager* assets) {
blacksmithSounds_.resize(1);
bool blacksmithLoaded = loadSound("Sound\\Ambience\\WMOAmbience\\BlackSmith.wav", blacksmithSounds_[0], assets);
// Load bird chirp sounds (daytime periodic) — up to 6 variants
{
static const char* birdPaths[] = {
"Sound\\Ambience\\BirdAmbience\\BirdChirp01.wav",
"Sound\\Ambience\\BirdAmbience\\BirdChirp02.wav",
"Sound\\Ambience\\BirdAmbience\\BirdChirp03.wav",
"Sound\\Ambience\\BirdAmbience\\BirdChirp04.wav",
"Sound\\Ambience\\BirdAmbience\\BirdChirp05.wav",
"Sound\\Ambience\\BirdAmbience\\BirdChirp06.wav",
};
for (const char* p : birdPaths) {
birdSounds_.emplace_back();
if (!loadSound(p, birdSounds_.back(), assets)) birdSounds_.pop_back();
}
}
// Load cricket/insect sounds (nighttime periodic)
{
static const char* cricketPaths[] = {
"Sound\\Ambience\\Insect\\InsectMorning.wav",
"Sound\\Ambience\\Insect\\InsectNight.wav",
};
for (const char* p : cricketPaths) {
cricketSounds_.emplace_back();
if (!loadSound(p, cricketSounds_.back(), assets)) cricketSounds_.pop_back();
}
}
// Load weather sounds
rainLightSounds_.resize(1);
bool rainLightLoaded = loadSound("Sound\\Ambience\\Weather\\RainLight.wav", rainLightSounds_[0], assets);
@ -413,9 +441,13 @@ void AmbientSoundManager::updatePeriodicSounds(float deltaTime, bool isIndoor, b
if (isDaytime()) {
birdTimer_ += deltaTime;
if (birdTimer_ >= randomFloat(BIRD_MIN_INTERVAL, BIRD_MAX_INTERVAL)) {
// Play a random bird chirp (we'll use wind sound as placeholder for now)
// TODO: Add actual bird sound files when available
birdTimer_ = 0.0f;
if (!birdSounds_.empty()) {
std::uniform_int_distribution<size_t> pick(0, birdSounds_.size() - 1);
const auto& snd = birdSounds_[pick(gen)];
if (snd.loaded)
AudioEngine::instance().playSound2D(snd.data, BIRD_VOLUME, 1.0f);
}
}
}
@ -423,9 +455,13 @@ void AmbientSoundManager::updatePeriodicSounds(float deltaTime, bool isIndoor, b
if (isNighttime()) {
cricketTimer_ += deltaTime;
if (cricketTimer_ >= randomFloat(CRICKET_MIN_INTERVAL, CRICKET_MAX_INTERVAL)) {
// Play cricket sounds
// TODO: Add actual cricket sound files when available
cricketTimer_ = 0.0f;
if (!cricketSounds_.empty()) {
std::uniform_int_distribution<size_t> pick(0, cricketSounds_.size() - 1);
const auto& snd = cricketSounds_[pick(gen)];
if (snd.loaded)
AudioEngine::instance().playSound2D(snd.data, CRICKET_VOLUME, 1.0f);
}
}
}
}