Mantis#1406. Thank you kindly, Xantor for a patch that:

llLoopSound sends out one packet to clients in view, so it doesn't work anymore 
when clients enter later on, or the prim is modified in any way.
Solution: Stored sound data on prim, send full update instead.
llStartSound and llLoopSound now accept both LLUUIDs to a sound as well as object 
inventory sound names. llStopSound clears prim data and sends full update.
This commit is contained in:
Charles Krinke
2008-05-28 14:03:08 +00:00
parent de43c2db57
commit 06147d0492
6 changed files with 85 additions and 11 deletions

View File

@@ -1390,16 +1390,59 @@ namespace OpenSim.Region.ScriptEngine.Common
Deprecated("llSound");
}
// Xantor 20080528 PlaySound updated so it accepts an objectinventory name -or- a key to a sound
public void llPlaySound(string sound, double volume)
{
m_host.AddScriptLPS(1);
LLUUID key = LLUUID.Zero;
// if we can parse the string as a key, use it.
if (LLUUID.TryParse(sound, out key))
{
sound = key.ToString();
}
// else try to locate the name in inventory of object. found returns key,
// not found returns LLUUID.Zero
else
{
sound = InventoryKey(sound).ToString();
}
// send the sound, once, to all clients in range
m_host.SendSound(sound, volume, false, 0);
}
// Xantor 20080528 we should do this differently.
// 1) apply the sound to the object
// 2) schedule full update
// just sending the sound out once doesn't work so well when other avatars come in view later on
// or when the prim gets moved, changed, sat on, whatever
// see large number of mantises (mantes?)
public void llLoopSound(string sound, double volume)
{
m_host.AddScriptLPS(1);
m_host.SendSound(sound, volume, false, 1);
// m_host.SendSound(sound, volume, false, 1);
LLUUID key = LLUUID.Zero;
// if we can parse the string as a key, use it.
if (LLUUID.TryParse(sound, out key))
{
m_host.Sound = key;
}
// else try to locate the name in inventory of object. found returns key,
// not found returns LLUUID.Zero
else
{
m_host.Sound = InventoryKey(sound.ToString());
}
m_host.SoundGain = volume;
m_host.SoundFlags = 1; // looping
m_host.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable?
m_host.SendFullUpdateToAllClients();
}
public void llLoopSoundMaster(string sound, double volume)
@@ -1426,10 +1469,19 @@ namespace OpenSim.Region.ScriptEngine.Common
m_host.SendSound(sound, volume, true, 0);
}
// Xantor 20080528: Clear prim data of sound instead
public void llStopSound()
{
m_host.AddScriptLPS(1);
m_host.SendSound(LLUUID.Zero.ToString(), 1.0, false, 2);
m_host.Sound = LLUUID.Zero;
m_host.SoundGain = 0;
m_host.SoundFlags = 0;
m_host.SoundRadius = 0;
m_host.SendFullUpdateToAllClients();
// m_host.SendSound(LLUUID.Zero.ToString(), 1.0, false, 2);
}
public void llPreloadSound(string sound)