From 78bec422259671ad72ad46ca98ab8029b78aefe5 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Fri, 29 May 2009 22:44:49 +0000 Subject: * Implements Sound on Objects for IObject in MRM * Method: IObject.Sound.Play(UUID sound, double volume) * More feature-packed API to come soon. (I want a World.Sound with arbitrary positioning) --- .../Scripting/Minimodule/Interfaces/IObject.cs | 1 + .../Scripting/Minimodule/Object/IObjectSound.cs | 12 ++++++++++++ .../OptionalModules/Scripting/Minimodule/SOPObject.cs | 17 ++++++++++++++++- 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectSound.cs (limited to 'OpenSim/Region/OptionalModules/Scripting/Minimodule') diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs index ef1e896..dd9cc29 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs @@ -170,6 +170,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule IObjectPhysics Physics { get; } + IObjectSound Sound { get; } /// /// Causes the object to speak to its surroundings, diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectSound.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectSound.cs new file mode 100644 index 0000000..7204f02 --- /dev/null +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Object/IObjectSound.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenMetaverse; + +namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.Object +{ + interface IObjectSound + { + void Play(UUID soundAsset, double volume); + } +} diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs index f29522f..c1c255b 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs @@ -38,7 +38,7 @@ using SculptType=OpenSim.Region.OptionalModules.Scripting.Minimodule.Object.Scul namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { - class SOPObject : MarshalByRefObject, IObject, IObjectPhysics, IObjectShape + class SOPObject : MarshalByRefObject, IObject, IObjectPhysics, IObjectShape, IObjectSound { private readonly Scene m_rootScene; private readonly uint m_localID; @@ -638,5 +638,20 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule #endregion + + + #region Implementation of IObjectSound + + public IObjectSound Sound + { + get { return this; } + } + + public void Play(UUID asset, double volume) + { + GetSOP().SendSound(asset.ToString(), volume, true, 0); + } + + #endregion } } -- cgit v1.1