Example #1
0
		public KinectReplay(string fileName)
		{
            Started = false;
			stream = File.OpenRead(fileName);
			reader = new BinaryReader(stream);

			synchronizationContext = SynchronizationContext.Current;

			Options = (KinectRecordOptions)reader.ReadInt32();
            //var paramsArrayLength = reader.ReadInt32();
            //var colorToDepthRelationalParameters = reader.ReadBytes(paramsArrayLength);
            //CoordinateMapper = new CoordinateMapper(colorToDepthRelationalParameters);

			if ((Options & KinectRecordOptions.Frames) != 0)
			{
				framesReplay = new ReplayAllFramesSystem();
				framesReplay.AddFrames(reader);
				framesReplay.ReplayFinished += () => synchronizationContext.Send(state => ReplayFinished.Raise(),null);
			}
			if ((Options & KinectRecordOptions.Audio) != 0)
			{
				var audioFilePath = Path.ChangeExtension(fileName, ".wav");
				if (File.Exists(audioFilePath))
					AudioFilePath = audioFilePath;
			}
            
		}
Example #2
0
        public KinectReplay(string fileName)
        {
            stream = File.OpenRead(fileName);
            reader = new BinaryReader(stream);

            synchronizationContext = SynchronizationContext.Current;

            Options = (KinectRecordOptions)reader.ReadInt32();
            var paramsArrayLength = reader.ReadInt32();
            var colorToDepthRelationalParameters = reader.ReadBytes(paramsArrayLength);

            CoordinateMapper = new CoordinateMapper(colorToDepthRelationalParameters);

            if ((Options & KinectRecordOptions.Frames) != 0)
            {
                framesReplay = new ReplayAllFramesSystem();
                framesReplay.AddFrames(reader);
                framesReplay.ReplayFinished += () => synchronizationContext.Send(state => ReplayFinished.Raise(), null);
            }
            if ((Options & KinectRecordOptions.Audio) != 0)
            {
                var audioFilePath = Path.ChangeExtension(fileName, ".wav");
                if (File.Exists(audioFilePath))
                {
                    AudioFilePath = audioFilePath;
                }
            }
        }
Example #3
0
        public void Dispose()
        {
            Stop();

            framesReplay = null;

            if (reader != null)
            {
                reader.Dispose();
                reader = null;
            }

            if (stream != null)
            {
                stream.Dispose();
                stream = null;
            }
        }
Example #4
0
		public void Dispose()
		{
			Stop();

			framesReplay = null;

			if (reader != null)
			{
				reader.Dispose();
				reader = null;
			}

			if (stream != null)
			{
				stream.Dispose();
				stream = null;
			}
		}