MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / playSpatialSound

Method playSpatialSound

source/sound/SoundEffectsManager.cpp:201–220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199}
200
201void SoundEffectsManager::playSpatialSound(const std::string& family,
202 float XPos, float YPos, float height)
203{
204 auto it = mSpatialSounds.find(family);
205 if(it == mSpatialSounds.end())
206 {
207 OD_LOG_ERR("Couldn't find sound family=" + family);
208 return;
209 }
210
211 std::vector<GameSound*>& sounds = it->second;
212 if(sounds.empty())
213 {
214 OD_LOG_ERR("No sound found for sound family=" + family);
215 return;
216 }
217
218 unsigned int soundId = Random::Uint(0, sounds.size() - 1);
219 sounds[soundId]->play(XPos, YPos, height);
220}
221
222void SoundEffectsManager::playRelativeSound(const std::string& family)
223{

Callers 1

processMessageMethod · 0.80

Calls 2

UintFunction · 0.85
playMethod · 0.45

Tested by

no test coverage detected