aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2012-06-07 20:51:03 +0200
committerMelanie2012-06-07 20:51:03 +0200
commit49423144350b6195a51931bc18a01be337f80f8b (patch)
treea3c36354e700d457afe6a2bdceaf401e758ef5df /OpenSim/Region
parentFix not sending TransferInfo when an asset is not found. This clogs (diff)
downloadopensim-SC-49423144350b6195a51931bc18a01be337f80f8b.zip
opensim-SC-49423144350b6195a51931bc18a01be337f80f8b.tar.gz
opensim-SC-49423144350b6195a51931bc18a01be337f80f8b.tar.bz2
opensim-SC-49423144350b6195a51931bc18a01be337f80f8b.tar.xz
Implement playing of the real collision sounds, change scaling for avatar
collisions to make them really soft because otherwise climbing stairs makes an unbearable amount of noise.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/CollisionSounds.cs190
1 files changed, 57 insertions, 133 deletions
diff --git a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs
index d72cf41..a95e75a 100644
--- a/OpenSim/Region/Framework/Scenes/CollisionSounds.cs
+++ b/OpenSim/Region/Framework/Scenes/CollisionSounds.cs
@@ -27,9 +27,11 @@
27// Ubit 2012 27// Ubit 2012
28 28
29using System; 29using System;
30using System.Reflection;
30using System.Collections.Generic; 31using System.Collections.Generic;
31using OpenMetaverse; 32using OpenMetaverse;
32using OpenSim.Framework; 33using OpenSim.Framework;
34using log4net;
33 35
34namespace OpenSim.Region.Framework.Scenes 36namespace OpenSim.Region.Framework.Scenes
35{ 37{
@@ -42,9 +44,11 @@ namespace OpenSim.Region.Framework.Scenes
42 44
43 public static class CollisionSounds 45 public static class CollisionSounds
44 { 46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48
45 private const int MaxMaterials = 7; 49 private const int MaxMaterials = 7;
46 // part part 50 // part part
47/* 51
48 private static UUID snd_StoneStone = new UUID("be7295c0-a158-11e1-b3dd-0800200c9a66"); 52 private static UUID snd_StoneStone = new UUID("be7295c0-a158-11e1-b3dd-0800200c9a66");
49 private static UUID snd_StoneMetal = new UUID("be7295c0-a158-11e1-b3dd-0800201c9a66"); 53 private static UUID snd_StoneMetal = new UUID("be7295c0-a158-11e1-b3dd-0800201c9a66");
50 private static UUID snd_StoneGlass = new UUID("be7295c0-a158-11e1-b3dd-0800202c9a66"); 54 private static UUID snd_StoneGlass = new UUID("be7295c0-a158-11e1-b3dd-0800202c9a66");
@@ -53,7 +57,6 @@ namespace OpenSim.Region.Framework.Scenes
53 private static UUID snd_StonePlastic = new UUID("be7295c0-a158-11e1-b3dd-0800205c9a66"); 57 private static UUID snd_StonePlastic = new UUID("be7295c0-a158-11e1-b3dd-0800205c9a66");
54 private static UUID snd_StoneRubber = new UUID("be7295c0-a158-11e1-b3dd-0800206c9a66"); 58 private static UUID snd_StoneRubber = new UUID("be7295c0-a158-11e1-b3dd-0800206c9a66");
55 59
56 private static UUID snd_MetalStone = new UUID("be7295c0-a158-11e1-b3dd-0801200c9a66");
57 private static UUID snd_MetalMetal = new UUID("be7295c0-a158-11e1-b3dd-0801201c9a66"); 60 private static UUID snd_MetalMetal = new UUID("be7295c0-a158-11e1-b3dd-0801201c9a66");
58 private static UUID snd_MetalGlass = new UUID("be7295c0-a158-11e1-b3dd-0801202c9a66"); 61 private static UUID snd_MetalGlass = new UUID("be7295c0-a158-11e1-b3dd-0801202c9a66");
59 private static UUID snd_MetalWood = new UUID("be7295c0-a158-11e1-b3dd-0801203c9a66"); 62 private static UUID snd_MetalWood = new UUID("be7295c0-a158-11e1-b3dd-0801203c9a66");
@@ -61,44 +64,24 @@ namespace OpenSim.Region.Framework.Scenes
61 private static UUID snd_MetalPlastic = new UUID("be7295c0-a158-11e1-b3dd-0801205c9a66"); 64 private static UUID snd_MetalPlastic = new UUID("be7295c0-a158-11e1-b3dd-0801205c9a66");
62 private static UUID snd_MetalRubber = new UUID("be7295c0-a158-11e1-b3dd-0801206c9a66"); 65 private static UUID snd_MetalRubber = new UUID("be7295c0-a158-11e1-b3dd-0801206c9a66");
63 66
64 private static UUID snd_GlassStone = new UUID("be7295c0-a158-11e1-b3dd-0802200c9a66");
65 private static UUID snd_GlassMetal = new UUID("be7295c0-a158-11e1-b3dd-0802201c9a66");
66 private static UUID snd_GlassGlass = new UUID("be7295c0-a158-11e1-b3dd-0802202c9a66"); 67 private static UUID snd_GlassGlass = new UUID("be7295c0-a158-11e1-b3dd-0802202c9a66");
67 private static UUID snd_GlassWood = new UUID("be7295c0-a158-11e1-b3dd-0802203c9a66"); 68 private static UUID snd_GlassWood = new UUID("be7295c0-a158-11e1-b3dd-0802203c9a66");
68 private static UUID snd_GlassFlesh = new UUID("be7295c0-a158-11e1-b3dd-0802204c9a66"); 69 private static UUID snd_GlassFlesh = new UUID("be7295c0-a158-11e1-b3dd-0802204c9a66");
69 private static UUID snd_GlassPlastic = new UUID("be7295c0-a158-11e1-b3dd-0802205c9a66"); 70 private static UUID snd_GlassPlastic = new UUID("be7295c0-a158-11e1-b3dd-0802205c9a66");
70 private static UUID snd_GlassRubber = new UUID("be7295c0-a158-11e1-b3dd-0802206c9a66"); 71 private static UUID snd_GlassRubber = new UUID("be7295c0-a158-11e1-b3dd-0802206c9a66");
71 72
72 private static UUID snd_WoodStone = new UUID("be7295c0-a158-11e1-b3dd-0803200c9a66");
73 private static UUID snd_WoodMetal = new UUID("be7295c0-a158-11e1-b3dd-0803201c9a66");
74 private static UUID snd_WoodGlass = new UUID("be7295c0-a158-11e1-b3dd-0803202c9a66");
75 private static UUID snd_WoodWood = new UUID("be7295c0-a158-11e1-b3dd-0803203c9a66"); 73 private static UUID snd_WoodWood = new UUID("be7295c0-a158-11e1-b3dd-0803203c9a66");
76 private static UUID snd_WoodFlesh = new UUID("be7295c0-a158-11e1-b3dd-0803204c9a66"); 74 private static UUID snd_WoodFlesh = new UUID("be7295c0-a158-11e1-b3dd-0803204c9a66");
77 private static UUID snd_WoodPlastic = new UUID("be7295c0-a158-11e1-b3dd-0803205c9a66"); 75 private static UUID snd_WoodPlastic = new UUID("be7295c0-a158-11e1-b3dd-0803205c9a66");
78 private static UUID snd_WoodRubber = new UUID("be7295c0-a158-11e1-b3dd-0803206c9a66"); 76 private static UUID snd_WoodRubber = new UUID("be7295c0-a158-11e1-b3dd-0803206c9a66");
79 77
80 private static UUID snd_FleshStone = new UUID("be7295c0-a158-11e1-b3dd-0804200c9a66");
81 private static UUID snd_FleshMetal = new UUID("be7295c0-a158-11e1-b3dd-0804201c9a66");
82 private static UUID snd_FleshGlass = new UUID("be7295c0-a158-11e1-b3dd-0804202c9a66");
83 private static UUID snd_FleshWood = new UUID("be7295c0-a158-11e1-b3dd-0804203c9a66");
84 private static UUID snd_FleshFlesh = new UUID("be7295c0-a158-11e1-b3dd-0804204c9a66"); 78 private static UUID snd_FleshFlesh = new UUID("be7295c0-a158-11e1-b3dd-0804204c9a66");
85 private static UUID snd_FleshPlastic = new UUID("be7295c0-a158-11e1-b3dd-0804205c9a66"); 79 private static UUID snd_FleshPlastic = new UUID("be7295c0-a158-11e1-b3dd-0804205c9a66");
86 private static UUID snd_FleshRubber = new UUID("be7295c0-a158-11e1-b3dd-0804206c9a66"); 80 private static UUID snd_FleshRubber = new UUID("be7295c0-a158-11e1-b3dd-0804206c9a66");
87 81
88 private static UUID snd_PlasticStone = new UUID("be7295c0-a158-11e1-b3dd-0805200c9a66");
89 private static UUID snd_PlasticMetal = new UUID("be7295c0-a158-11e1-b3dd-0805201c9a66");
90 private static UUID snd_PlasticGlass = new UUID("be7295c0-a158-11e1-b3dd-0805202c9a66");
91 private static UUID snd_PlasticWood = new UUID("be7295c0-a158-11e1-b3dd-0805203c9a66");
92 private static UUID snd_PlasticFlesh = new UUID("be7295c0-a158-11e1-b3dd-0805204c9a66");
93 private static UUID snd_PlasticPlastic = new UUID("be7295c0-a158-11e1-b3dd-0805205c9a66"); 82 private static UUID snd_PlasticPlastic = new UUID("be7295c0-a158-11e1-b3dd-0805205c9a66");
94 private static UUID snd_PlasticRubber = new UUID("be7295c0-a158-11e1-b3dd-0805206c9a66"); 83 private static UUID snd_PlasticRubber = new UUID("be7295c0-a158-11e1-b3dd-0805206c9a66");
95 84
96 private static UUID snd_RubberStone = new UUID("be7295c0-a158-11e1-b3dd-0806200c9a66");
97 private static UUID snd_RubberMetal = new UUID("be7295c0-a158-11e1-b3dd-0806201c9a66");
98 private static UUID snd_RubberGlass = new UUID("be7295c0-a158-11e1-b3dd-0806202c9a66");
99 private static UUID snd_RubberWood = new UUID("be7295c0-a158-11e1-b3dd-0806203c9a66");
100 private static UUID snd_RubberFlesh = new UUID("be7295c0-a158-11e1-b3dd-0806204c9a66");
101 private static UUID snd_RubberPlastic = new UUID("be7295c0-a158-11e1-b3dd-0806205c9a66");
102 private static UUID snd_RubberRubber = new UUID("be7295c0-a158-11e1-b3dd-0806206c9a66"); 85 private static UUID snd_RubberRubber = new UUID("be7295c0-a158-11e1-b3dd-0806206c9a66");
103 86
104 // terrain part 87 // terrain part
@@ -109,50 +92,6 @@ namespace OpenSim.Region.Framework.Scenes
109 private static UUID snd_TerrainFlesh = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66"); 92 private static UUID snd_TerrainFlesh = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66");
110 private static UUID snd_TerrainPlastic = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66"); 93 private static UUID snd_TerrainPlastic = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66");
111 private static UUID snd_TerrainRubber = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66"); 94 private static UUID snd_TerrainRubber = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66");
112*/
113 private static UUID snd_StoneStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
114 private static UUID snd_StoneMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
115 private static UUID snd_StoneGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
116 private static UUID snd_StoneWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
117 private static UUID snd_StoneFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
118 private static UUID snd_StonePlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
119 private static UUID snd_StoneRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
120
121 private static UUID snd_MetalMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
122 private static UUID snd_MetalGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
123 private static UUID snd_MetalWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
124 private static UUID snd_MetalFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
125 private static UUID snd_MetalPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
126 private static UUID snd_MetalRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
127
128 private static UUID snd_GlassGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
129 private static UUID snd_GlassWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
130 private static UUID snd_GlassFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
131 private static UUID snd_GlassPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
132 private static UUID snd_GlassRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
133
134 private static UUID snd_WoodWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
135 private static UUID snd_WoodFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
136 private static UUID snd_WoodPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
137 private static UUID snd_WoodRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
138
139 private static UUID snd_FleshFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
140 private static UUID snd_FleshPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
141 private static UUID snd_FleshRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
142
143 private static UUID snd_PlasticPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
144 private static UUID snd_PlasticRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
145
146 private static UUID snd_RubberRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
147
148 // terrain part
149 private static UUID snd_TerrainStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
150 private static UUID snd_TerrainMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
151 private static UUID snd_TerrainGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
152 private static UUID snd_TerrainWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
153 private static UUID snd_TerrainFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
154 private static UUID snd_TerrainPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
155 private static UUID snd_TerrainRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
156 95
157 public static UUID[] m_TerrainPart = { 96 public static UUID[] m_TerrainPart = {
158 snd_TerrainStone, 97 snd_TerrainStone,
@@ -163,18 +102,7 @@ namespace OpenSim.Region.Framework.Scenes
163 snd_TerrainPlastic, 102 snd_TerrainPlastic,
164 snd_TerrainRubber 103 snd_TerrainRubber
165 }; 104 };
166/* 105
167 //full assimetric sounds
168 public static UUID[] m_PartPart = {
169 snd_StoneStone, snd_StoneMetal, snd_StoneGlass, snd_StoneWood, snd_StoneFlesh, snd_StonePlastic, snd_StoneRubber,
170 snd_MetalStone, snd_MetalMetal, snd_MetalGlass, snd_MetalWood, snd_MetalFlesh, snd_MetalPlastic, snd_MetalRubber,
171 snd_GlassStone, snd_GlassMetal, snd_GlassGlass, snd_GlassWood, snd_GlassFlesh, snd_GlassPlastic, snd_GlassRubber,
172 snd_WoodStone, snd_WoodMetal, snd_WoodGlass, snd_WoodWood, snd_WoodFlesh, snd_WoodPlastic, snd_WoodRubber,
173 snd_FleshStone, snd_FleshMetal, snd_FleshGlass, snd_FleshWood, snd_FleshFlesh, snd_FleshPlastic, snd_FleshRubber,
174 snd_PlasticStone, snd_PlasticMetal, snd_PlasticGlass, snd_PlasticWood, snd_PlasticFlesh, snd_PlasticPlastic, snd_PlasticRubber,
175 snd_RubberStone, snd_RubberMetal, snd_RubberGlass, snd_RubberWood, snd_RubberFlesh, snd_RubberPlastic, snd_RubberRubber
176 };
177*/
178 // simetric sounds 106 // simetric sounds
179 public static UUID[] m_PartPart = { 107 public static UUID[] m_PartPart = {
180 snd_StoneStone, snd_StoneMetal, snd_StoneGlass, snd_StoneWood, snd_StoneFlesh, snd_StonePlastic, snd_StoneRubber, 108 snd_StoneStone, snd_StoneMetal, snd_StoneGlass, snd_StoneWood, snd_StoneFlesh, snd_StonePlastic, snd_StoneRubber,
@@ -235,19 +163,17 @@ namespace OpenSim.Region.Framework.Scenes
235 { 163 {
236 if (!HaveSound) 164 if (!HaveSound)
237 { 165 {
238// TODO: Import real collision sounds and uncomment this 166 volume = Math.Abs(colInfo.relativeVel);
239// volume = Math.Abs(colInfo.relativeVel); 167 if (volume < 0.2f)
240// if (volume < 0.2f) 168 continue;
241// continue; 169
242// 170 volume *= volume * .0625f; // 4m/s == full volume
243// volume *= volume * .0625f; // 4m/s == full volume 171 if (volume > 1.0f)
244// if (volume > 1.0f) 172 volume = 1.0f;
245// volume = 1.0f; 173
246// 174 soundID = m_TerrainPart[thisMaterial];
247// soundID = m_TerrainPart[thisMaterial];
248 } 175 }
249 else // Remove this else when uncommenting the above 176 part.SendCollisionSound(soundID, volume, colInfo.position);
250 part.SendCollisionSound(soundID, volume, colInfo.position);
251 doneownsound = true; 177 doneownsound = true;
252 } 178 }
253 continue; 179 continue;
@@ -268,35 +194,31 @@ namespace OpenSim.Region.Framework.Scenes
268 if (volume == 0.0f) 194 if (volume == 0.0f)
269 continue; 195 continue;
270 } 196 }
271// TODO: Import real collision sounds and uncomment this
272// else
273// {
274// volume = Math.Abs(colInfo.relativeVel);
275// if (volume < 0.2f)
276// continue;
277//
278// volume *= volume * .0625f; // 4m/s == full volume
279// if (volume > 1.0f)
280// volume = 1.0f;
281//
282// int otherMaterial = (int)otherPart.Material;
283// if (otherMaterial >= MaxMaterials)
284// otherMaterial = 3;
285//
286// soundID = m_PartPart[thisMatScaled + otherMaterial];
287// }
288 }
289
290 if (soundID != UUID.Zero) // Remove when sounds are there
291 { // Remove when sounds are there
292 if (doneownsound)
293 otherPart.SendCollisionSound(soundID, volume, colInfo.position);
294 else 197 else
295 { 198 {
296 part.SendCollisionSound(soundID, volume, colInfo.position); 199 volume = Math.Abs(colInfo.relativeVel);
297 doneownsound = true; 200 if (volume < 0.2f)
201 continue;
202
203 volume *= volume * .0625f; // 4m/s == full volume
204 if (volume > 1.0f)
205 volume = 1.0f;
206
207 int otherMaterial = (int)otherPart.Material;
208 if (otherMaterial >= MaxMaterials)
209 otherMaterial = 3;
210
211 soundID = m_PartPart[thisMatScaled + otherMaterial];
298 } 212 }
299 } // Remove when sounds are there 213 }
214
215 if (doneownsound)
216 otherPart.SendCollisionSound(soundID, volume, colInfo.position);
217 else
218 {
219 part.SendCollisionSound(soundID, volume, colInfo.position);
220 doneownsound = true;
221 }
300 } 222 }
301 } 223 }
302 } 224 }
@@ -341,23 +263,25 @@ namespace OpenSim.Region.Framework.Scenes
341 continue; 263 continue;
342 if (otherPart.CollisionSoundType > 0 && otherPart.CollisionSoundVolume > 0f) 264 if (otherPart.CollisionSoundType > 0 && otherPart.CollisionSoundVolume > 0f)
343 otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume, colInfo.position); 265 otherPart.SendCollisionSound(otherPart.CollisionSound, otherPart.CollisionSoundVolume, colInfo.position);
344//TODO: uncomment below when sounds are uploaded 266 else
345// else 267 {
346// { 268 volume = Math.Abs(colInfo.relativeVel);
347// volume = Math.Abs(colInfo.relativeVel); 269 if (volume < 0.2f)
348// if (volume < 0.2f) 270 continue;
349// continue; 271 m_log.DebugFormat("Collision speed was {0}", volume);
350// 272
351// volume *= volume * .0625f; // 4m/s == full volume 273 // Cap to 0.2 times volume because climbing stairs should not be noisy
352// if (volume > 1.0f) 274 // Also changed scaling
353// volume = 1.0f; 275 volume *= volume * .0125f; // 4m/s == volume 0.2
354// otherMaterial = (int)otherPart.Material; 276 if (volume > 0.2f)
355// if (otherMaterial >= MaxMaterials) 277 volume = 0.2f;
356// otherMaterial = 3; 278 otherMaterial = (int)otherPart.Material;
357// 279 if (otherMaterial >= MaxMaterials)
358// soundID = m_PartPart[thisMatScaled + otherMaterial]; 280 otherMaterial = 3;
359// otherPart.SendCollisionSound(soundID, volume, colInfo.position); 281
360// } 282 soundID = m_PartPart[thisMatScaled + otherMaterial];
283 otherPart.SendCollisionSound(soundID, volume, colInfo.position);
284 }
361 continue; 285 continue;
362 } 286 }
363/* 287/*