private void PlayAudio()
        {
            System.Media.SoundPlayer player = new System.Media.SoundPlayer();

            player.SoundLocation = _audioFiles[_audioFileCount];
            AudioFileEventArgs eventArgs = new AudioFileEventArgs();

            eventArgs.AudioFile = _audioFiles[_audioFileCount];

            OnNewTrack(eventArgs);
            player.PlaySync();

            OnAudioStopped(null);
        }
Esempio n. 2
0
        void _experiment_NewTrack(object sender, EventArgs e)
        {
            AudioFileEventArgs audioTrack = (AudioFileEventArgs)e;

            try
            {
                // create new AVI file and open it
                //string writerfile = "..\\" + _currentUser + ".avi"
                //_writer.FrameRate = 17;
                _writer.Open("..\\" + _currentUser + Path.GetFileName(audioTrack.AudioFile) + ".avi", _videoSource.VideoResolution.FrameSize.Width, _videoSource.VideoResolution.FrameSize.Height);
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message, Control.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                throw;
            }

            string filename1 = "..\\" + _currentUser + Path.GetFileName(audioTrack.AudioFile) + "_Shimmer1.csv";
            string filename2 = "..\\" + _currentUser + Path.GetFileName(audioTrack.AudioFile) + "_Shimmer2.csv";

            try
            {
                _writeToFileShimmer1 = new Logging(filename1, _delimeter);
                _writeToFileShimmer2 = new Logging(filename2, _delimeter);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Control.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                throw;
            }

            ////ECG-HR Conversion
            if (_enableECGtoHRConversion)
            {
                ECGtoHR = new ECGToHR(ShimmerDevice1.GetSamplingRate(), TrainingPeriodECG, NumberOfHeartBeatsToAverageECG);
            }
            ExGLeadOffCounter     = 0;
            ExGLeadOffCounterSize = (int)ShimmerDevice1.GetSamplingRate();
            ShimmerIdSetup.Clear();

            ShimmerDevice1.StartStreaming();
            ShimmerDevice2.StartStreaming();

            _writeData = true;
        }