Fix bug in SoundModule.TriggerSound() where every sound update to an avatar would base its gain calculation on the previous avatar's gain, instead of the original input gain.

This was making sound attenuate oddly when there were NPCs in the region, though it could also happen with ordinary avatars.
This commit is contained in:
Justin Clark-Casey (justincc)
2012-07-31 22:52:17 +01:00
parent a76a289d11
commit d89faa3c16

View File

@@ -119,17 +119,20 @@ namespace OpenSim.Region.CoreModules.World.Sound
m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
{
double dis = Util.GetDistanceTo(sp.AbsolutePosition, position);
if (dis > 100.0) // Max audio distance
return;
float thisSpGain;
// Scale by distance
if (radius == 0)
gain = (float)((double)gain * ((100.0 - dis) / 100.0));
thisSpGain = (float)((double)gain * ((100.0 - dis) / 100.0));
else
gain = (float)((double)gain * ((radius - dis) / radius));
thisSpGain = (float)((double)gain * ((radius - dis) / radius));
sp.ControllingClient.SendTriggeredSound(
soundId, ownerID, objectID, parentID, handle, position, (float)gain);
soundId, ownerID, objectID, parentID, handle, position, thisSpGain);
});
}
}