diff options
author | Charles Krinke | 2008-05-28 14:03:08 +0000 |
---|---|---|
committer | Charles Krinke | 2008-05-28 14:03:08 +0000 |
commit | 06147d0492e91c06a7d8f3a19c20897033f560a3 (patch) | |
tree | 5010f60eafa04b6907c5edc5d2233b06584d4c8e /OpenSim | |
parent | Mantis#1398. Thank you kindly, cmickeyb for a patch that: (diff) | |
download | opensim-SC-06147d0492e91c06a7d8f3a19c20897033f560a3.zip opensim-SC-06147d0492e91c06a7d8f3a19c20897033f560a3.tar.gz opensim-SC-06147d0492e91c06a7d8f3a19c20897033f560a3.tar.bz2 opensim-SC-06147d0492e91c06a7d8f3a19c20897033f560a3.tar.xz |
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.
Diffstat (limited to 'OpenSim')
6 files changed, 85 insertions, 11 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 48b4eb3..f5e98c8 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs | |||
@@ -892,7 +892,7 @@ namespace OpenSim.Framework | |||
892 | LLVector3 pos, LLVector3 vel, LLVector3 acc, LLQuaternion rotation, LLVector3 rvel, | 892 | LLVector3 pos, LLVector3 vel, LLVector3 acc, LLQuaternion rotation, LLVector3 rvel, |
893 | uint flags, | 893 | uint flags, |
894 | LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, | 894 | LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, |
895 | byte clickAction, byte[] textureanim, bool attachment, uint AttachPoint, LLUUID AssetId); | 895 | byte clickAction, byte[] textureanim, bool attachment, uint AttachPoint, LLUUID AssetId, LLUUID SoundId, double SoundVolume, byte SoundFlags, double SoundRadius); |
896 | 896 | ||
897 | 897 | ||
898 | void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, | 898 | void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 853d550..440392a 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -2194,7 +2194,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2194 | SendPrimitiveToClient(regionHandle, timeDilation, localID, primShape, pos, vel, | 2194 | SendPrimitiveToClient(regionHandle, timeDilation, localID, primShape, pos, vel, |
2195 | acc, rotation, rvel, flags, | 2195 | acc, rotation, rvel, flags, |
2196 | objectID, ownerID, text, color, parentID, particleSystem, | 2196 | objectID, ownerID, text, color, parentID, particleSystem, |
2197 | clickAction, textureanim, false,(uint)0, LLUUID.Zero); | 2197 | clickAction, textureanim, false,(uint)0, LLUUID.Zero, LLUUID.Zero,0,0,0); |
2198 | } | 2198 | } |
2199 | 2199 | ||
2200 | public void SendPrimitiveToClient( | 2200 | public void SendPrimitiveToClient( |
@@ -2202,12 +2202,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2202 | LLVector3 pos, LLVector3 velocity, LLVector3 acceleration, LLQuaternion rotation, LLVector3 rotational_velocity, | 2202 | LLVector3 pos, LLVector3 velocity, LLVector3 acceleration, LLQuaternion rotation, LLVector3 rotational_velocity, |
2203 | uint flags, | 2203 | uint flags, |
2204 | LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, | 2204 | LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, |
2205 | byte clickAction, byte[] textureanim, bool attachment, uint AttachPoint, LLUUID AssetId) | 2205 | byte clickAction, byte[] textureanim, bool attachment, uint AttachPoint, LLUUID AssetId, LLUUID SoundId, double SoundGain, byte SoundFlags, double SoundRadius) |
2206 | { | 2206 | { |
2207 | if (rotation.X == rotation.Y && rotation.Y == rotation.Z && rotation.Z == rotation.W && rotation.W == 0) | 2207 | if (rotation.X == rotation.Y && rotation.Y == rotation.Z && rotation.Z == rotation.W && rotation.W == 0) |
2208 | rotation = LLQuaternion.Identity; | 2208 | rotation = LLQuaternion.Identity; |
2209 | 2209 | ||
2210 | ObjectUpdatePacket outPacket = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); | 2210 | ObjectUpdatePacket outPacket = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); |
2211 | |||
2212 | |||
2213 | |||
2211 | // TODO: don't create new blocks if recycling an old packet | 2214 | // TODO: don't create new blocks if recycling an old packet |
2212 | outPacket.RegionData.RegionHandle = regionHandle; | 2215 | outPacket.RegionData.RegionHandle = regionHandle; |
2213 | outPacket.RegionData.TimeDilation = timeDilation; | 2216 | outPacket.RegionData.TimeDilation = timeDilation; |
@@ -2234,7 +2237,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2234 | outPacket.ObjectData[0].ParentID = parentID; | 2237 | outPacket.ObjectData[0].ParentID = parentID; |
2235 | outPacket.ObjectData[0].PSBlock = particleSystem; | 2238 | outPacket.ObjectData[0].PSBlock = particleSystem; |
2236 | outPacket.ObjectData[0].ClickAction = clickAction; | 2239 | outPacket.ObjectData[0].ClickAction = clickAction; |
2237 | //outPacket.ObjectData[0].Flags = 0; | 2240 | outPacket.ObjectData[0].Flags = 0; |
2238 | 2241 | ||
2239 | if (attachment) | 2242 | if (attachment) |
2240 | { | 2243 | { |
@@ -2248,8 +2251,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2248 | outPacket.ObjectData[0].State = (byte)((AttachPoint % 16) * 16 + (AttachPoint / 16)); | 2251 | outPacket.ObjectData[0].State = (byte)((AttachPoint % 16) * 16 + (AttachPoint / 16)); |
2249 | } | 2252 | } |
2250 | 2253 | ||
2251 | // Sound Radius | 2254 | // Xantor 20080528: Send sound info as well |
2252 | outPacket.ObjectData[0].Radius = 20; | 2255 | outPacket.ObjectData[0].Sound = SoundId; |
2256 | outPacket.ObjectData[0].OwnerID = ownerID; | ||
2257 | outPacket.ObjectData[0].Gain = (float) SoundGain; | ||
2258 | outPacket.ObjectData[0].Radius = (float) SoundRadius; | ||
2259 | outPacket.ObjectData[0].Flags = SoundFlags; | ||
2260 | |||
2253 | 2261 | ||
2254 | byte[] pb = pos.GetBytes(); | 2262 | byte[] pb = pos.GetBytes(); |
2255 | Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); | 2263 | Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); |
diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index bad089d..caa3b5c 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs | |||
@@ -515,7 +515,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC | |||
515 | LLUUID objectID, LLUUID ownerID, string text, byte[] color, | 515 | LLUUID objectID, LLUUID ownerID, string text, byte[] color, |
516 | uint parentID, | 516 | uint parentID, |
517 | byte[] particleSystem, byte clickAction, byte[] textureanimation, | 517 | byte[] particleSystem, byte clickAction, byte[] textureanimation, |
518 | bool attachment, uint AttachmentPoint, LLUUID AssetId) | 518 | bool attachment, uint AttachmentPoint, LLUUID AssetId, LLUUID SoundId, double SoundVolume, byte SoundFlags, double SoundRadius) |
519 | { | 519 | { |
520 | } | 520 | } |
521 | public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, | 521 | public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 4610c99..9afffbe 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -592,6 +592,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
592 | } | 592 | } |
593 | } | 593 | } |
594 | 594 | ||
595 | //Xantor 20080528 Sound stuff: | ||
596 | // Note: This isn't persisted in the database right now, as the fields for that aren't just there yet. | ||
597 | // Not a big problem as long as the script that sets it remains in the prim on startup. | ||
598 | // for SL compatibility it should be persisted though (set sound / displaytext / particlesystem, kill script) | ||
599 | [XmlIgnore] | ||
600 | public LLUUID Sound; | ||
601 | [XmlIgnore] | ||
602 | public byte SoundFlags; | ||
603 | [XmlIgnore] | ||
604 | public double SoundGain; | ||
605 | [XmlIgnore] | ||
606 | public double SoundRadius; | ||
607 | |||
608 | |||
595 | private string m_sitName = String.Empty; | 609 | private string m_sitName = String.Empty; |
596 | 610 | ||
597 | public string SitName | 611 | public string SitName |
@@ -2406,7 +2420,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2406 | m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, m_shape, | 2420 | m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, m_shape, |
2407 | lPos, Velocity, Acceleration, RotationOffset, RotationalVelocity, clientFlags, m_uuid, | 2421 | lPos, Velocity, Acceleration, RotationOffset, RotationalVelocity, clientFlags, m_uuid, |
2408 | OwnerID, | 2422 | OwnerID, |
2409 | m_text, color, ParentID, m_particleSystem, m_clickAction, m_TextureAnimation, m_IsAttachment, m_attachmentPoint,fromAssetID); | 2423 | m_text, color, ParentID, m_particleSystem, m_clickAction, m_TextureAnimation, m_IsAttachment, m_attachmentPoint,fromAssetID, Sound, SoundGain, SoundFlags, SoundRadius); |
2410 | } | 2424 | } |
2411 | 2425 | ||
2412 | /// Terse updates | 2426 | /// Terse updates |
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 4407462..6825fbc 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | |||
@@ -430,7 +430,7 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
430 | LLUUID objectID, LLUUID ownerID, string text, byte[] color, | 430 | LLUUID objectID, LLUUID ownerID, string text, byte[] color, |
431 | uint parentID, | 431 | uint parentID, |
432 | byte[] particleSystem, byte clickAction, byte[] textureanimation, | 432 | byte[] particleSystem, byte clickAction, byte[] textureanimation, |
433 | bool attachment, uint AttachmentPoint, LLUUID AssetId) | 433 | bool attachment, uint AttachmentPoint, LLUUID AssetId, LLUUID SoundId, double SoundVolume, byte SoundFlags, double SoundRadius) |
434 | { | 434 | { |
435 | } | 435 | } |
436 | public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, | 436 | public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 61f92ef..e91e73c 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -1390,16 +1390,59 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1390 | Deprecated("llSound"); | 1390 | Deprecated("llSound"); |
1391 | } | 1391 | } |
1392 | 1392 | ||
1393 | // Xantor 20080528 PlaySound updated so it accepts an objectinventory name -or- a key to a sound | ||
1393 | public void llPlaySound(string sound, double volume) | 1394 | public void llPlaySound(string sound, double volume) |
1394 | { | 1395 | { |
1395 | m_host.AddScriptLPS(1); | 1396 | m_host.AddScriptLPS(1); |
1397 | |||
1398 | LLUUID key = LLUUID.Zero; | ||
1399 | |||
1400 | // if we can parse the string as a key, use it. | ||
1401 | if (LLUUID.TryParse(sound, out key)) | ||
1402 | { | ||
1403 | sound = key.ToString(); | ||
1404 | } | ||
1405 | // else try to locate the name in inventory of object. found returns key, | ||
1406 | // not found returns LLUUID.Zero | ||
1407 | else | ||
1408 | { | ||
1409 | sound = InventoryKey(sound).ToString(); | ||
1410 | } | ||
1411 | |||
1412 | // send the sound, once, to all clients in range | ||
1396 | m_host.SendSound(sound, volume, false, 0); | 1413 | m_host.SendSound(sound, volume, false, 0); |
1414 | |||
1397 | } | 1415 | } |
1398 | 1416 | ||
1417 | // Xantor 20080528 we should do this differently. | ||
1418 | // 1) apply the sound to the object | ||
1419 | // 2) schedule full update | ||
1420 | // just sending the sound out once doesn't work so well when other avatars come in view later on | ||
1421 | // or when the prim gets moved, changed, sat on, whatever | ||
1422 | // see large number of mantises (mantes?) | ||
1399 | public void llLoopSound(string sound, double volume) | 1423 | public void llLoopSound(string sound, double volume) |
1400 | { | 1424 | { |
1401 | m_host.AddScriptLPS(1); | 1425 | m_host.AddScriptLPS(1); |
1402 | m_host.SendSound(sound, volume, false, 1); | 1426 | // m_host.SendSound(sound, volume, false, 1); |
1427 | LLUUID key = LLUUID.Zero; | ||
1428 | |||
1429 | // if we can parse the string as a key, use it. | ||
1430 | if (LLUUID.TryParse(sound, out key)) | ||
1431 | { | ||
1432 | m_host.Sound = key; | ||
1433 | } | ||
1434 | // else try to locate the name in inventory of object. found returns key, | ||
1435 | // not found returns LLUUID.Zero | ||
1436 | else | ||
1437 | { | ||
1438 | m_host.Sound = InventoryKey(sound.ToString()); | ||
1439 | } | ||
1440 | |||
1441 | m_host.SoundGain = volume; | ||
1442 | m_host.SoundFlags = 1; // looping | ||
1443 | m_host.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable? | ||
1444 | |||
1445 | m_host.SendFullUpdateToAllClients(); | ||
1403 | } | 1446 | } |
1404 | 1447 | ||
1405 | public void llLoopSoundMaster(string sound, double volume) | 1448 | public void llLoopSoundMaster(string sound, double volume) |
@@ -1426,10 +1469,19 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1426 | m_host.SendSound(sound, volume, true, 0); | 1469 | m_host.SendSound(sound, volume, true, 0); |
1427 | } | 1470 | } |
1428 | 1471 | ||
1472 | // Xantor 20080528: Clear prim data of sound instead | ||
1429 | public void llStopSound() | 1473 | public void llStopSound() |
1430 | { | 1474 | { |
1431 | m_host.AddScriptLPS(1); | 1475 | m_host.AddScriptLPS(1); |
1432 | m_host.SendSound(LLUUID.Zero.ToString(), 1.0, false, 2); | 1476 | |
1477 | m_host.Sound = LLUUID.Zero; | ||
1478 | m_host.SoundGain = 0; | ||
1479 | m_host.SoundFlags = 0; | ||
1480 | m_host.SoundRadius = 0; | ||
1481 | |||
1482 | m_host.SendFullUpdateToAllClients(); | ||
1483 | |||
1484 | // m_host.SendSound(LLUUID.Zero.ToString(), 1.0, false, 2); | ||
1433 | } | 1485 | } |
1434 | 1486 | ||
1435 | public void llPreloadSound(string sound) | 1487 | public void llPreloadSound(string sound) |