Implements llLoopSound(), llStopSound(), and llAdjustSoundVolume().

0.6.0-stable
alondria 2008-03-22 23:02:41 +00:00
parent 74023aa97c
commit 5ebef6410e
5 changed files with 39 additions and 7 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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<ScenePresence> 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))
{

View File

@ -411,6 +411,11 @@ namespace OpenSim.Region.Examples.SimpleModule
{
}
public void SendAttachedSoundGainChange(LLUUID objectID, float gain)
{
}
public void SendAlertMessage(string message)
{
}

View File

@ -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)