diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 3d2bf4a9f9..518659f02f 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -635,6 +635,7 @@ namespace OpenSim.Framework void SendPreLoadSound(LLUUID objectID, LLUUID ownerID, LLUUID soundID); void SendPlayAttachedSound(LLUUID soundID, LLUUID objectID, LLUUID ownerID, float gain, byte flags); void SendTriggeredSound(LLUUID soundID, LLUUID ownerID, LLUUID objectID, LLUUID parentID, ulong handle, LLVector3 position, float gain); + void SendAttachedSoundGainChange(LLUUID objectID, float gain); void SendNameReply(LLUUID profileId, string firstname, string lastname); void SendAlertMessage(string message); diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index fca78f7b97..3f971a857d 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -1559,6 +1559,15 @@ namespace OpenSim.Region.ClientStack OutPacket(sound, ThrottleOutPacketType.Task); } + public void SendAttachedSoundGainChange(LLUUID objectID, float gain) + { + AttachedSoundGainChangePacket sound = (AttachedSoundGainChangePacket)PacketPool.Instance.GetPacket(PacketType.AttachedSoundGainChange); + sound.DataBlock.ObjectID = objectID; + sound.DataBlock.Gain = gain; + + OutPacket(sound, ThrottleOutPacketType.Task); + } + public void SendSunPos(LLVector3 sunPos, LLVector3 sunVel) { SimulatorViewerTimeMessagePacket viewertime = (SimulatorViewerTimeMessagePacket)PacketPool.Instance.GetPacket(PacketType.SimulatorViewerTimeMessage); diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index ea20725242..51a633eedd 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -1739,7 +1739,21 @@ namespace OpenSim.Region.Environment.Scenes } } - public void SendSound(string sound, double volume, bool triggered) + public void AdjustSoundGain(double volume) + { + if (volume > 1) + volume = 1; + if (volume < 0) + volume = 0; + + List avatarts = m_parentGroup.Scene.GetAvatars(); + foreach (ScenePresence p in avatarts) + { + p.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume); + } + } + + public void SendSound(string sound, double volume, bool triggered, byte flags) { if (volume > 1) volume = 1; @@ -1753,7 +1767,7 @@ namespace OpenSim.Region.Environment.Scenes LLVector3 position = AbsolutePosition; // region local ulong regionHandle = m_parentGroup.Scene.RegionInfo.RegionHandle; - byte flags = 0; + //byte flags = 0; if (!LLUUID.TryParse(sound, out soundID)) { diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index f6488136d5..705f27eda2 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -411,6 +411,11 @@ namespace OpenSim.Region.Examples.SimpleModule { } + public void SendAttachedSoundGainChange(LLUUID objectID, float gain) + { + + } + public void SendAlertMessage(string message) { } diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 56c6b59642..efcec75a69 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -1214,13 +1214,14 @@ namespace OpenSim.Region.ScriptEngine.Common public void llPlaySound(string sound, double volume) { m_host.AddScriptLPS(1); - m_host.SendSound(sound, volume, false); + m_host.SendSound(sound, volume, false, 0); } public void llLoopSound(string sound, double volume) { m_host.AddScriptLPS(1); - NotImplemented("llLoopSound"); + m_host.SendSound(sound, volume, false, 1); + //NotImplemented("llLoopSound"); } public void llLoopSoundMaster(string sound, double volume) @@ -1244,13 +1245,14 @@ namespace OpenSim.Region.ScriptEngine.Common public void llTriggerSound(string sound, double volume) { m_host.AddScriptLPS(1); - m_host.SendSound(sound, volume, true); + m_host.SendSound(sound, volume, true, 0); } public void llStopSound() { m_host.AddScriptLPS(1); - NotImplemented("llStopSound"); + m_host.SendSound(LLUUID.Zero.ToString(), 1.0, false, 2); + //NotImplemented("llStopSound"); } public void llPreloadSound(string sound) @@ -2609,7 +2611,8 @@ namespace OpenSim.Region.ScriptEngine.Common public void llAdjustSoundVolume(double volume) { m_host.AddScriptLPS(1); - NotImplemented("llAdjustSoundVolume"); + m_host.AdjustSoundGain(volume); + //NotImplemented("llAdjustSoundVolume"); } public void llSetSoundQueueing(int queue)