/// <summary> /// Setup a controller with the recognizer and a data container instance. /// /// Creates the pipelines for physical and interpreted gestures. /// </summary> /// <param name="recognizer">the recognizer</param> public TrameGestureController(IRecognizer recognizer) { // tasks var smoothingTask = new SmoothingTask(); var recognitionTask = new RecognitionTask(recognizer); var physicsCalculationTask = new PhysicCalculationTask(); // buffers _skeletonBuffer = new BlockingCollection<ISkeleton>(); _skeletonBuffer2 = new BlockingCollection<ISkeleton>(); var secondBuffer = new BlockingCollection<ISkeleton>(1000); var f = new TaskFactory(TaskCreationOptions.LongRunning, TaskContinuationOptions.None); // interpreted var smoothing = f.StartNew(() => smoothingTask.Do(_skeletonBuffer, secondBuffer)); var recognition = f.StartNew(() => recognitionTask.Do(secondBuffer, FireNewMotions)); // physics var physics = f.StartNew(() => physicsCalculationTask.Do(_skeletonBuffer2, FireNewCommand)); _thread = new Thread(() => { System.Threading.Tasks.Task.WaitAll(smoothing, physics, recognition); }); _thread.Start(); }
public void TestInitialisation() { var task = new RecognitionTask(new ThreeDGestureRecognizer()); Assert.IsTrue(task.Recognizer.GetType().IsInstanceOfType(new ThreeDGestureRecognizer())); }