Ejemplo n.º 1
0
 /// <summary> 
 /// Resets the audio connection 
 /// </summary> 
 public void Disconnect() 
 { 
     if(isRecording)
     stopRecording(); 
     tts = null; 
     audio = null; 
 } 
Ejemplo n.º 2
0
 static LocalPCInformation()
 {
     // Do not create a capture device if audio capture is disabled. Otherwise it will create a mic icon in win 10 and people will think we're spies.
     try
     {
         if (Global.Configuration.EnableAudioCapture)
         {
             captureProxy = new AudioDeviceProxy(Global.Configuration.GSIAudioCaptureDevice, DataFlow.Capture);
         }
         renderProxy = new AudioDeviceProxy(Global.Configuration.GSIAudioRenderDevice, DataFlow.Render);
     }
     catch (COMException e)
     {
         Global.logger.Error("Error initializing audio device proxy in LocalPCInfo, this is probably caused by an incompatible audio software: " + e);
     }
 }
        //connect to the Nao robot
        private void ConnectToNao(string nao_ip_address, int nao_port)
        {
            bool success = true;

            try
            {
                TextToSpeechProxy    = new TextToSpeechProxy(nao_ip_address, nao_port);
                BehaviorManagerProxy = new BehaviorManagerProxy(nao_ip_address, nao_port);
                LedsProxy            = new LedsProxy(nao_ip_address, nao_port);
                VideoRecorderProxy   = new VideoRecorderProxy(nao_ip_address, nao_port);
                MotionProxy          = new MotionProxy(nao_ip_address, nao_port);
                AudioProxy           = new AudioDeviceProxy(nao_ip_address, nao_port);
            }
            catch (Exception)
            {
                success = false;
            }
            ConnectButton.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                                                 new UpdateInterfaceAfterConnectDelegate(UpdateUserInterfaceAfterConnect), success);
        }
Ejemplo n.º 4
0
        /// <summary> 
        /// Connects to the NAO robot 
        /// </summary> 
        /// <param name="ip"> ip address of the robot </param> 
        public void connect(string ip) 
        { 
            // if audio or tts is not null it then was not properly disconnected 
            if (audio != null || tts != null) 
            { 
                Disconnect(); 
            } 
 
            // attempt to connect 
            try 
            { 
                ipString = ip; 
                audio = new AudioDeviceProxy(ip, 9559); 
                tts = new TextToSpeechProxy(ip, 9559); 
            } 
            catch (Exception e) 
            { 
                // display error message and write exceptions to a file 
                MessageBox.Show("Exception occurred, error log in C:\\NAOcam\\exception.txt"); 
                System.IO.File.WriteAllText(@"C:\\NAOcam\\exception.txt", 
e.ToString()); 
            } 
        } 
Ejemplo n.º 5
0
        /// <summary> 
        /// Stops recording audio and saves the file 
        /// to the local machine 
        /// </summary> 
        public void stopRecording() 
        { 
            // try to disconnect from audio and stop microphones from recording 
            try 
            { 
 
                // make sure audio proxy is not null 
                if (audio != null) 
                { 
                    // stop recording and set audio proxy to null 
                    audio.stopMicrophonesRecording(); 
                    audio = null; 
 
                    // Set up the Background Worker Events 
                    bgWorker.DoWork += bgWorker_DoWork; 
                    bgWorker.RunWorkerCompleted += bgWorker_WorkerCompleted; 
 
                    // Run the Background Worker 
                    bgWorker.RunWorkerAsync(); 
                } 
 
            } 
            catch (Exception e) 
            { 
                // display error message and write exceptions to a file 
                MessageBox.Show("Exception occurred, error log in C:\\NAOcam\\exception.txt"); 
                System.IO.File.WriteAllText(@"C:\\NAOcam\\exception.txt", 
e.ToString()); 
            } 
        } 
Ejemplo n.º 6
0
 public override void Dispose()
 {
     deviceProxy?.Dispose();
     deviceProxy = null;
 }
 //connect to the Nao robot
 private void ConnectToNao(string nao_ip_address, int nao_port)
 {
     bool success = true;
     try
     {
         TextToSpeechProxy = new TextToSpeechProxy(nao_ip_address, nao_port);
         BehaviorManagerProxy = new BehaviorManagerProxy(nao_ip_address, nao_port);
         LedsProxy = new LedsProxy(nao_ip_address, nao_port);
         VideoRecorderProxy = new VideoRecorderProxy(nao_ip_address, nao_port);
         MotionProxy = new MotionProxy(nao_ip_address, nao_port);
         AudioProxy = new AudioDeviceProxy(nao_ip_address, nao_port);
     }
     catch (Exception)
     {
         success = false;
     }
     ConnectButton.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
         new UpdateInterfaceAfterConnectDelegate(UpdateUserInterfaceAfterConnect), success);
 }