private void bnCleanUp_Click(object sender, EventArgs e) { // Disable SynchGate1 output: Omit "Gate" parameter // (Not available prior to ALP-4) AlpImport.DevControlEx_SynchGate(m_DevId, 1, true); // Recommendation: always call DevHalt() before DevFree() AlpImport.Result result = AlpImport.DevFree(m_DevId); txResult.Text = "DevFree " + AlpErrorString(result); if (AlpImport.Result.ALP_OK != result) { return; // error -> exit } m_DevId = UInt32.MaxValue; }
private void bnInit_Click(object sender, EventArgs e) { AlpImport.Result result; // allocate one ALP device result = AlpImport.DevAlloc(0, 0, ref m_DevId); txResult.Text = "DevAlloc " + AlpErrorString(result); if (AlpImport.Result.ALP_OK != result) { return; // error -> exit } // determine image data size by DMD type Int32 DmdType = Int32.MaxValue; AlpImport.DevInquire(m_DevId, AlpImport.DevTypes.ALP_DEV_DMDTYPE, ref DmdType); switch ((AlpImport.DmdTypes)DmdType) { case AlpImport.DmdTypes.ALP_DMDTYPE_XGA: case AlpImport.DmdTypes.ALP_DMDTYPE_XGA_055A: case AlpImport.DmdTypes.ALP_DMDTYPE_XGA_055X: case AlpImport.DmdTypes.ALP_DMDTYPE_XGA_07A: m_DmdWidth = 1024; m_DmdHeight = 768; break; case AlpImport.DmdTypes.ALP_DMDTYPE_1080P_095A: case AlpImport.DmdTypes.ALP_DMDTYPE_DISCONNECT: m_DmdWidth = 1920; m_DmdHeight = 1080; break; case AlpImport.DmdTypes.ALP_DMDTYPE_SXGA_PLUS: m_DmdWidth = 1400; m_DmdHeight = 1050; break; default: txResult.Text = String.Format("Unknown DMD Type {0}", DmdType); // Clean up... AlpImport.DevHalt(m_DevId); m_DevId = UInt32.MaxValue; return; } // Allocate 2 sequences of 1 image, each result = AlpImport.SeqAlloc(m_DevId, 1, 1, ref m_SeqId1); txResult.Text = "SeqAlloc1 " + AlpErrorString(result); if (AlpImport.Result.ALP_OK != result) { return; // error -> exit } result = AlpImport.SeqAlloc(m_DevId, 1, 1, ref m_SeqId2); txResult.Text = "SeqAlloc2 " + AlpErrorString(result); if (AlpImport.Result.ALP_OK != result) { return; // error -> exit } // Example: pulse Synch Output 1 each first of three frames. // (Not available prior to ALP-4) result = AlpImport.DevControlEx_SynchGate(m_DevId, 1, true, 1, 0, 0); txResult.Text = "SynchGate1 " + AlpErrorString(result); if (AlpImport.Result.ALP_OK != result) { return; // error -> exit } }
private void BnInitDMD_Click(object sender, EventArgs e) { AlpImport.Result result; // allocate one ALP device result = AlpImport.DevAlloc(0, 0, ref m_DevId); txResult.Text = "DevAlloc " + AlpErrorString(result); if (AlpImport.Result.ALP_OK != result) { return; // error -> exit } // determine image data size by DMD type Int32 DmdType = Int32.MaxValue; m_DmdWidth = 0; m_DmdHeight = 0; AlpImport.DevInquire(m_DevId, AlpImport.DevTypes.ALP_DEV_DMDTYPE, ref DmdType); AlpImport.DevInquire(m_DevId, AlpImport.DevTypes.ALP_DEV_DISPLAY_WIDTH, ref m_DmdWidth); AlpImport.DevInquire(m_DevId, AlpImport.DevTypes.ALP_DEV_DISPLAY_HEIGHT, ref m_DmdHeight); switch ((AlpImport.DmdTypes)DmdType) { case AlpImport.DmdTypes.ALP_DMDTYPE_XGA: case AlpImport.DmdTypes.ALP_DMDTYPE_XGA_055A: case AlpImport.DmdTypes.ALP_DMDTYPE_XGA_055X: case AlpImport.DmdTypes.ALP_DMDTYPE_XGA_07A: txResult.Text = String.Format("XGA DMD {0}", DmdType); m_DmdWidth = 1024; // fall-back: old API versions did not support ALP_DEV_DISPLAY_WIDTH and _HEIGHT m_DmdHeight = 768; break; case AlpImport.DmdTypes.ALP_DMDTYPE_1080P_095A: case AlpImport.DmdTypes.ALP_DMDTYPE_DISCONNECT: txResult.Text = String.Format("1080p DMD {0}", DmdType); break; case AlpImport.DmdTypes.ALP_DMDTYPE_WUXGA_096A: txResult.Text = String.Format("WUXGA DMD {0}", DmdType); break; case AlpImport.DmdTypes.ALP_DMDTYPE_SXGA_PLUS: txResult.Text = String.Format("SXGA+ DMD {0}", DmdType); m_DmdWidth = 1400; m_DmdHeight = 1050; break; default: txResult.Text = String.Format("Unknown DMD Type {0}: {1}x{2}", DmdType, m_DmdWidth, m_DmdHeight); if (m_DmdHeight == 0 || m_DmdWidth == 0) { // Clean up... AlpImport.DevHalt(m_DevId); m_DevId = UInt32.MaxValue; return; } else { // Continue, because at least the API DLL knows this DMD type :-) break; } } // Allocate 2 sequences of 1 image, each result = AlpImport.SeqAlloc(m_DevId, 1, 1, ref m_SeqId1); txResult.Text = "SeqAlloc1 " + AlpErrorString(result); if (AlpImport.Result.ALP_OK != result) { return; // error -> exit } result = AlpImport.SeqAlloc(m_DevId, 1, 1, ref m_SeqId2); txResult.Text = "SeqAlloc2 " + AlpErrorString(result); if (AlpImport.Result.ALP_OK != result) { return; // error -> exit } // Example: pulse Synch Output 1 each first of three frames. // (Not available prior to ALP-4) result = AlpImport.DevControlEx_SynchGate(m_DevId, 1, true, 1, 0, 0); txResult.Text = "SynchGate1 " + AlpErrorString(result); if (AlpImport.Result.ALP_OK != result) { return; // error -> exit } }