aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorTeravus Ovares2008-02-04 14:40:46 +0000
committerTeravus Ovares2008-02-04 14:40:46 +0000
commit3ff5ad1ed3118525c31974f8ea9b3cf16861c783 (patch)
treecaaa038a912bf765657dbab37a171abdbad88432 /OpenSim
parent* Replacing missing break statement from DotNetEngine/Compiler/LSL/Compiler.cs (diff)
downloadopensim-SC-3ff5ad1ed3118525c31974f8ea9b3cf16861c783.zip
opensim-SC-3ff5ad1ed3118525c31974f8ea9b3cf16861c783.tar.gz
opensim-SC-3ff5ad1ed3118525c31974f8ea9b3cf16861c783.tar.bz2
opensim-SC-3ff5ad1ed3118525c31974f8ea9b3cf16861c783.tar.xz
Patch from mikkopa/_someone Thanks! adds support for llPreloadSound, llTriggerSound, llPlaySound, llPreloadSound.
* Time to make music boxes?
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/IClientAPI.cs3
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs14
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs96
4 files changed, 113 insertions, 6 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 529614b..2ef05ae 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -605,6 +605,7 @@ namespace OpenSim.Framework
605 605
606 void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID); 606 void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID);
607 void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags); 607 void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags);
608 void SendTriggeredSound(LLUUID soundID, LLUUID ownerID, LLUUID objectID, LLUUID parentID, ulong handle, LLVector3 position, float gain);
608 609
609 void SendNameReply(LLUUID profileId, string firstname, string lastname); 610 void SendNameReply(LLUUID profileId, string firstname, string lastname);
610 void SendAlertMessage(string message); 611 void SendAlertMessage(string message);
@@ -636,4 +637,4 @@ namespace OpenSim.Framework
636 637
637 void SendLogoutPacket(); 638 void SendLogoutPacket();
638 } 639 }
639} \ No newline at end of file 640}
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index 167e4c3..e89b722 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -1349,6 +1349,20 @@ namespace OpenSim.Region.ClientStack
1349 OutPacket(sound, ThrottleOutPacketType.Task); 1349 OutPacket(sound, ThrottleOutPacketType.Task);
1350 } 1350 }
1351 1351
1352 public void SendTriggeredSound(LLUUID soundID, LLUUID ownerID, LLUUID objectID, LLUUID parentID, ulong handle, LLVector3 position, float gain)
1353 {
1354 SoundTriggerPacket sound = (SoundTriggerPacket)PacketPool.Instance.GetPacket(PacketType.SoundTrigger);
1355 sound.SoundData.SoundID = soundID;
1356 sound.SoundData.OwnerID = ownerID;
1357 sound.SoundData.ObjectID = objectID;
1358 sound.SoundData.ParentID = parentID;
1359 sound.SoundData.Handle = handle;
1360 sound.SoundData.Position = position;
1361 sound.SoundData.Gain = gain;
1362
1363 OutPacket(sound, ThrottleOutPacketType.Task);
1364 }
1365
1352 public void SendSunPos(LLVector3 sunPos, LLVector3 sunVel) 1366 public void SendSunPos(LLVector3 sunPos, LLVector3 sunVel)
1353 { 1367 {
1354 SimulatorViewerTimeMessagePacket viewertime = (SimulatorViewerTimeMessagePacket)PacketPool.Instance.GetPacket(PacketType.SimulatorViewerTimeMessage); 1368 SimulatorViewerTimeMessagePacket viewertime = (SimulatorViewerTimeMessagePacket)PacketPool.Instance.GetPacket(PacketType.SimulatorViewerTimeMessage);
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
index 453320c..19bd6cd 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
@@ -392,6 +392,10 @@ namespace SimpleApp
392 { 392 {
393 } 393 }
394 394
395 public void SendTriggeredSound(LLUUID soundID, LLUUID ownerID, LLUUID objectID, LLUUID parentID, ulong handle, LLVector3 position, float gain)
396 {
397 }
398
395 public void SendAlertMessage(string message) 399 public void SendAlertMessage(string message)
396 { 400 {
397 } 401 }
@@ -519,4 +523,4 @@ namespace SimpleApp
519 { 523 {
520 } 524 }
521 } 525 }
522} \ No newline at end of file 526}
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index 76183ae..367a5f7 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -34,6 +34,7 @@ using System.Threading;
34using Axiom.Math; 34using Axiom.Math;
35using libsecondlife; 35using libsecondlife;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Communications;
37using OpenSim.Region.Environment.Interfaces; 38using OpenSim.Region.Environment.Interfaces;
38using OpenSim.Region.Environment.Scenes; 39using OpenSim.Region.Environment.Scenes;
39using OpenSim.Region.ScriptEngine.Common; 40using OpenSim.Region.ScriptEngine.Common;
@@ -898,12 +899,44 @@ namespace OpenSim.Region.ScriptEngine.Common
898 899
899 public void llSound() 900 public void llSound()
900 { 901 {
902 // This function has been deprecated
903 // see http://www.lslwiki.net/lslwiki/wakka.php?wakka=llSound
901 NotImplemented("llSound"); 904 NotImplemented("llSound");
902 } 905 }
903 906
904 public void llPlaySound(string sound, double volume) 907 public void llPlaySound(string sound, double volume)
905 { 908 {
906 NotImplemented("llPlaySound"); 909 if (volume > 1)
910 volume = 1;
911 if (volume < 0)
912 volume = 0;
913
914 LLUUID ownerID = m_host.OwnerID;
915 LLUUID objectID = m_host.UUID;
916 LLUUID soundID = LLUUID.Zero;
917 byte flags = 0;
918
919 if (!LLUUID.TryParse(sound, out soundID))
920 {
921 //Trys to fetch sound id from prim's inventory.
922 //Prim's inventory doesn't support non script items yet
923 SceneObjectPart op = World.GetSceneObjectPart(objectID);
924 foreach (KeyValuePair<LLUUID, TaskInventoryItem> item in op.TaskInventory)
925 {
926 if (item.Value.Name == sound)
927 {
928 soundID = item.Value.ItemID;
929 break;
930 }
931 }
932 }
933
934 List<ScenePresence> avatarts = World.GetAvatars();
935 foreach (ScenePresence p in avatarts)
936 {
937 // TODO: some filtering by distance of avatar
938 p.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)volume, flags);
939 }
907 } 940 }
908 941
909 public void llLoopSound(string sound, double volume) 942 public void llLoopSound(string sound, double volume)
@@ -928,7 +961,38 @@ namespace OpenSim.Region.ScriptEngine.Common
928 961
929 public void llTriggerSound(string sound, double volume) 962 public void llTriggerSound(string sound, double volume)
930 { 963 {
931 NotImplemented("llTriggerSound"); 964 if (volume > 1)
965 volume = 1;
966 if (volume < 0)
967 volume = 0;
968
969 LLUUID ownerID = m_host.OwnerID;
970 LLUUID objectID = m_host.UUID;
971 LLUUID parentID = this.m_host.GetRootPartUUID();
972 LLUUID soundID = LLUUID.Zero;
973 LLVector3 position = this.m_host.AbsolutePosition; // region local
974 ulong regionHandle = World.RegionInfo.RegionHandle;
975
976 if (!LLUUID.TryParse(sound, out soundID))
977 {
978 // search sound file from inventory
979 SceneObjectPart op = World.GetSceneObjectPart(objectID);
980 foreach (KeyValuePair<LLUUID, TaskInventoryItem> item in op.TaskInventory)
981 {
982 if (item.Value.Name == sound)
983 {
984 soundID = item.Value.ItemID;
985 break;
986 }
987 }
988 }
989
990 List<ScenePresence> avatarts = World.GetAvatars();
991 foreach (ScenePresence p in avatarts)
992 {
993 // TODO: some filtering by distance of avatar
994 p.ControllingClient.SendTriggeredSound(soundID, ownerID, objectID, parentID, regionHandle, position, (float)volume);
995 }
932 } 996 }
933 997
934 public void llStopSound() 998 public void llStopSound()
@@ -938,7 +1002,31 @@ namespace OpenSim.Region.ScriptEngine.Common
938 1002
939 public void llPreloadSound(string sound) 1003 public void llPreloadSound(string sound)
940 { 1004 {
941 NotImplemented("llPreloadSound"); 1005 LLUUID ownerID = m_host.OwnerID;
1006 LLUUID objectID = m_host.UUID;
1007 LLUUID soundID = LLUUID.Zero;
1008
1009 if (!LLUUID.TryParse(sound, out soundID))
1010 {
1011 //Trys to fetch sound id from prim's inventory.
1012 //Prim's inventory doesn't support non script items yet
1013 SceneObjectPart op = World.GetSceneObjectPart(objectID);
1014 foreach (KeyValuePair<LLUUID, TaskInventoryItem> item in op.TaskInventory)
1015 {
1016 if (item.Value.Name == sound)
1017 {
1018 soundID = item.Value.ItemID;
1019 break;
1020 }
1021 }
1022 }
1023
1024 List<ScenePresence> avatarts = World.GetAvatars();
1025 foreach (ScenePresence p in avatarts)
1026 {
1027 // TODO: some filtering by distance of avatar
1028 p.ControllingClient.SendPreLoadSound(objectID, objectID, soundID);
1029 }
942 } 1030 }
943 1031
944 public string llGetSubString(string src, int start, int end) 1032 public string llGetSubString(string src, int start, int end)
@@ -3241,4 +3329,4 @@ namespace OpenSim.Region.ScriptEngine.Common
3241 throw new Exception("LSL Runtime Error: " + msg); 3329 throw new Exception("LSL Runtime Error: " + msg);
3242 } 3330 }
3243 } 3331 }
3244} \ No newline at end of file 3332}