/// <summary> /// Start up the Voice service. /// </summary> public void Start() { // Start the background thread if (posThread != null && posThread.IsAlive) { posThread.Abort(); } posThread = new Thread(new ThreadStart(PositionThreadBody)); posThread.Name = "VoicePositionUpdate"; posThread.IsBackground = true; posRestart = new ManualResetEvent(false); posThread.Start(); Client.Network.EventQueueRunning += new EventHandler <EventQueueRunningEventArgs>(Network_EventQueueRunning); // Connection events OnDaemonRunning += new VoiceGateway.DaemonRunningCallback(connector_OnDaemonRunning); OnDaemonCouldntRun += new VoiceGateway.DaemonCouldntRunCallback(connector_OnDaemonCouldntRun); OnConnectorCreateResponse += new EventHandler <VoiceGateway.VoiceConnectorEventArgs>(connector_OnConnectorCreateResponse); OnDaemonConnected += new DaemonConnectedCallback(connector_OnDaemonConnected); OnDaemonCouldntConnect += new DaemonCouldntConnectCallback(connector_OnDaemonCouldntConnect); OnAuxAudioPropertiesEvent += new EventHandler <AudioPropertiesEventArgs>(connector_OnAuxAudioPropertiesEvent); // Session events OnSessionStateChangeEvent += new EventHandler <SessionStateChangeEventArgs>(connector_OnSessionStateChangeEvent); OnSessionAddedEvent += new EventHandler <SessionAddedEventArgs>(connector_OnSessionAddedEvent); // Session Participants events OnSessionParticipantUpdatedEvent += new EventHandler <ParticipantUpdatedEventArgs>(connector_OnSessionParticipantUpdatedEvent); OnSessionParticipantAddedEvent += new EventHandler <ParticipantAddedEventArgs>(connector_OnSessionParticipantAddedEvent); // Device events OnAuxGetCaptureDevicesResponse += new EventHandler <VoiceDevicesEventArgs>(connector_OnAuxGetCaptureDevicesResponse); OnAuxGetRenderDevicesResponse += new EventHandler <VoiceDevicesEventArgs>(connector_OnAuxGetRenderDevicesResponse); // Generic status response OnVoiceResponse += new EventHandler <VoiceResponseEventArgs>(connector_OnVoiceResponse); // Account events OnAccountLoginResponse += new EventHandler <VoiceAccountEventArgs>(connector_OnAccountLoginResponse); Logger.Log("Voice initialized", Helpers.LogLevel.Info); // If voice provisioning capability is already available, // proceed with voice startup. Otherwise the EventQueueRunning // event will do it. System.Uri vCap = Client.Network.CurrentSim.Caps.CapabilityURI("ProvisionVoiceAccountRequest"); if (vCap != null) { RequestVoiceProvision(vCap); } }
/// <summary> /// Start up the Voice service. /// </summary> public void Start() { // Start the background thread if (posThread != null && posThread.IsAlive) posThread.Abort(); posThread = new Thread(new ThreadStart(PositionThreadBody)); posThread.Name = "VoicePositionUpdate"; posThread.IsBackground = true; posRestart = new ManualResetEvent(false); posThread.Start(); Client.Network.EventQueueRunning += new EventHandler<EventQueueRunningEventArgs>(Network_EventQueueRunning); // Connection events OnDaemonRunning += new VoiceGateway.DaemonRunningCallback(connector_OnDaemonRunning); OnDaemonCouldntRun += new VoiceGateway.DaemonCouldntRunCallback(connector_OnDaemonCouldntRun); OnConnectorCreateResponse += new EventHandler<VoiceGateway.VoiceConnectorEventArgs>(connector_OnConnectorCreateResponse); OnDaemonConnected += new DaemonConnectedCallback(connector_OnDaemonConnected); OnDaemonCouldntConnect += new DaemonCouldntConnectCallback(connector_OnDaemonCouldntConnect); OnAuxAudioPropertiesEvent += new EventHandler<AudioPropertiesEventArgs>(connector_OnAuxAudioPropertiesEvent); // Session events OnSessionStateChangeEvent += new EventHandler<SessionStateChangeEventArgs>(connector_OnSessionStateChangeEvent); OnSessionAddedEvent += new EventHandler<SessionAddedEventArgs>(connector_OnSessionAddedEvent); // Session Participants events OnSessionParticipantUpdatedEvent += new EventHandler<ParticipantUpdatedEventArgs>(connector_OnSessionParticipantUpdatedEvent); OnSessionParticipantAddedEvent += new EventHandler<ParticipantAddedEventArgs>(connector_OnSessionParticipantAddedEvent); // Device events OnAuxGetCaptureDevicesResponse += new EventHandler<VoiceDevicesEventArgs>(connector_OnAuxGetCaptureDevicesResponse); OnAuxGetRenderDevicesResponse += new EventHandler<VoiceDevicesEventArgs>(connector_OnAuxGetRenderDevicesResponse); // Generic status response OnVoiceResponse += new EventHandler<VoiceResponseEventArgs>(connector_OnVoiceResponse); // Account events OnAccountLoginResponse += new EventHandler<VoiceAccountEventArgs>(connector_OnAccountLoginResponse); Logger.Log("Voice initialized", Helpers.LogLevel.Info); // If voice provisioning capability is already available, // proceed with voice startup. Otherwise the EventQueueRunning // event will do it. System.Uri vCap = Client.Network.CurrentSim.Caps.CapabilityURI("ProvisionVoiceAccountRequest"); if (vCap != null) RequestVoiceProvision(vCap); }