aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorUbitUmarov2018-04-09 00:15:45 +0100
committerUbitUmarov2018-04-09 00:15:45 +0100
commit63da4d3f99a292aff6963f4d453ec3911be51b62 (patch)
treeb46f96a46d5c2005805afd97641e27e2a74e8a19 /OpenSim
parent.. and yes i forgot a file.. again :( (diff)
downloadopensim-SC-63da4d3f99a292aff6963f4d453ec3911be51b62.zip
opensim-SC-63da4d3f99a292aff6963f4d453ec3911be51b62.tar.gz
opensim-SC-63da4d3f99a292aff6963f4d453ec3911be51b62.tar.bz2
opensim-SC-63da4d3f99a292aff6963f4d453ec3911be51b62.tar.xz
mantis 8305: add several ossl sound funtions that accept a link number for the prim associated to that sound. The link number must point to a single prim
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs193
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs11
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs49
3 files changed, 253 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 253bb06..d81054e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -144,6 +144,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
144 internal bool m_debuggerSafe = false; 144 internal bool m_debuggerSafe = false;
145 internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >(); 145 internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >();
146 protected IUrlModule m_UrlModule = null; 146 protected IUrlModule m_UrlModule = null;
147 protected ISoundModule m_SoundModule = null;
147 internal IConfig m_osslconfig; 148 internal IConfig m_osslconfig;
148 149
149 public void Initialize( 150 public void Initialize(
@@ -160,6 +161,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
160 m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); 161 m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false);
161 162
162 m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); 163 m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>();
164 m_SoundModule = m_ScriptEngine.World.RequestModuleInterface<ISoundModule>();
165
163 if (m_osslconfig.GetBoolean("AllowOSFunctions", false)) 166 if (m_osslconfig.GetBoolean("AllowOSFunctions", false))
164 { 167 {
165 m_OSFunctionsEnabled = true; 168 m_OSFunctionsEnabled = true;
@@ -4832,5 +4835,195 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4832 double mcross = LSL_Vector.Mag(LSL_Vector.Cross(a,b)); 4835 double mcross = LSL_Vector.Mag(LSL_Vector.Cross(a,b));
4833 return Math.Atan2(mcross, dot); 4836 return Math.Atan2(mcross, dot);
4834 } 4837 }
4838
4839
4840//******* link sound
4841 public void osAdjustSoundVolume(LSL_Integer linknum, LSL_Float volume)
4842 {
4843 m_host.AddScriptLPS(1);
4844 SceneObjectPart sop = GetSingleLinkPart(linknum);
4845 if(sop == null)
4846 return;
4847 sop.AdjustSoundGain(volume);
4848 ScriptSleep(100);
4849 }
4850
4851 public void osSetSoundRadius(LSL_Integer linknum, LSL_Float radius)
4852 {
4853 m_host.AddScriptLPS(1);
4854 SceneObjectPart sop = GetSingleLinkPart(linknum);
4855 if(sop == null)
4856 return;
4857 m_host.SoundRadius = radius;
4858 }
4859
4860 public void osPlaySound(LSL_Integer linknum, LSL_String sound, LSL_Float volume)
4861 {
4862 m_host.AddScriptLPS(1);
4863
4864 if (m_SoundModule == null)
4865 return;
4866
4867 SceneObjectPart sop = GetSingleLinkPart(linknum);
4868 if(sop == null)
4869 return;
4870
4871 UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound);
4872 if(soundID == UUID.Zero)
4873 return;
4874
4875 // send the sound, once, to all clients in range
4876 m_SoundModule.SendSound(sop.UUID, soundID, volume, false, 0, 0, false, false);
4877 }
4878
4879 public void osLoopSound(LSL_Integer linknum, LSL_String sound, LSL_Float volume)
4880 {
4881 m_host.AddScriptLPS(1);
4882
4883 if (m_SoundModule == null)
4884 return;
4885
4886 SceneObjectPart sop = GetSingleLinkPart(linknum);
4887 if(sop == null)
4888 return;
4889
4890 UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound);
4891 if(soundID == UUID.Zero)
4892 return;
4893
4894 m_SoundModule.LoopSound(sop.UUID, soundID, volume, 20, false,false);
4895 }
4896
4897 public void osLoopSoundMaster(LSL_Integer linknum, LSL_String sound, LSL_Float volume)
4898 {
4899 m_host.AddScriptLPS(1);
4900
4901 SceneObjectPart sop = GetSingleLinkPart(linknum);
4902 if(sop == null)
4903 return;
4904
4905 UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound);
4906 if(soundID == UUID.Zero)
4907 return;
4908
4909 m_SoundModule.LoopSound(sop.UUID, soundID, volume, 20, true, false);
4910 }
4911
4912 public void osLoopSoundSlave(LSL_Integer linknum, LSL_String sound, LSL_Float volume)
4913 {
4914 m_host.AddScriptLPS(1);
4915
4916 if (m_SoundModule == null)
4917 return;
4918
4919 SceneObjectPart sop = GetSingleLinkPart(linknum);
4920 if(sop == null)
4921 return;
4922
4923 UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound);
4924 if(soundID == UUID.Zero)
4925 return;
4926
4927 m_SoundModule.LoopSound(sop.UUID, soundID, volume, 20, false, true);
4928 }
4929
4930 public void osPlaySoundSlave(LSL_Integer linknum, LSL_String sound, LSL_Float volume)
4931 {
4932 m_host.AddScriptLPS(1);
4933
4934 if (m_SoundModule == null)
4935 return;
4936
4937 SceneObjectPart sop = GetSingleLinkPart(linknum);
4938 if(sop == null)
4939 return;
4940
4941 UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound);
4942 if(soundID == UUID.Zero)
4943 return;
4944
4945 // send the sound, once, to all clients in range
4946 m_SoundModule.SendSound(sop.UUID, soundID, volume, false, 0, 0, true, false);
4947 }
4948
4949 public void osTriggerSound(LSL_Integer linknum, LSL_String sound, LSL_Float volume)
4950 {
4951 m_host.AddScriptLPS(1);
4952
4953 if (m_SoundModule == null)
4954 return;
4955
4956 SceneObjectPart sop = GetSingleLinkPart(linknum);
4957 if(sop == null)
4958 return;
4959
4960 UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound);
4961 if(soundID == UUID.Zero)
4962 return;
4963
4964 // send the sound, once, to all clients in rangeTrigger or play an attached sound in this part's inventory.
4965 m_SoundModule.SendSound(sop.UUID, soundID, volume, true, 0, 0, false, false);
4966 }
4967
4968 public void osStopSound(LSL_Integer linknum)
4969 {
4970 m_host.AddScriptLPS(1);
4971
4972 if (m_SoundModule == null)
4973 return;
4974
4975 SceneObjectPart sop = GetSingleLinkPart(linknum);
4976 if(sop == null)
4977 return;
4978
4979 m_SoundModule.StopSound(sop.UUID);
4980 }
4981
4982 public void osPreloadSound(LSL_Integer linknum, LSL_String sound)
4983 {
4984 m_host.AddScriptLPS(1);
4985
4986 if (m_SoundModule == null)
4987 return;
4988
4989 SceneObjectPart sop = GetSingleLinkPart(linknum);
4990 if(sop == null)
4991 return;
4992
4993 UUID soundID = ScriptUtils.GetAssetIdFromKeyOrItemName(sop, sound, AssetType.Sound);
4994 if(soundID == UUID.Zero)
4995 return;
4996
4997 m_SoundModule.PreloadSound(sop.UUID, soundID, 0);
4998 ScriptSleep(1000);
4999 }
5000
5001 // get only one part
5002 private SceneObjectPart GetSingleLinkPart(int linkType)
5003 {
5004 if (m_host.ParentGroup == null || m_host.ParentGroup.IsDeleted)
5005 return null;
5006
5007 switch (linkType)
5008 {
5009 case ScriptBaseClass.LINK_SET:
5010 case ScriptBaseClass.LINK_ALL_OTHERS:
5011 case ScriptBaseClass.LINK_ALL_CHILDREN:
5012 return null;
5013
5014 case 0:
5015 case ScriptBaseClass.LINK_ROOT:
5016 return m_host.ParentGroup.RootPart;
5017
5018 case ScriptBaseClass.LINK_THIS:
5019 return m_host;
5020
5021 default:
5022 if(linkType < 0)
5023 return null;
5024
5025 return m_host.ParentGroup.GetLinkNumPart(linkType);
5026 }
5027 }
4835 } 5028 }
4836} 5029}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 5cabf30..818c1c4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -512,5 +512,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
512 LSL_Float osVecMagSquare(vector a); 512 LSL_Float osVecMagSquare(vector a);
513 LSL_Float osVecDistSquare(vector a, vector b); 513 LSL_Float osVecDistSquare(vector a, vector b);
514 LSL_Float osAngleBetween(vector a, vector b); 514 LSL_Float osAngleBetween(vector a, vector b);
515
516 void osAdjustSoundVolume(LSL_Integer linknum, LSL_Float volume);
517 void osLoopSound(LSL_Integer linknum, LSL_String sound, LSL_Float volume);
518 void osLoopSoundMaster(LSL_Integer linknum, LSL_String sound, LSL_Float volume);
519 void osLoopSoundSlave(LSL_Integer linknum, LSL_String sound, LSL_Float volume);
520 void osPlaySound(LSL_Integer linknum, LSL_String sound, LSL_Float volume);
521 void osPlaySoundSlave(LSL_Integer linknum, LSL_String sound, LSL_Float volume);
522 void osPreloadSound(LSL_Integer linknum, LSL_String sound);
523 void osSetSoundRadius(LSL_Integer linknum, LSL_Float radius);
524 void osStopSound(LSL_Integer linknum);
525 void osTriggerSound(LSL_Integer linknum, LSL_String sound, LSL_Float volume);
515 } 526 }
516} 527}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 16b368c..aa37159 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -1216,5 +1216,54 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
1216 return m_OSSL_Functions.osAngleBetween(a, b); 1216 return m_OSSL_Functions.osAngleBetween(a, b);
1217 } 1217 }
1218 1218
1219 public void osAdjustSoundVolume(LSL_Integer linknum, LSL_Float volume)
1220 {
1221 m_OSSL_Functions.osAdjustSoundVolume(linknum, volume);
1222 }
1223
1224 public void osSetSoundRadius(LSL_Integer linknum, LSL_Float radius)
1225 {
1226 m_OSSL_Functions.osSetSoundRadius(linknum, radius);
1227 }
1228
1229 public void osPlaySound(LSL_Integer linknum, LSL_String sound, LSL_Float volume)
1230 {
1231 m_OSSL_Functions.osPlaySound(linknum, sound, volume);
1232 }
1233
1234 public void osLoopSound(LSL_Integer linknum, LSL_String sound, LSL_Float volume)
1235 {
1236 m_OSSL_Functions.osLoopSound(linknum, sound, volume);
1237 }
1238
1239 public void osLoopSoundMaster(LSL_Integer linknum, LSL_String sound, LSL_Float volume)
1240 {
1241 m_OSSL_Functions.osLoopSoundMaster(linknum, sound, volume);
1242 }
1243
1244 public void osLoopSoundSlave(LSL_Integer linknum, LSL_String sound, LSL_Float volume)
1245 {
1246 m_OSSL_Functions.osLoopSoundSlave(linknum, sound, volume);
1247 }
1248
1249 public void osPlaySoundSlave(LSL_Integer linknum, LSL_String sound, LSL_Float volume)
1250 {
1251 m_OSSL_Functions.osPlaySoundSlave(linknum, sound, volume);
1252 }
1253
1254 public void osTriggerSound(LSL_Integer linknum, LSL_String sound, LSL_Float volume)
1255 {
1256 m_OSSL_Functions.osTriggerSound(linknum, sound, volume);
1257 }
1258
1259 public void osStopSound(LSL_Integer linknum)
1260 {
1261 m_OSSL_Functions.osStopSound(linknum);
1262 }
1263
1264 public void osPreloadSound(LSL_Integer linknum, LSL_String sound)
1265 {
1266 m_OSSL_Functions.osPreloadSound(linknum, sound);
1267 }
1219 } 1268 }
1220} 1269}