Ejemplo n.º 1
0
        /// <summary>
        /// Stops the performance
        /// </summary>
        public void Stop()
        {
            played = false;
            if (ReplayView.Get().Avatar.IsEnabled&& skeletonScrolling != null)
            {
                skeletonScrolling.Stop();
            }
            if (DrawingSheetView.Get().ReplayVideo.Source != null)
            {
                DrawingSheetView.Get().ReplayVideo.Position = new TimeSpan(0, 0, 0, 0, 5);
                DrawingSheetView.Get().ReplayVideo.Stop();
            }
            if (DrawingSheetView.Get().ReplayAudio.Source != null)
            {
                DrawingSheetView.Get().ReplayAudio.Position = new TimeSpan(0, 0, 0, 0, 5);
                DrawingSheetView.Get().ReplayAudio.Stop();
            }
            Tools.resetStopWatch();
            ReplayAvatar.offset   = 0;
            ReplayAvatar.realTime = true;
            currentListNumber     = 0;
            ReplayView.Get().PauseButton.IsEnabled = false;

            // Icons cleaning and initialization of the feedback queue thanks to the save
            IconViewModel.get().clearAll();
            if (filePath != null)
            {
                DrawingSheetView.Get().ReplayVideo.Source = new Uri(filePath, UriKind.Relative);
            }
        }
Ejemplo n.º 2
0
        ///<summary>
        ///Releasing the media elements when closing the replay window
        ///Switch to recording mode
        ///Written by Baptiste Germond
        ///</summary>
        private void quit()
        {
            isReplaying    = false;
            statisticsPath = "";
            if (skeletonScrolling != null)
            {
                skeletonScrolling.Stop();
                skeletonScrolling = null;
            }
            (TrainingSideTool.Get().FindResource("StopReplayButtonAction") as Storyboard).Begin();
            DrawingSheetView.Get().ReplayVideo.Close();
            DrawingSheetView.Get().ReplayVideo.Source = null;
            DrawingSheetView.Get().ReplayAudio.Close();
            DrawingSheetView.Get().ReplayAudio.Source = null;
            ReplayView.Get().SoundCheckbox.IsChecked = false;
            SideToolsViewModel.Get().enableTrackingAndTrainingTab();
            TrainingSideToolViewModel.Get().recordingMode();
            DrawingSheetAvatarViewModel.Get().normalMode();

            // reactivate the sensors
            KinectDevice.sensor.SkeletonStream.Enable();
            if (faceTrack)
            {
                KinectDevice.faceTracking = true;
            }
            TrackingSideToolViewModel.get().SpeedRate = speedRateActive;

            // reactivate the audience
            if (TrainingSideToolViewModel.audienceOn)
            {
                TrainingSideToolViewModel.audienceOn = false;
                GeneralSideTool.Get().AudienceControlCheckBox.IsChecked = true;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Constructor
        /// Modified by Baptiste Germond
        /// </summary>
        /// <param name="file"></param>
        private ReplayViewModel(String file)
        {
            filePath = file;
            instance = this;
            performanceSoundCommand   = new RelayCommand(performanceSound);
            playPerformanceCommand    = new RelayCommand(Play);
            pausePerformanceCommand   = new RelayCommand(Pause);
            stopPerformanceCommand    = new RelayCommand(Stop);
            videoAvatarDisplayCommand = new RelayCommand(videoAvatarDisplay);
            avatarDisplayCommand      = new RelayCommand(avatarDisplay);
            streamDisplayCommand      = new RelayCommand(videoStreamDisplay);
            quitCommand        = new RelayCommand(quit);
            otherReplayCommand = new RelayCommand(otherReplay);
            Tools.initStopWatch();

            DrawingSheetView.Get().ReplayVideo.MediaEnded += videoEnded;

            SideToolsViewModel.Get().disableTrackingAndTrainingTab();
            ManagePerformanceFiles();
            //ManageSpeedElements();
            Mute();
            pauseButtonCommand();
            if (!skdRead)
            {
                throw new Exception(".skd file is not correct\nPlease try with one avatarSkeletonData.skd file correct");
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// mutes the performance
 /// </summary>
 public void Mute()
 {
     mute = true;
     if (audioSource)
     {
         DrawingSheetView.Get().ReplayAudio.IsMuted = true;
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Activate the useful buttons
 /// Added by Baptiste Germond
 /// </summary>
 private void activate(RadioButton replayViewRadio, RadioButton generalSideToolButton)
 {
     replayViewRadio.IsChecked       = true;
     generalSideToolButton.IsChecked = true;
     replayViewRadio.IsEnabled       = true;
     replayViewRadio.Opacity         = 1;
     DrawingSheetView.Get().ReplayVideo.Visibility = Visibility.Visible;
 }
 /// <summary>
 /// Allow to get / create an instance of a drawingsheetstreamviewmodel with safety
 /// </summary>
 /// <param name="drawingSheetView"></param>
 /// <returns></returns>
 public static DrawingSheetStreamViewModel Get(DrawingSheetView drawingSheetView)
 {
     if (dssvm == null)
     {
         dssvm = new DrawingSheetStreamViewModel(drawingSheetView);
     }
     return(dssvm);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Displays the avatar view
 /// </summary>
 public void avatarDisplay()
 {
     if (filePathAvatar != null)
     {
         filePath = filePathVideoAvatar;
         DrawingSheetView.Get().Show3DSheet();
         PlayOrStop();
     }
 }
        /// <summary>
        /// Private constructor because we want to have a singleton
        /// </summary>
        /// <param name="dsv"></param>
        private DrawingSheetStreamViewModel(DrawingSheetView dsv)
        {
            this.dsv = dsv;
            listImg  = new List <ImageFeedbacksPerso>();
            loadPictureInResource();
            loadImageFromRessource();
            AddImageOnCanvas();

            KinectDevice.KinectChanged += kinectChanged;
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Manage the loading of the file the user choose
 /// Added by Baptiste Germond
 /// </summary>
 private void ManagePerformanceFiles()
 {
     if (File.Exists(filePath))
     {
         if (Path.GetFileName(filePath) == "stream.avi")
         {
             folderPath = filePath.Remove(filePath.Length - 10);
             DrawingSheetView.Get().ShowReplayVideoSheet();
             filePathVideoStream = filePath;
             activate(ReplayView.Get().Stream, GeneralSideTool.Get().Stream);
             DrawingSheetView.Get().ReplayVideo.Source = new Uri(filePathVideoStream, UriKind.Relative);
             skeletonScrolling = null;
             DrawingSheetView.Get().CanvasFeedback.Visibility = Visibility.Visible;
             tryAddOtherSources("stream.avi");
             isReplaying = true;
         }
         else if (Path.GetFileName(filePath) == "avatarSkeletonData.skd")
         {
             try
             {
                 folderPath = filePath.Remove(filePath.Length - 22);
                 skdRead    = true;
                 DrawingSheetView.Get().Show3DSheet();
                 filePathAvatar = filePath;
                 activate(ReplayView.Get().Avatar, GeneralSideTool.Get().Avatar);
                 voiceData = filePath.Replace("avatarSkeletonData.skd", "tonePeakData.xml");
                 if (!File.Exists(voiceData))
                 {
                     voiceData = "";
                 }
                 faceData = filePath.Replace("avatarSkeletonData.skd", "faceData.xml");
                 if (!File.Exists(faceData))
                 {
                     faceData = "";
                 }
                 skeletonScrolling = new ReplayAvatar(filePathAvatar, faceData, voiceData, this);
                 tryAddOtherSources("avatarSkeletonData.skd");
                 isReplaying = true;
             }
             catch (XmlLoadingException)
             {
                 throw;
             }
         }
         if (isReplaying)
         {
             ReplayView.Get().TitleReplay.Content = Path.GetFileName((Path.GetDirectoryName(filePath)));
         }
     }
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Adding the other replay available with the replay the user chose
        /// Added by Baptiste Germond
        /// </summary>
        public void tryAddOtherSources(string fileBase)
        {
            bool audioLoad = false;

            foreach (string s in Directory.GetFiles(Path.GetDirectoryName(filePath)))
            {
                string fileName = Path.GetFileName(s);
                if (fileName != fileBase)
                {
                    if (fileName == "avatarSkeletonData.skd")
                    {
                        // the replay needs an instance of ReplayAvatar, so if the first file chose is not the .skd
                        // we have to create one
                        skdRead           = true;
                        skeletonScrolling = new ReplayAvatar(s, this);
                        addOtherVideoSources(ReplayView.Get().Avatar);
                        filePathAvatar = s;
                    }
                    else if (fileName == "stream.avi")
                    {
                        addOtherVideoSources(ReplayView.Get().Stream);
                        filePathVideoStream = s;
                    }
                    else if (fileName == "audio.wav" && !audioLoad)
                    {
                        AddAudio(s);
                        audioLoad = true;
                    }
                    else if (fileName == "feedback.txt")
                    {
                        initialiseFeedbacksQueue(s);
                    }
                    else if (fileName == "charts.xml")
                    {
                        statisticsPath = s;
                    }
                }
            }
            if (!audioLoad)
            {
                ReplayView.Get().SoundCheckbox.IsEnabled = false;
                DrawingSheetView.Get().ReplayAudio.Source = null;
                audioSource = false;
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Pauses the performance
        /// </summary>
        public void Pause()
        {
            played = false;
            if (ReplayView.Get().Avatar.IsEnabled&& skeletonScrolling != null)
            {
                skeletonScrolling.Pause();
            }
            if (DrawingSheetView.Get().ReplayVideo.Source != null)
            {
                DrawingSheetView.Get().ReplayVideo.Visibility = Visibility.Visible;
                DrawingSheetView.Get().ReplayVideo.Pause();
            }
            if (DrawingSheetView.Get().ReplayAudio.Source != null)
            {
                DrawingSheetView.Get().ReplayAudio.Pause();
            }

            ReplayView.Get().PauseButton.IsEnabled = true;
        }
Ejemplo n.º 12
0
        // These functions are invoked when the user manipulate the media player
        /// <summary>
        /// Plays the performance
        /// </summary>
        public void Play()
        {
            played = true;

            if (ReplayView.Get().Avatar.IsEnabled&& skeletonScrolling != null)
            {
                skeletonScrolling.Start();
            }

            if (DrawingSheetView.Get().ReplayVideo.Source != null)
            {
                DrawingSheetView.Get().ReplayVideo.Play();
            }
            if (DrawingSheetView.Get().ReplayAudio.Source != null)
            {
                DrawingSheetView.Get().ReplayAudio.Play();
            }
            ReplayView.Get().PauseButton.IsEnabled = true;
        }
Ejemplo n.º 13
0
 /// <summary>
 /// Displays the video view
 /// </summary>
 public void videoStreamDisplay()
 {
     if (filePathVideoStream != null)
     {
         TimeSpan tempV = DrawingSheetView.Get().ReplayVideo.Position;
         TimeSpan tempA = DrawingSheetView.Get().ReplayAudio.Position;
         DrawingSheetView.Get().ReplayVideo.Source = new Uri(filePathVideoStream, UriKind.Relative);
         if (skeletonScrolling == null)
         {
             DrawingSheetView.Get().ReplayVideo.Position = tempV;
             DrawingSheetView.Get().ReplayAudio.Position = tempA;
         }
         else
         {
             DrawingSheetView.Get().ReplayVideo.Position = new TimeSpan(0, 0, 0, 0, (int)Tools.getStopWatch() - ReplayAvatar.offset);
             DrawingSheetView.Get().ReplayAudio.Position = new TimeSpan(0, 0, 0, 0, (int)Tools.getStopWatch() - ReplayAvatar.offset);
         }
         filePath = filePathVideoStream;
         DrawingSheetView.Get().ShowReplayVideoSheet();
         PlayOrStop();
     }
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Unmutes the performance
 /// </summary>
 public void Unmute()
 {
     mute = false;
     DrawingSheetView.Get().ReplayAudio.IsMuted = false;
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Add the audio replay to the other replay
 /// Added by Baptiste Germond
 /// </summary>
 private void AddAudio(String name)
 {
     DrawingSheetView.Get().ReplayAudio.Source = new Uri(name);
     audioSource = true;
     ReplayView.Get().SoundCheckbox.IsEnabled = true;
 }