public void UpdateListenerPosition(Microsoft.DirectX.Vector3 pos) { m_listener3d.Position = pos; DirectSound.Listener3DOrientation orientation = new DirectSound.Listener3DOrientation(); orientation.Front = new DirectX.Vector3((float)Math.Sin(pos.Z), (float)Math.Cos(pos.Z), (float)Math.Sin(pos.Y)); orientation.Top = new DirectX.Vector3((float)Math.Sin(pos.Z), (float)Math.Sin(pos.X), (float)Math.Cos(pos.X)); m_listener3d.Orientation = orientation; m_listener3d.CommitDeferredSettings(); }
public void Update() { if (m_listener != null) { listenerParameters.Position = m_listener.Position; Vector3 front = new Vector3(0.0f, 0.0f, 1.0f); Vector3 top = new Vector3(0.0f, 1.0f, 0.0f); Matrix transform = Matrix.RotationYawPitchRoll( m_listener.Attitude.Heading, m_listener.Attitude.Pitch, m_listener.Attitude.Roll); listenerParameters.OrientFront = Vector3.TransformCoordinate(front, transform); listenerParameters.OrientTop = Vector3.TransformCoordinate(top, transform); } applicationListener.CommitDeferredSettings(); }