public void stopRecording() { DeviceInteractionHost dr = Session.dataRecorder; Test currentTest = Session.currentTest; Recording currentRecording = Session.currentRecording; dr.stopRecording(); WebcamViewer.StopRecording(); endts = _mainWindow.stopwatch.ElapsedMilliseconds; Session.currentRecording.fixations = dr.getCleanFixations(); Session.currentRecording.saccades = dr.getSaccades(Session.currentRecording.fixations); Session.currentRecording.videoQpcStartTime = startts; Session.currentRecording.videoQpcEndTime = endts; String fixationpath = dr.getCleanFixationPath(); //write fixations foreach (Fixation f in Session.currentRecording.fixations) { dr.writeCleanFixationsToFile(fixationpath, f); } ////set highest test if (currentTest.index > user.highestTestIndex) { user.highestTestIndex = currentTest.index; } string[] video = Directory.GetFiles(WebcamViewer.VideoDirectory, "*.wmv"); String dirdata = System.IO.Path.GetFileName(currentRecording.dataDir); File.Move(video[0], currentRecording.dataDir + "//" + dirdata + "_U" + ustartts + "_VIDEO_" + "_Q" + startts + "_Q" + endts + ".wmv"); }
//load selected test private void StartTest_Click(object sender, RoutedEventArgs e) { String medium; if ((medium = stimuliMedium.SelectedItem.ToString()) != "Select medium") { Test test = (Test)testList.SelectedItem; Session.dataRecorder = new DeviceInteractionHost(); DeviceInteractionHost dataRecorder = Session.dataRecorder; dataRecorder.initLSLProviders(); dataRecorder.feedStreamsToLSL(); dataRecorder.RegisterLSLDevice(new LSLDevice("EEG", true)); dataRecorder.RegisterLSLDevice(new LSLDevice("Gaze", false)); dataRecorder.RegisterLSLDevice(new LSLDevice("Quality", false)); //DEBUG //dataRecorder.feedDebugData(); //dataRecorder.feedDebug2Data(); //dataRecorder.RegisterLSLDevice(new LSLDevice("Debug", false)); //dataRecorder.RegisterLSLDevice(new LSLDevice("Debug2", false)); //DEBUG dataRecorder.resolveStreams(); dataRecorder.createThreads(); test.setMedium(medium); Session.currentTest = test; Console.WriteLine("Test Loaded!"); testLoaded(); } }
public static void newSession(User u) { endSession(); currentUser = u; currentTest = null; currentRecording = null; dataRecorder = null; testList = new List <Test>(); }