Add fountain positional ambient sounds

Implemented fountain sounds as positional audio emitters:

Technical details:
- Added fountainSounds_ library (FountainSmallMediumLoop.wav)
- Fountain type already existed in AmbientType enum but was unused
- 6 second loop interval for fountain sounds
- Volume at 0.8x water volume for gentle bubbling effect
- Max distance: 35 units (same as other water sources)
- Counted in activeWaterCount limit (max 3 water sources at once)
- Spatial 3D audio based on fountain position
- Can be placed via addEmitter(position, AmbientType::FOUNTAIN)
This commit is contained in:
Kelsi 2026-02-09 16:27:16 -08:00
parent cfb64f1d24
commit 3a37299443
2 changed files with 15 additions and 1 deletions

View file

@ -106,6 +106,7 @@ private:
std::vector<AmbientSample> waterSounds_;
std::vector<AmbientSample> riverSounds_;
std::vector<AmbientSample> waterfallSounds_;
std::vector<AmbientSample> fountainSounds_;
std::vector<AmbientSample> windSounds_;
std::vector<AmbientSample> tavernSounds_;
std::vector<AmbientSample> blacksmithSounds_;

View file

@ -66,6 +66,10 @@ bool AmbientSoundManager::initialize(pipeline::AssetManager* assets) {
waterfallSounds_.resize(1);
loadSound("Sound\\Doodad\\WaterFallSmall.wav", waterfallSounds_[0], assets);
// Load fountain sounds
fountainSounds_.resize(1);
loadSound("Sound\\Doodad\\FountainSmallMediumLoop.wav", fountainSounds_[0], assets);
// Load wind/ambience sounds
windSounds_.resize(1);
bool windLoaded = loadSound("Sound\\Ambience\\ZoneAmbience\\ForestNormalDay.wav", windSounds_[0], assets);
@ -304,7 +308,8 @@ void AmbientSoundManager::updatePositionalEmitters(float deltaTime, const glm::v
isFire = true;
} else if (emitter.type == AmbientType::WATER_SURFACE ||
emitter.type == AmbientType::RIVER ||
emitter.type == AmbientType::WATERFALL) {
emitter.type == AmbientType::WATERFALL ||
emitter.type == AmbientType::FOUNTAIN) {
maxDist = MAX_WATER_DISTANCE;
isWater = true;
}
@ -379,6 +384,14 @@ void AmbientSoundManager::updatePositionalEmitters(float deltaTime, const glm::v
}
break;
case AmbientType::FOUNTAIN:
if (emitter.lastPlayTime >= 6.0f && !fountainSounds_.empty() && fountainSounds_[0].loaded) {
float volume = WATER_VOLUME * 0.8f * volumeScale_ * (1.0f - (distance / maxDist));
AudioEngine::instance().playSound3D(fountainSounds_[0].data, emitter.position, volume);
emitter.lastPlayTime = 0.0f;
}
break;
default:
break;
}