コード例 #1
0
ファイル: Capture.cs プロジェクト: kevinbs/VVVV.Packs.Image
		public void Open(DeviceRegister.DeviceIndex device, _BMDDisplayMode mode, _BMDVideoInputFlags flags)
		{
			if (Ready)
				Close();

			WorkerThread.Singleton.PerformBlocking(() =>
			{
				this.Lock.AcquireWriterLock(10000);
				try
				{
					if (device == null)
						throw (new Exception("No device selected"));

					IDeckLink rawDevice = DeviceRegister.Singleton.GetDeviceHandle(device.Index);
					FDevice = rawDevice as IDeckLinkInput;
					FOutDevice = rawDevice as IDeckLinkOutput;
					FMode = mode;
					FFlags = flags;
					FConverter = new CDeckLinkVideoConversion();

					if (FDevice == null)
						throw (new Exception("No input device connected"));

					_BMDDisplayModeSupport displayModeSupported;

					FDevice.DoesSupportVideoMode(FMode, FPixelFormat, flags, out displayModeSupported, out FDisplayMode);

					Width = FDisplayMode.GetWidth();
					Height = FDisplayMode.GetHeight();

					// inspiration http://dviz.googlecode.com/svn/trunk/src/livemix/CameraThread.cpp

					FOutDevice.CreateVideoFrame(Width,
												Height,
												Width * 4,
												_BMDPixelFormat.bmdFormat8BitBGRA,
												_BMDFrameFlags.bmdFrameFlagDefault,
												out rgbFrame);

					FDevice.EnableVideoInput(FMode, FPixelFormat, FFlags);
					FDevice.SetCallback(this);
					FDevice.StartStreams();

					Reinitialise = true;
					Ready = true;
					FreshData = false;
				}
				catch (Exception e)
				{
					Ready = false;
					Reinitialise = false;
					FreshData = false;
					throw;
				}
				finally
				{
					this.Lock.ReleaseWriterLock();
				}
			});
		}
コード例 #2
0
ファイル: DLDirect.cs プロジェクト: buzallen/RTDeckLinkDotNet
        public DLDirect(IDeckLink deckLink, IDeckLinkDisplayMode displayMode)
        {
            PreRollFrameCount = 4;

            this.displayMode = displayMode;
            this.m_deckLink  = deckLink;

            DisplayWidth  = displayMode.GetWidth();
            DisplayHeight = displayMode.GetHeight();

            m_running = false;

            // Get the IDeckLinkOutput interface
            m_deckLinkOutput = (IDeckLinkOutput)m_deckLink;

            // Provide this class as a delegate to the audio and video output interfaces
            m_deckLinkOutput.SetScheduledFrameCompletionCallback(this);

            m_frameWidth  = displayMode.GetWidth();
            m_frameHeight = displayMode.GetHeight();

            displayMode.GetFrameRate(out m_frameDuration, out m_frameTimescale);

            // Calculate the number of frames per second, rounded up to the nearest integer.  For example, for NTSC (29.97 FPS), framesPerSecond == 30.
            m_framesPerSecond = (uint)((m_frameTimescale + (m_frameDuration - 1)) / m_frameDuration);
            FPS = (int)m_framesPerSecond;

            // Set the video output mode
            m_deckLinkOutput.EnableVideoOutput(displayMode.GetDisplayMode(), _BMDVideoOutputFlags.bmdVideoOutputFlagDefault);

            // Generate the frame used for playback
            m_deckLinkOutput.CreateVideoFrame(m_frameWidth, m_frameHeight, m_frameWidth * 4, _BMDPixelFormat.bmdFormat8BitBGRA, _BMDFrameFlags.bmdFrameFlagDefault, out m_videoFramePlayback);
            m_totalFramesScheduled = 0;
        }
コード例 #3
0
        public static List <DisplayModeItem> GetDisplayModeItems(IDeckLink m_deckLink)
        {
            List <DisplayModeItem> outList = new List <DisplayModeItem>();

            IDeckLinkOutput m_deckLinkOutput = (IDeckLinkOutput)m_deckLink;

            IDeckLinkDisplayModeIterator displayModeIterator;

            m_deckLinkOutput.GetDisplayModeIterator(out displayModeIterator);

            while (true)
            {
                IDeckLinkDisplayMode deckLinkDisplayMode;

                displayModeIterator.Next(out deckLinkDisplayMode);
                if (deckLinkDisplayMode == null)
                {
                    break;
                }

                outList.Add(new DisplayModeItem(deckLinkDisplayMode));
            }

            return(outList);
        }
コード例 #4
0
ファイル: DecklinkWindow.cs プロジェクト: hhool/decklink-test
        private void InitDecklink(int CardIndex)
        {
            int width, height;
            IDeckLinkDisplayMode displayMode;

            //Set the card display Mode
            displayMode = _devices[0].GetDisplayMode(VideoMode);

            //Get the timing information
            displayMode.GetFrameRate(out _frameDuration, out _frameTimescale);
            _fps = ((_frameTimescale + (_frameDuration - 1)) / _frameDuration);

            //Get the output interface from the device Index
            _deckLinkOutput = _devices[CardIndex].DeckLinkOutput;

            width  = displayMode.GetWidth();
            height = displayMode.GetHeight();

            //Set up a pointer to a video frame
            //with the hight and width
            _deckLinkOutput.CreateVideoFrame(width, height, (width * 4),
                                             _BMDPixelFormat.bmdFormat8BitBGRA,
                                             _BMDFrameFlags.bmdFrameFlagFlipVertical,
                                             out _videoFrame);

            //Tell the card to enable output
            _deckLinkOutput.EnableVideoOutput(displayMode.GetDisplayMode(),
                                              _BMDVideoOutputFlags.bmdVideoOutputFlagDefault);

            Console.WriteLine("Using Card index:" + CardIndex);
        }
コード例 #5
0
        public DeckLinkOutputDevice(IDeckLink deckLink) : base(deckLink)
        {
            if (!PlaybackDevice)
            {
                throw new DeckLinkOutputInvalidException();
            }

            // Query output interface
            m_deckLinkOutput = (IDeckLinkOutput)deckLink;

            // Provide the delegate to the audio and video output interfaces
            m_deckLinkOutput.SetScheduledFrameCompletionCallback(this);
            m_deckLinkOutput.SetAudioCallback(this);
        }
コード例 #6
0
        public DeckLinkRenderer(IDeckLinkOutput newDeckLinkOutput, IDeckLinkDisplayMode newDisplayMode)
        {
            running        = false;
            deckLinkOutput = newDeckLinkOutput;
            displayMode    = newDisplayMode;

            frameWidth  = displayMode.GetWidth();
            frameHeight = displayMode.GetHeight();

            displayMode.GetFrameRate(out frameDuration, out frameTimescale);
            framesPerSecond = (uint)((frameTimescale + (frameDuration - 1)) / frameDuration);

            deckLinkOutput.SetScreenPreviewCallback(this);
            deckLinkOutput.SetScheduledFrameCompletionCallback(this);
            deckLinkOutput.SetAudioCallback(this);
        }
コード例 #7
0
 // Get IDeckLink Interface
 private bool GetIDeckLinkInterface()
 {
     try
     {
         deckLinkOutput = (IDeckLinkOutput)DeckLink;
         deckLinkInput  = (IDeckLinkInput)DeckLink;
         deckLinkConfig = (IDeckLinkConfiguration)DeckLink;
         IDeckLinkDisplayModeIterator displayIterator;
         deckLinkInput.GetDisplayModeIterator(out displayIterator);
         var supportedModes = new List <IDeckLinkDisplayMode>();
         deckLinkKeyer = (IDeckLinkKeyer)DeckLink;
     }
     catch
     {
         return(false);
     }
     return(true);
 }
コード例 #8
0
ファイル: Form1.cs プロジェクト: msschwartz/ScreenToDecklink
        public Form1()
        {
            InitializeComponent();

            captureVideo();

            Decklink             decklink = new Decklink();
            IDeckLinkOutput      device   = (IDeckLinkOutput)decklink.GetAvailableDeckLinks()[0];
            IDeckLinkDisplayMode mode     = (IDeckLinkDisplayMode)decklink.GetAvailableDisplayModes(device)[0];

            DeckLinkRenderer renderer = new DeckLinkRenderer(device, mode);

            renderer.Start();

            Thread.Sleep(3000);

            renderer.Stop();
        }
コード例 #9
0
        public DeckLinkOutputDevice(IDeckLink deckLink)
        {
            m_deckLink = deckLink;

            // Get output interface
            try
            {
                m_deckLinkOutput = (IDeckLinkOutput)m_deckLink;
            }
            catch (InvalidCastException)
            {
                // No output interface found, eg in case of DeckLink Mini Recorder
                return;
            }

            // Provide the delegate to the audio and video output interfaces
            m_deckLinkOutput.SetScheduledFrameCompletionCallback(this);
            m_deckLinkOutput.SetAudioCallback(this);
        }
コード例 #10
0
        public ArrayList GetAvailableDisplayModes(IDeckLinkOutput deckLinkOutput)
        {
            ArrayList list = new ArrayList();

            IDeckLinkDisplayModeIterator displayModeIterator;

            deckLinkOutput.GetDisplayModeIterator(out displayModeIterator);
            while (true)
            {
                IDeckLinkDisplayMode deckLinkDisplayMode;

                displayModeIterator.Next(out deckLinkDisplayMode);
                if (deckLinkDisplayMode == null)
                {
                    break;
                }

                list.Add(deckLinkDisplayMode);
            }

            return(list);
        }
コード例 #11
0
        public SignalGenerator()
        {
            InitializeComponent();

            m_running = false;

            // Create the COM instance
            IDeckLinkIterator deckLinkIterator = new CDeckLinkIterator();

            if (deckLinkIterator == null)
            {
                MessageBox.Show("This application requires the DeckLink drivers installed.\nPlease install the Blackmagic DeckLink drivers to use the features of this application", "Error");
                Environment.Exit(1);
            }

            // Get the first DeckLink card
            deckLinkIterator.Next(out m_deckLink);
            if (m_deckLink == null)
            {
                MessageBox.Show("This application requires a DeckLink PCI card.\nYou will not be able to use the features of this application until a DeckLink PCI card is installed.", "Error");
                Environment.Exit(1);
            }

            // Get the IDeckLinkOutput interface
            m_deckLinkOutput = (IDeckLinkOutput)m_deckLink;

            // Provide this class as a delegate to the audio and video output interfaces
            m_deckLinkOutput.SetScheduledFrameCompletionCallback(this);
            m_deckLinkOutput.SetAudioCallback(this);

            // Populate the display mode combo with a list of display modes supported by the installed DeckLink card
            IDeckLinkDisplayModeIterator displayModeIterator;

            comboBoxVideoFormat.BeginUpdate();
            comboBoxVideoFormat.Items.Clear();

            m_deckLinkOutput.GetDisplayModeIterator(out displayModeIterator);

            while (true)
            {
                IDeckLinkDisplayMode deckLinkDisplayMode;

                displayModeIterator.Next(out deckLinkDisplayMode);
                if (deckLinkDisplayMode == null)
                {
                    break;
                }

                comboBoxVideoFormat.Items.Add(new DisplayModeEntry(deckLinkDisplayMode));
            }

            comboBoxVideoFormat.EndUpdate();

            // Output signal combo box
            comboBoxOutputSignal.BeginUpdate();
            comboBoxOutputSignal.Items.Clear();
            comboBoxOutputSignal.Items.Add(new StringObjectPair <OutputSignal>("Pip", OutputSignal.kOutputSignalPip));
            comboBoxOutputSignal.Items.Add(new StringObjectPair <OutputSignal>("Drop", OutputSignal.kOutputSignalDrop));
            comboBoxOutputSignal.EndUpdate();

            // Audio channels combo box
            comboBoxAudioChannels.BeginUpdate();
            comboBoxAudioChannels.Items.Clear();
            comboBoxAudioChannels.Items.Add("2");
            comboBoxAudioChannels.Items.Add("8");
            comboBoxAudioChannels.Items.Add("16");
            comboBoxAudioChannels.EndUpdate();

            // Audio depth combo box
            comboBoxAudioDepth.BeginUpdate();
            comboBoxAudioDepth.Items.Clear();
            comboBoxAudioDepth.Items.Add(new StringObjectPair <_BMDAudioSampleType>("16 Bit", _BMDAudioSampleType.bmdAudioSampleType16bitInteger));
            comboBoxAudioDepth.Items.Add(new StringObjectPair <_BMDAudioSampleType>("32 Bit", _BMDAudioSampleType.bmdAudioSampleType32bitInteger));
            comboBoxAudioDepth.EndUpdate();

            comboBoxVideoFormat.SelectedIndex   = 0;
            comboBoxOutputSignal.SelectedIndex  = 0;
            comboBoxAudioChannels.SelectedIndex = 0;
            comboBoxAudioDepth.SelectedIndex    = 0;
        }
コード例 #12
0
ファイル: Source.cs プロジェクト: kevinbs/VVVV.Packs.Image
		public void Initialise(IDeckLink device, ModeRegister.Mode mode, bool useDeviceCallbacks)
		{
			Stop();

			try
			{
				WorkerThread.Singleton.PerformBlocking(() => {

					//--
					//attach to device
					//
					if (device == null)
						throw (new Exception("No device"));
					if (mode == null)
						throw (new Exception("No mode selected"));

					FDevice = device;

					var outputDevice = FDevice as IDeckLinkOutput;
					if (outputDevice == null)
						throw (new Exception("Device does not support output"));
					FOutputDevice = outputDevice;
					//
					//--


					//--
					//set memory allocator
					//
					FOutputDevice.SetVideoOutputFrameMemoryAllocator(FMemoryAllocator);
					//
					//--


					//--
					//select mode
					//
					_BMDDisplayModeSupport support;
					IDeckLinkDisplayMode displayMode;
					FOutputDevice.DoesSupportVideoMode(mode.DisplayModeHandle.GetDisplayMode(), mode.PixelFormat, mode.Flags, out support, out displayMode);
					if (support == _BMDDisplayModeSupport.bmdDisplayModeNotSupported)
						throw (new Exception("Mode not supported"));

					this.Mode = mode;
					this.FWidth = Mode.Width;
					this.FHeight = Mode.Height;

					Mode.DisplayModeHandle.GetFrameRate(out this.FFrameDuration, out this.FFrameTimescale);
					//
					//--


					//--
					//enable the output
					//
					FOutputDevice.EnableVideoOutput(Mode.DisplayModeHandle.GetDisplayMode(), Mode.Flags);
					//
					//--


					//--
					//generate frames
					IntPtr data;
					FOutputDevice.CreateVideoFrame(FWidth, FHeight, Mode.CompressedWidth * 4, Mode.PixelFormat, _BMDFrameFlags.bmdFrameFlagDefault, out FVideoFrame);
					FVideoFrame.GetBytes(out data);
					FillBlack(data);
					//
					//--

					//--
					//scheduled playback
					if (useDeviceCallbacks == true)
					{
						FOutputDevice.SetScheduledFrameCompletionCallback(this);
						this.FFrameIndex = 0;
						for (int i = 0; i < (int)this.Framerate; i++)
						{
							ScheduleFrame(true);
						}
						FOutputDevice.StartScheduledPlayback(0, 100, 1.0);
					}
					//
					//--

					FRunning = true;
				});
			}
			catch (Exception e)
			{
				this.FWidth = 0;
				this.FHeight = 0;
				this.FRunning = false;
				throw;
			}
		}
コード例 #13
0
        public void Initialise(IDeckLink device, ModeRegister.Mode mode, bool useDeviceCallbacks)
        {
            Stop();

            try
            {
                WorkerThread.Singleton.PerformBlocking(() => {
                    //--
                    //attach to device
                    //
                    if (device == null)
                    {
                        throw (new Exception("No device"));
                    }
                    if (mode == null)
                    {
                        throw (new Exception("No mode selected"));
                    }

                    FDevice = device;

                    var outputDevice = FDevice as IDeckLinkOutput;
                    if (outputDevice == null)
                    {
                        throw (new Exception("Device does not support output"));
                    }
                    FOutputDevice = outputDevice;
                    //
                    //--


                    //--
                    //set memory allocator
                    //
                    FOutputDevice.SetVideoOutputFrameMemoryAllocator(FMemoryAllocator);
                    //
                    //--


                    //--
                    //select mode
                    //
                    _BMDDisplayModeSupport support;
                    IDeckLinkDisplayMode displayMode;
                    FOutputDevice.DoesSupportVideoMode(mode.DisplayModeHandle.GetDisplayMode(), mode.PixelFormat, mode.Flags, out support, out displayMode);
                    if (support == _BMDDisplayModeSupport.bmdDisplayModeNotSupported)
                    {
                        throw (new Exception("Mode not supported"));
                    }

                    this.Mode    = mode;
                    this.FWidth  = Mode.Width;
                    this.FHeight = Mode.Height;

                    Mode.DisplayModeHandle.GetFrameRate(out this.FFrameDuration, out this.FFrameTimescale);
                    //
                    //--


                    //--
                    //enable the output
                    //
                    FOutputDevice.EnableVideoOutput(Mode.DisplayModeHandle.GetDisplayMode(), Mode.Flags);
                    //
                    //--


                    //--
                    //generate frames
                    IntPtr data;
                    FOutputDevice.CreateVideoFrame(FWidth, FHeight, Mode.CompressedWidth * 4, Mode.PixelFormat, _BMDFrameFlags.bmdFrameFlagDefault, out FVideoFrame);
                    FVideoFrame.GetBytes(out data);
                    FillBlack(data);
                    //
                    //--

                    //--
                    //scheduled playback
                    if (useDeviceCallbacks == true)
                    {
                        FOutputDevice.SetScheduledFrameCompletionCallback(this);
                        this.FFrameIndex = 0;
                        for (int i = 0; i < (int)this.Framerate; i++)
                        {
                            ScheduleFrame(true);
                        }
                        FOutputDevice.StartScheduledPlayback(0, 100, 1.0);
                    }
                    //
                    //--

                    FRunning = true;
                });
            }
            catch (Exception e)
            {
                this.FWidth   = 0;
                this.FHeight  = 0;
                this.FRunning = false;
                throw;
            }
        }
コード例 #14
0
ファイル: Decklink.cs プロジェクト: ratsil/bethe.btl
		private Decklink(IDeckLink cDevice)
		{
			(new Logger()).WriteDebug3("in");
			try
			{
				nAudioQueueLength = nAudioQueueLengthPrevious = 0;
				nBTLAudioQueueLengthPrevious = nBTLVideoQueueLengthPrevious = nVideoQueueLengthPrevious = 0;
				_iDLDevice = cDevice;
				if(Preferences.bDeviceInput)
					_iDLInput = (IDeckLinkInput)_iDLDevice;
				else
					_iDLOutput = (IDeckLinkOutput)_iDLDevice;

				IDeckLinkDisplayModeIterator cDisplayModeIterator;
				IDeckLinkDisplayMode cNextDLDisplayMode;
				string sDisplayModeName = "";

				string sMessage = "decklink supported modes:<br>";
				if (Preferences.bDeviceInput)
				{
					_iDLInputDisplayMode = null;
					_iDLInput.GetDisplayModeIterator(out cDisplayModeIterator);
					while (true)
					{
						cDisplayModeIterator.Next(out cNextDLDisplayMode);
						if (cNextDLDisplayMode == null)
							break;
						cNextDLDisplayMode.GetName(out sDisplayModeName);
						if (null == _iDLInputDisplayMode && sDisplayModeName.ToLower().Contains(Preferences.sVideoFormat))
						{
							sMessage += "selected:";
							_iDLInputDisplayMode = cNextDLDisplayMode;
						}
						else
							sMessage += "\t";
						sMessage += sDisplayModeName + "<br>";
					}
					(new Logger()).WriteNotice(sMessage);
					if (null == _iDLInputDisplayMode)
						throw new Exception("can't find " + Preferences.sVideoFormat + " mode within specified device for input");
				}
				else
				{
					_nFramesAudioDropped = 0;
					_iDLOutputDisplayMode = null;
					_iDLOutput.GetDisplayModeIterator(out cDisplayModeIterator);
					while (true)
					{

						cDisplayModeIterator.Next(out cNextDLDisplayMode);
						if (cNextDLDisplayMode == null)
							break;
						cNextDLDisplayMode.GetName(out sDisplayModeName);
						if (null == _iDLOutputDisplayMode && sDisplayModeName.ToLower().Contains(Preferences.sVideoFormat))
						{
							sMessage += "selected:";
							_iDLOutputDisplayMode = cNextDLDisplayMode;
						}
						else
							sMessage += "\t";
						sMessage += sDisplayModeName + "<br>";
					}
					(new Logger()).WriteNotice(sMessage);
					if (null == _iDLOutputDisplayMode)
						throw new Exception("can't find " + Preferences.sVideoFormat + " mode within specified device for output");
					stArea = new Area(0, 0, (ushort)_iDLOutputDisplayMode.GetWidth(), (ushort)_iDLOutputDisplayMode.GetHeight());

					long nFrameDuration, nFrameTimescale;
					_iDLOutputDisplayMode.GetFrameRate(out nFrameDuration, out nFrameTimescale);
					_nFPS = (ushort)((nFrameTimescale + (nFrameDuration - 1)) / nFrameDuration); //до ближайшего целого - взято из примера деклинка

					_bDoWritingFrames = false;
					_aqWritingFrames = new Queue<byte[]>();
					_cThreadWritingFramesWorker = new System.Threading.Thread(WritingFramesWorker);
					_cThreadWritingFramesWorker.IsBackground = true;
					_cThreadWritingFramesWorker.Priority = System.Threading.ThreadPriority.Normal;
					_cThreadWritingFramesWorker.Start();

					if (Preferences.bAudio)
					{
						switch (Preferences.nAudioBitDepth)
						{
							case 32:
								_eAudioSampleDepth = _BMDAudioSampleType.bmdAudioSampleType32bitInteger;
								break;
							case 16:
							default:
								_eAudioSampleDepth = _BMDAudioSampleType.bmdAudioSampleType16bitInteger;
								break;
						}
						switch (Preferences.nAudioSamplesRate)
						{
							case 48000:
								_eAudioSampleRate = _BMDAudioSampleRate.bmdAudioSampleRate48kHz;
								break;
							default:
								throw new Exception("unsupported audio sample rate [" + Preferences.nAudioSamplesRate + "]");
						}
						//_pAudioSamplesBuffer = Marshal.AllocCoTaskMem((int)_nAudioFrameSize_InBytes);
						_cAudioBuffer = new AudioBuffer();
						_nAudioBufferCapacity_InSamples = Preferences.nAudioSamplesPerFrame * Preferences.nQueueDeviceLength;
						//for (int nIndx = 0; _nAudioFrameSize_InBytes > nIndx; nIndx++)
						//    Marshal.WriteByte(_pAudioSamplesBuffer, nIndx, 0);

						_nTimescale = (ushort)_eAudioSampleRate;
						_nFrameDuration = (ushort)(_nTimescale / _nFPS);
					}
					if (null != Preferences.cDownStreamKeyer)
						_iDeckLinkKeyer = (IDeckLinkKeyer)_iDLDevice;
				}
			}
			catch (Exception ex)
			{
				(new Logger()).WriteError(ex);
				throw;
			}
			(new Logger()).WriteDebug4("return");
		}
コード例 #15
0
        public void Open(DeviceRegister.DeviceIndex device, _BMDDisplayMode mode, _BMDVideoInputFlags flags)
        {
            if (Ready)
            {
                Close();
            }

            WorkerThread.Singleton.PerformBlocking(() =>
            {
                this.Lock.AcquireWriterLock(10000);
                try
                {
                    if (device == null)
                    {
                        throw (new Exception("No device selected"));
                    }

                    IDeckLink rawDevice = DeviceRegister.Singleton.GetDeviceHandle(device.Index);
                    FDevice             = rawDevice as IDeckLinkInput;
                    FOutDevice          = rawDevice as IDeckLinkOutput;
                    FMode      = mode;
                    FFlags     = flags;
                    FConverter = new CDeckLinkVideoConversion();

                    if (FDevice == null)
                    {
                        throw (new Exception("No input device connected"));
                    }

                    _BMDDisplayModeSupport displayModeSupported;

                    FDevice.DoesSupportVideoMode(FMode, FPixelFormat, flags, out displayModeSupported, out FDisplayMode);

                    Width  = FDisplayMode.GetWidth();
                    Height = FDisplayMode.GetHeight();

                    // inspiration http://dviz.googlecode.com/svn/trunk/src/livemix/CameraThread.cpp

                    FOutDevice.CreateVideoFrame(Width,
                                                Height,
                                                Width * 4,
                                                _BMDPixelFormat.bmdFormat8BitBGRA,
                                                _BMDFrameFlags.bmdFrameFlagDefault,
                                                out rgbFrame);

                    FDevice.EnableVideoInput(FMode, FPixelFormat, FFlags);
                    FDevice.SetCallback(this);
                    FDevice.StartStreams();

                    Reinitialise = true;
                    Ready        = true;
                    FreshData    = false;
                }
                catch (Exception e)
                {
                    Ready        = false;
                    Reinitialise = false;
                    FreshData    = false;
                    throw;
                }
                finally
                {
                    this.Lock.ReleaseWriterLock();
                }
            });
        }