Exemple #1
0
 /// <summary>
 /// Set the combined speaking and listening position in 3D space.
 /// There appears to be no response to this request.
 /// </summary>
 /// <param name="SessionHandle">Handle returned from successful Session ‘create’ request or a SessionNewEvent</param>
 /// <param name="SpeakerPosition">Speaking position</param>
 /// <param name="ListenerPosition">Listening position</param>
 /// <returns></returns>
 public int SessionSet3DPosition(string SessionHandle, VoicePosition SpeakerPosition, VoicePosition ListenerPosition)
 {
     StringBuilder sb = new StringBuilder();
     sb.Append(VoiceGateway.MakeXML("SessionHandle", SessionHandle));
     sb.Append("<SpeakerPosition>");
     sb.Append("<Position>");
     sb.Append(VoiceGateway.MakeXML("X", SpeakerPosition.Position.X.ToString()));
     sb.Append(VoiceGateway.MakeXML("Y", SpeakerPosition.Position.Y.ToString()));
     sb.Append(VoiceGateway.MakeXML("Z", SpeakerPosition.Position.Z.ToString()));
     sb.Append("</Position>");
     sb.Append("<Velocity>");
     sb.Append(VoiceGateway.MakeXML("X", SpeakerPosition.Velocity.X.ToString()));
     sb.Append(VoiceGateway.MakeXML("Y", SpeakerPosition.Velocity.Y.ToString()));
     sb.Append(VoiceGateway.MakeXML("Z", SpeakerPosition.Velocity.Z.ToString()));
     sb.Append("</Velocity>");
     sb.Append("<AtOrientation>");
     sb.Append(VoiceGateway.MakeXML("X", SpeakerPosition.AtOrientation.X.ToString()));
     sb.Append(VoiceGateway.MakeXML("Y", SpeakerPosition.AtOrientation.Y.ToString()));
     sb.Append(VoiceGateway.MakeXML("Z", SpeakerPosition.AtOrientation.Z.ToString()));
     sb.Append("</AtOrientation>");
     sb.Append("<UpOrientation>");
     sb.Append(VoiceGateway.MakeXML("X", SpeakerPosition.UpOrientation.X.ToString()));
     sb.Append(VoiceGateway.MakeXML("Y", SpeakerPosition.UpOrientation.Y.ToString()));
     sb.Append(VoiceGateway.MakeXML("Z", SpeakerPosition.UpOrientation.Z.ToString()));
     sb.Append("</UpOrientation>");
     sb.Append("<LeftOrientation>");
     sb.Append(VoiceGateway.MakeXML("X", SpeakerPosition.LeftOrientation.X.ToString()));
     sb.Append(VoiceGateway.MakeXML("Y", SpeakerPosition.LeftOrientation.Y.ToString()));
     sb.Append(VoiceGateway.MakeXML("Z", SpeakerPosition.LeftOrientation.Z.ToString()));
     sb.Append("</LeftOrientation>");
     sb.Append("</SpeakerPosition>");
     sb.Append("<ListenerPosition>");
     sb.Append("<Position>");
     sb.Append(VoiceGateway.MakeXML("X", ListenerPosition.Position.X.ToString()));
     sb.Append(VoiceGateway.MakeXML("Y", ListenerPosition.Position.Y.ToString()));
     sb.Append(VoiceGateway.MakeXML("Z", ListenerPosition.Position.Z.ToString()));
     sb.Append("</Position>");
     sb.Append("<Velocity>");
     sb.Append(VoiceGateway.MakeXML("X", ListenerPosition.Velocity.X.ToString()));
     sb.Append(VoiceGateway.MakeXML("Y", ListenerPosition.Velocity.Y.ToString()));
     sb.Append(VoiceGateway.MakeXML("Z", ListenerPosition.Velocity.Z.ToString()));
     sb.Append("</Velocity>");
     sb.Append("<AtOrientation>");
     sb.Append(VoiceGateway.MakeXML("X", ListenerPosition.AtOrientation.X.ToString()));
     sb.Append(VoiceGateway.MakeXML("Y", ListenerPosition.AtOrientation.Y.ToString()));
     sb.Append(VoiceGateway.MakeXML("Z", ListenerPosition.AtOrientation.Z.ToString()));
     sb.Append("</AtOrientation>");
     sb.Append("<UpOrientation>");
     sb.Append(VoiceGateway.MakeXML("X", ListenerPosition.UpOrientation.X.ToString()));
     sb.Append(VoiceGateway.MakeXML("Y", ListenerPosition.UpOrientation.Y.ToString()));
     sb.Append(VoiceGateway.MakeXML("Z", ListenerPosition.UpOrientation.Z.ToString()));
     sb.Append("</UpOrientation>");
     sb.Append("<LeftOrientation>");
     sb.Append(VoiceGateway.MakeXML("X", ListenerPosition.LeftOrientation.X.ToString()));
     sb.Append(VoiceGateway.MakeXML("Y", ListenerPosition.LeftOrientation.Y.ToString()));
     sb.Append(VoiceGateway.MakeXML("Z", ListenerPosition.LeftOrientation.Z.ToString()));
     sb.Append("</LeftOrientation>");
     sb.Append("</ListenerPosition>");
     return Request("Session.Set3DPosition.1", sb.ToString());
 }
        /// <summary>
        /// Set the combined speaking and listening position in 3D space.
        /// There appears to be no response to this request.
        /// </summary>
        /// <param name="SessionHandle">Handle returned from successful Session ‘create’ request or a SessionNewEvent</param>
        /// <param name="SpeakerPosition">Speaking position</param>
        /// <param name="ListenerPosition">Listening position</param>
        /// <returns></returns>
        public int SessionSet3DPosition(string SessionHandle, VoicePosition SpeakerPosition, VoicePosition ListenerPosition)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(VoiceGateway.MakeXML("SessionHandle", SessionHandle));
            sb.Append("<SpeakerPosition>");
            sb.Append("<Position>");
            sb.Append(VoiceGateway.MakeXML("X", SpeakerPosition.Position.X.ToString()));
            sb.Append(VoiceGateway.MakeXML("Y", SpeakerPosition.Position.Y.ToString()));
            sb.Append(VoiceGateway.MakeXML("Z", SpeakerPosition.Position.Z.ToString()));
            sb.Append("</Position>");
            sb.Append("<Velocity>");
            sb.Append(VoiceGateway.MakeXML("X", SpeakerPosition.Velocity.X.ToString()));
            sb.Append(VoiceGateway.MakeXML("Y", SpeakerPosition.Velocity.Y.ToString()));
            sb.Append(VoiceGateway.MakeXML("Z", SpeakerPosition.Velocity.Z.ToString()));
            sb.Append("</Velocity>");
            sb.Append("<AtOrientation>");
            sb.Append(VoiceGateway.MakeXML("X", SpeakerPosition.AtOrientation.X.ToString()));
            sb.Append(VoiceGateway.MakeXML("Y", SpeakerPosition.AtOrientation.Y.ToString()));
            sb.Append(VoiceGateway.MakeXML("Z", SpeakerPosition.AtOrientation.Z.ToString()));
            sb.Append("</AtOrientation>");
            sb.Append("<UpOrientation>");
            sb.Append(VoiceGateway.MakeXML("X", SpeakerPosition.UpOrientation.X.ToString()));
            sb.Append(VoiceGateway.MakeXML("Y", SpeakerPosition.UpOrientation.Y.ToString()));
            sb.Append(VoiceGateway.MakeXML("Z", SpeakerPosition.UpOrientation.Z.ToString()));
            sb.Append("</UpOrientation>");
            sb.Append("<LeftOrientation>");
            sb.Append(VoiceGateway.MakeXML("X", SpeakerPosition.LeftOrientation.X.ToString()));
            sb.Append(VoiceGateway.MakeXML("Y", SpeakerPosition.LeftOrientation.Y.ToString()));
            sb.Append(VoiceGateway.MakeXML("Z", SpeakerPosition.LeftOrientation.Z.ToString()));
            sb.Append("</LeftOrientation>");
            sb.Append("</SpeakerPosition>");
            sb.Append("<ListenerPosition>");
            sb.Append("<Position>");
            sb.Append(VoiceGateway.MakeXML("X", ListenerPosition.Position.X.ToString()));
            sb.Append(VoiceGateway.MakeXML("Y", ListenerPosition.Position.Y.ToString()));
            sb.Append(VoiceGateway.MakeXML("Z", ListenerPosition.Position.Z.ToString()));
            sb.Append("</Position>");
            sb.Append("<Velocity>");
            sb.Append(VoiceGateway.MakeXML("X", ListenerPosition.Velocity.X.ToString()));
            sb.Append(VoiceGateway.MakeXML("Y", ListenerPosition.Velocity.Y.ToString()));
            sb.Append(VoiceGateway.MakeXML("Z", ListenerPosition.Velocity.Z.ToString()));
            sb.Append("</Velocity>");
            sb.Append("<AtOrientation>");
            sb.Append(VoiceGateway.MakeXML("X", ListenerPosition.AtOrientation.X.ToString()));
            sb.Append(VoiceGateway.MakeXML("Y", ListenerPosition.AtOrientation.Y.ToString()));
            sb.Append(VoiceGateway.MakeXML("Z", ListenerPosition.AtOrientation.Z.ToString()));
            sb.Append("</AtOrientation>");
            sb.Append("<UpOrientation>");
            sb.Append(VoiceGateway.MakeXML("X", ListenerPosition.UpOrientation.X.ToString()));
            sb.Append(VoiceGateway.MakeXML("Y", ListenerPosition.UpOrientation.Y.ToString()));
            sb.Append(VoiceGateway.MakeXML("Z", ListenerPosition.UpOrientation.Z.ToString()));
            sb.Append("</UpOrientation>");
            sb.Append("<LeftOrientation>");
            sb.Append(VoiceGateway.MakeXML("X", ListenerPosition.LeftOrientation.X.ToString()));
            sb.Append(VoiceGateway.MakeXML("Y", ListenerPosition.LeftOrientation.Y.ToString()));
            sb.Append(VoiceGateway.MakeXML("Z", ListenerPosition.LeftOrientation.Z.ToString()));
            sb.Append("</LeftOrientation>");
            sb.Append("</ListenerPosition>");
            return(Request("Session.Set3DPosition.1", sb.ToString()));
        }
        /// <summary>
        /// Set the combined speaking and listening position in 3D space.
        /// There appears to be no response to this request.
        /// </summary>
        /// <param name="SessionHandle">Handle returned from successful Session �create�Erequest or a SessionNewEvent</param>
        /// <param name="SpeakerPosition">Speaking position</param>
        /// <param name="ListenerPosition">Listening position</param>
        /// <returns></returns>
        public int RequestSet3DPosition(string SessionHandle, VoicePosition SpeakerPosition, VoicePosition ListenerPosition)
        {
            if (_DaemonPipe.Connected)
            {
                StringBuilder request = new StringBuilder();
                request.Append(String.Format("<Request requestId=\"{0}\" action=\"Session.Set3DPosition.1\">", _CommandCookie++));
                request.Append(String.Format("<SessionHandle>{0}</SessionHandle>", SessionHandle));
                request.Append("<OrientationType>legacy</OrientationType>");
                request.Append("<SpeakerPosition>");
                request.Append("<Position>");
                request.Append(String.Format("<X>{0}</X>", SpeakerPosition.Position.X.ToString()));
                request.Append(String.Format("<Y>{0}</Y>", SpeakerPosition.Position.Y.ToString()));
                request.Append(String.Format("<Z>{0}</Z>", SpeakerPosition.Position.Z.ToString()));
                request.Append("</Position>");
                request.Append("<Velocity>");
                request.Append(String.Format("<X>{0}</X>", SpeakerPosition.Velocity.X.ToString()));
                request.Append(String.Format("<Y>{0}</Y>", SpeakerPosition.Velocity.Y.ToString()));
                request.Append(String.Format("<Z>{0}</Z>", SpeakerPosition.Velocity.Z.ToString()));
                request.Append("</Velocity>");
                request.Append("<AtOrientation>");
                request.Append(String.Format("<X>{0}</X>", SpeakerPosition.AtOrientation.X.ToString()));
                request.Append(String.Format("<Y>{0}</Y>", SpeakerPosition.AtOrientation.Y.ToString()));
                request.Append(String.Format("<Z>{0}</Z>", SpeakerPosition.AtOrientation.Z.ToString()));
                request.Append("</AtOrientation>");
                request.Append("<UpOrientation>");
                request.Append(String.Format("<X>{0}</X>", SpeakerPosition.UpOrientation.X.ToString()));
                request.Append(String.Format("<Y>{0}</Y>", SpeakerPosition.UpOrientation.Y.ToString()));
                request.Append(String.Format("<Z>{0}</Z>", SpeakerPosition.UpOrientation.Z.ToString()));
                request.Append("</UpOrientation>");
                request.Append("<LeftOrientation>");
                request.Append(String.Format("<X>{0}</X>", SpeakerPosition.LeftOrientation.X.ToString()));
                request.Append(String.Format("<Y>{0}</Y>", SpeakerPosition.LeftOrientation.Y.ToString()));
                request.Append(String.Format("<Z>{0}</Z>", SpeakerPosition.LeftOrientation.Z.ToString()));
                request.Append("</LeftOrientation>");
                request.Append("</SpeakerPosition>");
                request.Append("<ListenerPosition>");
                request.Append("<Position>");
                request.Append(String.Format("<X>{0}</X>", ListenerPosition.Position.X.ToString()));
                request.Append(String.Format("<Y>{0}</Y>", ListenerPosition.Position.Y.ToString()));
                request.Append(String.Format("<Z>{0}</Z>", ListenerPosition.Position.Z.ToString()));
                request.Append("</Position>");
                request.Append("<Velocity>");
                request.Append(String.Format("<X>{0}</X>", ListenerPosition.Velocity.X.ToString()));
                request.Append(String.Format("<Y>{0}</Y>", ListenerPosition.Velocity.Y.ToString()));
                request.Append(String.Format("<Z>{0}</Z>", ListenerPosition.Velocity.Z.ToString()));
                request.Append("</Velocity>");
                request.Append("<AtOrientation>");
                request.Append(String.Format("<X>{0}</X>", ListenerPosition.AtOrientation.X.ToString()));
                request.Append(String.Format("<Y>{0}</Y>", ListenerPosition.AtOrientation.Y.ToString()));
                request.Append(String.Format("<Z>{0}</Z>", ListenerPosition.AtOrientation.Z.ToString()));
                request.Append("</AtOrientation>");
                request.Append("<UpOrientation>");
                request.Append(String.Format("<X>{0}</X>", ListenerPosition.UpOrientation.X.ToString()));
                request.Append(String.Format("<Y>{0}</Y>", ListenerPosition.UpOrientation.Y.ToString()));
                request.Append(String.Format("<Z>{0}</Z>", ListenerPosition.UpOrientation.Z.ToString()));
                request.Append("</UpOrientation>");
                request.Append("<LeftOrientation>");
                request.Append(String.Format("<X>{0}</X>", ListenerPosition.LeftOrientation.X.ToString()));
                request.Append(String.Format("<Y>{0}</Y>", ListenerPosition.LeftOrientation.Y.ToString()));
                request.Append(String.Format("<Z>{0}</Z>", ListenerPosition.LeftOrientation.Z.ToString()));
                request.Append("</LeftOrientation>");
                request.Append("</ListenerPosition>");
                request.Append("</Request>");
                request.Append(REQUEST_TERMINATOR);

                _DaemonPipe.SendData(Encoding.ASCII.GetBytes(request.ToString()));

                return _CommandCookie - 1;
            }
            else
            {
                Logger.Log("VoiceManager.RequestStopTuningMode() called when the daemon pipe is disconnected", Helpers.LogLevel.Error, Client);
                return _CommandCookie - 1;
            }
        }