volumeSetting = vol;\r
loopSound = loop;\r
\r
+ Logger.Log(\r
+ String.Format(\r
+ "Playing sound at <{0:0.0},{1:0.0},{2:0.0}> ID {3}",\r
+ position.x,\r
+ position.y,\r
+ position.z,\r
+ Id.ToString()),\r
+ Helpers.LogLevel.Debug);\r
+\r
// Set flags to determine how it will be played.\r
mode = FMOD.MODE.SOFTWARE | // Need software processing for all the features\r
FMOD.MODE._3D | // Need 3D effects for placement\r
1.2f, // Any closer than this gets no louder\r
100.0f)); // Further than this gets no softer.\r
\r
- // Set the sound point of origin. This is in GLOBAL coordinates.\r
+ // Set the sound point of origin. This is in SIM coordinates.\r
FMODExec(channel.set3DAttributes(ref position, ref ZeroVector));\r
\r
// Turn off pause mode. The sound will start playing now.\r
{\r
Logger.Log("Removing sound " + Id.ToString(), Helpers.LogLevel.Debug);\r
\r
- // Release the buffer to avoid a big memory leak.\r
- if (channel != null)\r
+ invoke(new SoundDelegate(delegate\r
{\r
- channel.stop();\r
+ // Release the buffer to avoid a big memory leak.\r
+ if (channel != null)\r
+ {\r
+ channel.stop();\r
+ channel = null;\r
+ }\r
+ if (sound != null)\r
+ {\r
+ sound.release();\r
+ sound = null;\r
+ }\r
channel = null;\r
- }\r
- if (sound != null)\r
- {\r
- sound.release();\r
- sound = null;\r
- }\r
- channel = null;\r
\r
- lock (allBuffers)\r
- allBuffers.Remove(Id);\r
+ lock (allBuffers)\r
+ allBuffers.Remove(Id);\r
+ }));\r
+\r
}\r
\r
}\r