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.0.7.4.1
parent
a76a289d11
commit
d89faa3c16
|
@ -119,17 +119,20 @@ namespace OpenSim.Region.CoreModules.World.Sound
|
||||||
m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
|
m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
|
||||||
{
|
{
|
||||||
double dis = Util.GetDistanceTo(sp.AbsolutePosition, position);
|
double dis = Util.GetDistanceTo(sp.AbsolutePosition, position);
|
||||||
|
|
||||||
if (dis > 100.0) // Max audio distance
|
if (dis > 100.0) // Max audio distance
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
float thisSpGain;
|
||||||
|
|
||||||
// Scale by distance
|
// Scale by distance
|
||||||
if (radius == 0)
|
if (radius == 0)
|
||||||
gain = (float)((double)gain * ((100.0 - dis) / 100.0));
|
thisSpGain = (float)((double)gain * ((100.0 - dis) / 100.0));
|
||||||
else
|
else
|
||||||
gain = (float)((double)gain * ((radius - dis) / radius));
|
thisSpGain = (float)((double)gain * ((radius - dis) / radius));
|
||||||
|
|
||||||
sp.ControllingClient.SendTriggeredSound(
|
sp.ControllingClient.SendTriggeredSound(
|
||||||
soundId, ownerID, objectID, parentID, handle, position, (float)gain);
|
soundId, ownerID, objectID, parentID, handle, position, thisSpGain);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue