private FMOD.MODE mode;\r
public Sound Sound { get { return sound; } }\r
private Boolean loopSound = false;\r
+ /// <summary>\r
+ /// The individual volume setting for THIS object\r
+ /// </summary>\r
+ private float volumeSetting = 0.5f;\r
\r
/// <summary>\r
/// Creates a new sound object\r
\r
Id = soundId;\r
position = FromOMVSpace(worldpos);\r
- volume = vol;\r
+ volumeSetting = vol;\r
loopSound = loop;\r
\r
// Set flags to determine how it will be played.\r
}\r
}\r
\r
+ /// <summary>\r
+ /// Adjust volumes of all playing sounds to observe the new global sound volume\r
+ /// </summary>\r
+ public static void AdjustVolumes()\r
+ {\r
+ foreach (BufferSound s in allBuffers.Values)\r
+ {\r
+ s.AdjustVolume();\r
+ }\r
+ }\r
+\r
+ /// <summary>\r
+ /// Adjust the volume of THIS sound when all are being adjusted.\r
+ /// </summary>\r
+ private void AdjustVolume()\r
+ {\r
+ Volume = volumeSetting * AllObjectVolume;\r
+ }\r
+\r
// A simpler constructor used by PreFetchSound.\r
public BufferSound( UUID soundId )\r
: base()\r
\r
// Allocate a channel and set initial volume. Initially paused.\r
FMODExec(system.playSound(CHANNELINDEX.FREE, sound, true, ref channel));\r
- FMODExec(channel.setVolume(volume * m_objectVolume ));\r
+ FMODExec(channel.setVolume(volumeSetting * AllObjectVolume ));\r
\r
// Take note of when the sound is finished playing.\r
FMODExec(channel.setCallback(endCallback));\r