void Update()
 {
     if (isReadyToLoadLevel)
     {
         Application.LoadLevel("RealSense_Testing");
         sr.StopRec();
         isReadyToLoadLevel = false;
         Debug.Log("Cleaning up in Update whilst Initializing ApplicationLoadLevel");
         sr.Dispose();
     }
     if (isReadyToRestartLevel)
     {
         Application.LoadLevel("SettingUpVoiceTests");
         sr.StopRec();
         isReadyToRestartLevel = false;
         Debug.Log("Cleaning up in Update whilst Restart for ApplicationLoadLevel");
         sr.Dispose();
     }
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            // create client instance
            client = new MqttClient(IPAddress.Parse(MQTT_BROKER_ADDRESS));

            string clientId = Guid.NewGuid().ToString();

            client.Connect(clientId, "guest", "guest");

            SubscribeMessage();

            isActive = false;
            //Init speech recognizer
            session = PXCMSession.CreateInstance();
            SetupRecognizer(session);

            Console.WriteLine("Siap melayani boss...");
            Console.WriteLine("Teken 'x' kalau mau mecat saya");
            while (true)
            {
                ConsoleKeyInfo pressedKey = Console.ReadKey(true);
                char           keychar    = pressedKey.KeyChar;
                if (keychar == 'x')
                {
                    break;
                }
            }

            Console.WriteLine("Selamat tinggal bos, senang melayani..");
            client.Disconnect();
            try
            {
                if (sr != null)
                {
                    sr.StopRec();
                    sr.Dispose();
                    sr = null;
                }
                if (source != null)
                {
                    source.Dispose();
                    source = null;
                }
                if (session != null)
                {
                    session.Dispose();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + " : " + ex.StackTrace);
            }
        }
    void OnDisable()
    {
        if (sr != null)
        {
            sr.StopRec();
            sr.Dispose();
        }

        if (session != null)
        {
            session.Dispose();
        }
    }
Exemplo n.º 4
0
 void CleanUp()
 {
     if (sr != null)
     {
         sr.Dispose();
         sr = null;
     }
     if (source != null)
     {
         source.Dispose();
         source = null;
     }
 }
        private void ReleaseResources()
        {
            speechRecognition.StopRec();
            speechRecognition.Dispose();
            audioSource.Dispose();
            session.Dispose();
            // Stop the worker thread
            processingThread.Abort();

            // Release resources
            faceData.Dispose();
            senseManager.Dispose();
        }
Exemplo n.º 6
0
        private void Uninitialize()
        {
            if (senseManager != null)
            {
                senseManager.Dispose();
                senseManager = null;
            }

            if (audioSource != null)
            {
                audioSource.Dispose();
                audioSource = null;
            }

            if (recognition != null)
            {
                recognition.Dispose();
                recognition = null;
            }
        }
 public void Deactivate()
 {
     Debug.Log("Deactivete");
     try
     {
         if (sr != null)
         {
             //StopRecを実行するとUnityがクラッシュする原因不明
             //sr.StopRec();
             sr.Dispose();
         }
         if (session != null)
         {
             session.Dispose();
         }
     }
     catch
     {
         FindObjectOfType <ErrorReciever>().Error("Error 601 : IntelRealsence Deactivate Error");
     }
 }