//\r
// $Id: Sound.cs 502 2010-03-14 23:13:46Z latifer $\r
//\r
+// Uncomment this to get lots more logging\r
+//#define TRACE_SOUND\r
using System;\r
using System.Runtime.InteropServices;\r
using System.Collections.Generic;\r
\r
// Allocate a channel and set initial volume. Initially paused.\r
FMODExec(system.playSound(CHANNELINDEX.FREE, sound, true, ref channel));\r
+#if TRACE_SOUND\r
Logger.Log(\r
String.Format("Channel {0} for {1} assigned to {2}",\r
channel.getRaw().ToString("X"),\r
sound.getRaw().ToString("X"),\r
Id),\r
Helpers.LogLevel.Debug);\r
-\r
+#endif\r
lock (allChannels)\r
allChannels[channel.getRaw()] = this;\r
\r
sound.release();\r
sound = null;\r
}\r
-\r
+#if TRACE_SOUND\r
Logger.Log(String.Format("Removing channel {0} sound {1} ID {2}",\r
chanStr,\r
soundStr,\r
Id.ToString()),\r
Helpers.LogLevel.Debug);\r
-\r
+#endif\r
lock (allBuffers)\r
allBuffers.Remove(ContainerId);\r
\r
private Vector3 speakerPos;\r
\r
/// <summary>\r
+ /// If true, decrease distance falloff effect in volume.\r
+ /// </summary>\r
+ private static Boolean compress = true;\r
+ public static Boolean Compress\r
+ {\r
+ set { compress = value; }\r
+ get { return compress; }\r
+ }\r
+\r
+ /// <summary>\r
/// Creates a new sound object\r
/// </summary>\r
/// <param name="system">Sound system</param>\r
\r
// Set general Speech volume.\r
//TODO Set this in the GUI\r
- volume = 0.8f;\r
+ volume = 1.0f;\r
FMODExec(channel.setVolume(volume));\r
\r
// Set attenuation limits so distant people get a little softer,\r
// but not TOO soft\r
- FMODExec(sound.set3DMinMaxDistance(\r
- 1.2f, // Any closer than this gets no louder\r
- 8.0f)); // Further than this gets no softer.\r
+ if (compress)\r
+ FMODExec(sound.set3DMinMaxDistance(\r
+ 2f, // Any closer than this gets no louder\r
+ 3.5f)); // Further than this gets no softer.\r
+ else\r
+ FMODExec(sound.set3DMinMaxDistance(\r
+ 2f, // Any closer than this gets no louder\r
+ 10f)); // Further than this gets no softer.\r
\r
// Set speaker position.\r
position = FromOMVSpace(speakerPos);\r