diff --git a/include/audio/ambient_sound_manager.hpp b/include/audio/ambient_sound_manager.hpp index c55d53df..6b4c7469 100644 --- a/include/audio/ambient_sound_manager.hpp +++ b/include/audio/ambient_sound_manager.hpp @@ -106,6 +106,7 @@ private: std::vector waterSounds_; std::vector riverSounds_; std::vector waterfallSounds_; + std::vector fountainSounds_; std::vector windSounds_; std::vector tavernSounds_; std::vector blacksmithSounds_; diff --git a/src/audio/ambient_sound_manager.cpp b/src/audio/ambient_sound_manager.cpp index a75514f5..d0131bbb 100644 --- a/src/audio/ambient_sound_manager.cpp +++ b/src/audio/ambient_sound_manager.cpp @@ -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; }