//////////////////////////////////////////////////////////////////////////// #region CONSTRUCTOR / DESTRUCTOR //////////////////////////////////////////////////////////////////////////// /// <summary> /// <para> /// Creates a new instance of a <c>KinectRecorder</c> which can save frames to /// the referenced stream. /// </para> /// <para> /// The KinectRecorder can operate in two distinct modes. The "Automatic" mode /// requires only that you pass a valid <c>KinectSensor</c> object to this /// constructor. Recording of frames for each enabled frame type happens automatically /// between the time Start() and StopAsync() are called. /// </para> /// <para> /// In certain situations, the developer may wish to have more precise control /// over when and how frames are recorded. If no <c>KinectSensor</c> is passed in /// to this constructor, Start() and StopAsync() must still be called to begin and /// end the recording session. However, the KinectRecorder will be in "Manual" mode, /// and frames are recorded only when passed in to the RecordFrame() method. /// </para> /// </summary> /// <param name="stream"> /// The stream to which frames will be stored. /// </param> /// <param name="sensor"> /// If supplied, the <c>KinectSensor</c> from which frames will be automatically /// retrieved for recording. /// </param> public KinectRecorder(Stream stream, KinectSensor sensor = null) { _writer = new BinaryWriter(stream); _sensor = sensor; _bodyRecorder = new BodyRecorder(_writer); _colorRecorder = new ColorRecorder(_writer); _depthRecorder = new DepthRecorder(_writer); _infraredRecorder = new InfraredRecorder(_writer); }