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; } }
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; } } }
public void Dispose() { Stop(); framesReplay = null; if (reader != null) { reader.Dispose(); reader = null; } if (stream != null) { stream.Dispose(); stream = null; } }
public void Dispose() { Stop(); framesReplay = null; if (reader != null) { reader.Dispose(); reader = null; } if (stream != null) { stream.Dispose(); stream = null; } }