aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs56
1 files changed, 54 insertions, 2 deletions
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)