\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));\r
+ FMODExec(channel.setVolume(volume * m_objectVolume ));\r
\r
// Take note of when the sound is finished playing.\r
FMODExec(channel.setCallback(endCallback));\r
listenerThread.Name = "ListenerThread";
listenerThread.Start();
- // Subscribe to events about inworld sounds
- instance.Client.Sound.SoundTrigger += new EventHandler<SoundTriggerEventArgs>(Sound_SoundTrigger);
- instance.Client.Sound.AttachedSound += new EventHandler<AttachedSoundEventArgs>(Sound_AttachedSound);
- instance.Client.Sound.PreloadSound += new EventHandler<PreloadSoundEventArgs>(Sound_PreloadSound);
- instance.Client.Objects.ObjectUpdate +=new EventHandler<PrimEventArgs>(Objects_ObjectUpdate);
- instance.Client.Objects.ObjectPropertiesUpdated += new EventHandler<ObjectPropertiesUpdatedEventArgs>(Objects_ObjectPropertiesUpdated);
- instance.Client.Objects.KillObject += new EventHandler<KillObjectEventArgs>(Objects_KillObject);
- instance.Client.Network.SimChanged += new EventHandler<SimChangedEventArgs>(Network_SimChanged);
+ ObjectEnable = true;
}
/// <summary>
false,
true,
e.Position,
- e.Gain);
+ e.Gain * ObjectVolume);
}
/// <summary>
(e.Flags & SoundFlags.Loop) == SoundFlags.Loop,
true,
fullPosition,
- e.Gain);
+ e.Gain * ObjectVolume);
}
(p.SoundFlags & SoundFlags.Loop) == SoundFlags.Loop,
true,
fullPosition, //Instance.State.GlobalPosition(e.Simulator, fullPosition),
- p.SoundGain);
+ p.SoundGain * ObjectVolume);
+ }
+
+ public float ObjectVolume
+ {
+ set { m_objectVolume = value; }
+ get { return m_objectVolume; }
+ }
+
+ private bool m_objectEnabled = true;
+ public bool ObjectEnable
+ {
+ set
+ {
+ if (value)
+ {
+ // Subscribe to events about inworld sounds
+ Instance.Client.Sound.SoundTrigger += new EventHandler<SoundTriggerEventArgs>(Sound_SoundTrigger);
+ Instance.Client.Sound.AttachedSound += new EventHandler<AttachedSoundEventArgs>(Sound_AttachedSound);
+ Instance.Client.Sound.PreloadSound += new EventHandler<PreloadSoundEventArgs>(Sound_PreloadSound);
+ Instance.Client.Objects.ObjectUpdate += new EventHandler<PrimEventArgs>(Objects_ObjectUpdate);
+ Instance.Client.Objects.ObjectPropertiesUpdated += new EventHandler<ObjectPropertiesUpdatedEventArgs>(Objects_ObjectPropertiesUpdated);
+ Instance.Client.Objects.KillObject += new EventHandler<KillObjectEventArgs>(Objects_KillObject);
+ Instance.Client.Network.SimChanged += new EventHandler<SimChangedEventArgs>(Network_SimChanged);
+
+ }
+ else
+ {
+ // Subscribe to events about inworld sounds
+ Instance.Client.Sound.SoundTrigger -= new EventHandler<SoundTriggerEventArgs>(Sound_SoundTrigger);
+ Instance.Client.Sound.AttachedSound -= new EventHandler<AttachedSoundEventArgs>(Sound_AttachedSound);
+ Instance.Client.Sound.PreloadSound -= new EventHandler<PreloadSoundEventArgs>(Sound_PreloadSound);
+ Instance.Client.Objects.ObjectUpdate -= new EventHandler<PrimEventArgs>(Objects_ObjectUpdate);
+ Instance.Client.Objects.ObjectPropertiesUpdated -= new EventHandler<ObjectPropertiesUpdatedEventArgs>(Objects_ObjectPropertiesUpdated);
+ Instance.Client.Objects.KillObject -= new EventHandler<KillObjectEventArgs>(Objects_KillObject);
+ Instance.Client.Network.SimChanged -= new EventHandler<SimChangedEventArgs>(Network_SimChanged);
+
+ // Stop all running sounds
+ BufferSound.KillAll();
+ }
+ m_objectEnabled = value;
+ }
+ get { return m_objectEnabled; }
}
/// <summary>
protected static FMOD.System system = null;
public FMOD.System FMODSystem { get { return system; } }
+ protected static float m_objectVolume = 0.8f;
public MediaObject()
{
// Zero out the extra info structure.
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
+ this.ObjSoundGroup = new System.Windows.Forms.GroupBox();
+ this.ObjVolume = new System.Windows.Forms.TrackBar();
+ this.ObjSoundEnable = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.volAudioStream)).BeginInit();
this.pnlParcelAudio.SuspendLayout();
+ this.ObjSoundGroup.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.ObjVolume)).BeginInit();
this.SuspendLayout();
//
// volAudioStream
this.volAudioStream.Location = new System.Drawing.Point(6, 19);
this.volAudioStream.Maximum = 50;
this.volAudioStream.Name = "volAudioStream";
- this.volAudioStream.Size = new System.Drawing.Size(347, 45);
+ this.volAudioStream.Size = new System.Drawing.Size(347, 42);
this.volAudioStream.SmallChange = 2;
this.volAudioStream.TabIndex = 1;
this.volAudioStream.Value = 25;
this.label1.TabIndex = 2;
this.label1.Text = "Stream";
//
+ // ObjSoundGroup
+ //
+ this.ObjSoundGroup.Controls.Add(this.ObjSoundEnable);
+ this.ObjSoundGroup.Controls.Add(this.ObjVolume);
+ this.ObjSoundGroup.Location = new System.Drawing.Point(3, 147);
+ this.ObjSoundGroup.Name = "ObjSoundGroup";
+ this.ObjSoundGroup.Size = new System.Drawing.Size(358, 67);
+ this.ObjSoundGroup.TabIndex = 3;
+ this.ObjSoundGroup.TabStop = false;
+ this.ObjSoundGroup.Text = "Object Sounds";
+ //
+ // ObjVolume
+ //
+ this.ObjVolume.LargeChange = 10;
+ this.ObjVolume.Location = new System.Drawing.Point(4, 12);
+ this.ObjVolume.Maximum = 50;
+ this.ObjVolume.Name = "ObjVolume";
+ this.ObjVolume.Size = new System.Drawing.Size(347, 42);
+ this.ObjVolume.SmallChange = 2;
+ this.ObjVolume.TabIndex = 2;
+ this.ObjVolume.Value = 25;
+ //
+ // ObjSoundEnable
+ //
+ this.ObjSoundEnable.AutoSize = true;
+ this.ObjSoundEnable.Checked = true;
+ this.ObjSoundEnable.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.ObjSoundEnable.Location = new System.Drawing.Point(10, 44);
+ this.ObjSoundEnable.Name = "ObjSoundEnable";
+ this.ObjSoundEnable.Size = new System.Drawing.Size(59, 17);
+ this.ObjSoundEnable.TabIndex = 5;
+ this.ObjSoundEnable.Text = "Enable";
+ this.toolTip1.SetToolTip(this.ObjSoundEnable, "When checked inworld sounds will play");
+ this.ObjSoundEnable.UseVisualStyleBackColor = true;
+ //
// MediaConsole
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.ObjSoundGroup);
this.Controls.Add(this.pnlParcelAudio);
this.Name = "MediaConsole";
- this.Size = new System.Drawing.Size(368, 147);
+ this.Size = new System.Drawing.Size(368, 217);
((System.ComponentModel.ISupportInitialize)(this.volAudioStream)).EndInit();
this.pnlParcelAudio.ResumeLayout(false);
this.pnlParcelAudio.PerformLayout();
+ this.ObjSoundGroup.ResumeLayout(false);
+ this.ObjSoundGroup.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.ObjVolume)).EndInit();
this.ResumeLayout(false);
}
public System.Windows.Forms.Label label2;
public System.Windows.Forms.ToolTip toolTip1;
public System.Windows.Forms.Label lblStation;
+ private System.Windows.Forms.GroupBox ObjSoundGroup;
+ public System.Windows.Forms.CheckBox ObjSoundEnable;
+ public System.Windows.Forms.TrackBar ObjVolume;
}
}
lblStation.Tag = lblStation.Text = string.Empty;
lblStation.Click += new EventHandler(lblStation_Click);
+ ObjVolume.Scroll += new EventHandler(volObject_Scroll);
+ ObjSoundEnable.CheckedChanged += new EventHandler(cbObjEnableChanged);
+
// Network callbacks
client.Parcels.ParcelProperties += new EventHandler<ParcelPropertiesEventArgs>(Parcels_ParcelProperties);
}
parcelStream.Volume = volAudioStream.Value/50f;
}
+ private void volObject_Scroll(object sender, EventArgs e)
+ {
+ configTimer.Change(saveConfigTimeout, System.Threading.Timeout.Infinite);
+ instance.MediaManager.ObjectVolume = ObjVolume.Value / 50f;
+ }
+
+ void cbObjEnableChanged(object sender, EventArgs e)
+ {
+ configTimer.Change(saveConfigTimeout, System.Threading.Timeout.Infinite);
+ instance.MediaManager.ObjectEnable = ObjSoundEnable.Checked;
+ }
+
private void txtAudioURL_TextChanged(object sender, EventArgs e)
{
configTimer.Change(saveConfigTimeout, System.Threading.Timeout.Infinite);
<value>2.0</value>\r
</resheader>\r
<resheader name="reader">\r
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
</resheader>\r
<resheader name="writer">\r
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\r
</resheader>\r
- <metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
+ <metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
+ <value>17, 17</value>\r
+ </metadata>\r
+ <metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
<value>17, 17</value>\r
</metadata>\r
</root>
\ No newline at end of file