本文整理汇总了C++中InitDevice函数的典型用法代码示例。如果您正苦于以下问题:C++ InitDevice函数的具体用法?C++ InitDevice怎么用?C++ InitDevice使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了InitDevice函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wWinMain
//--------------------------------------------------------------------------------------
// Entry point to the program. Initializes everything and goes into a message processing
// loop. Idle time is used to render the scene.
//--------------------------------------------------------------------------------------
int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow )
{
UNREFERENCED_PARAMETER( hPrevInstance );
UNREFERENCED_PARAMETER( lpCmdLine );
if( FAILED( InitWindow( hInstance, nCmdShow ) ) )
return 0;
if( FAILED( InitDevice() ) )
{
CleanupDevice();
return 0;
}
// Main message loop
MSG msg = {0};
while( WM_QUIT != msg.message )
{
if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
else
{
Render();
}
}
CleanupDevice();
return ( int )msg.wParam;
}
示例2: InitDevice
DirectX9Renderer::DirectX9Renderer(HWND a_hWindow, D3DPRESENT_PARAMETERS d3dpp)
{
m_pD3D = NULL;
m_pd3dDevice = NULL;
m_hWindow = a_hWindow;
InitDevice(d3dpp);
}
示例3: curZStencilBuffer
gs_device::gs_device(gs_init_data *data)
: curRenderTarget (NULL),
curZStencilBuffer (NULL),
curRenderSide (0),
curIndexBuffer (NULL),
curVertexBuffer (NULL),
curVertexShader (NULL),
curPixelShader (NULL),
curSwapChain (&defaultSwap),
zstencilStateChanged (true),
rasterStateChanged (true),
blendStateChanged (true),
curDepthStencilState (NULL),
curRasterState (NULL),
curBlendState (NULL),
curToplogy (D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED)
{
ComPtr<IDXGIAdapter1> adapter;
matrix4_identity(&curProjMatrix);
matrix4_identity(&curViewMatrix);
matrix4_identity(&curViewProjMatrix);
memset(&viewport, 0, sizeof(viewport));
for (size_t i = 0; i < GS_MAX_TEXTURES; i++) {
curTextures[i] = NULL;
curSamplers[i] = NULL;
}
InitFactory(data->adapter, adapter.Assign());
InitDevice(data, adapter);
device_set_render_target(this, NULL, NULL);
}
示例4: KE_PROCESS_ERROR
HRESULT DxWidget::Init(TestQt* mainWin)
{
HRESULT hrResult = E_FAIL;
HRESULT hrRetCode = E_FAIL;
m_pd3dDevice = NULL;
m_pSwapChain = NULL;
m_pRenderTargetView = NULL;
m_pTechnique = NULL;
m_pVertexLayout = NULL;
m_pVertexBuffer = NULL;
m_pEffect = NULL;
m_pMainWin = mainWin;
KE_PROCESS_ERROR(m_pMainWin);
hrRetCode = InitDevice();
KE_COM_PROCESS_ERROR(hrRetCode);
QTimer *timer = new QTimer(this);
KE_PROCESS_ERROR(timer);
connect(timer, SIGNAL(timeout()), this, SLOT(update()));
timer->start(20);
hrResult = S_OK;
Exit0:
return hrResult;
}
示例5: OutputDebugString
int MUCamSource::OnDevice( MM::PropertyBase* pProp, MM::ActionType eAct )
{
#ifdef _LOG_OUT_
OutputDebugString("OnDevice");
#endif
if (eAct == MM::AfterSet)
{
string strName;
pProp->Get(strName);
vector<string>::const_iterator begin = DevicesVec_.begin();
vector<string>::const_iterator end = DevicesVec_.end();
vector<string>::const_iterator it = find(begin, end, strName);
vector<string>::difference_type idx = distance(begin, it);
if (it != end && idx != currentCam_)
{
StopSequenceAcquisition();
if (!OpenCamera(hCameras_[idx])) return DEVICE_ERR;
currentCam_ = idx;// MIDP_GetCurCameraIndex();
InitDevice();
}
}
else if (eAct == MM::BeforeGet)
{
if(currentCam_ >= 0 && currentCam_ < cameraCnt_)
{
string strName = DevicesVec_[currentCam_];
pProp->Set(strName.c_str());
}
}
return DEVICE_OK;
}
示例6: size_bytes
PleoraVideo::PleoraVideo(Params& p): size_bytes(0), lPvSystem(0), lDevice(0), lStream(0), lDeviceParams(0), lStart(0), lStop(0),
lTemperatureCelcius(0), getTemp(false), lStreamParams(0), validGrabbedBuffers(0)
{
std::string sn;
std::string mn;
int index = 0;
size_t buffer_count = PleoraVideo::DEFAULT_BUFFER_COUNT;
Params device_params;
for(Params::ParamMap::iterator it = p.params.begin(); it != p.params.end(); it++) {
if(it->first == "model"){
mn = it->second;
} else if(it->first == "sn"){
sn = it->second;
} else if(it->first == "idx"){
index = p.Get<int>("idx", 0);
} else if(it->first == "buffers"){
buffer_count = p.Get<size_t>("buffers", PleoraVideo::DEFAULT_BUFFER_COUNT);
} else {
device_params.Set(it->first, it->second);
}
}
InitDevice(mn.empty() ? 0 : mn.c_str(), sn.empty() ? 0 : sn.c_str(), index);
SetDeviceParams(device_params);
InitStream();
InitPangoStreams();
InitBuffers(buffer_count);
Start();
}
示例7: FindMoticCameras
/**
* Intializes the hardware.
* Typically we access and initialize hardware at this point.
* Device properties are typically created here as well.
* Required by the MM::Device API.
*/
int MUCamSource::Initialize()
{
if (!LoadFunctions())
return DEVICE_ERR;
if (initialized_)
return DEVICE_OK;
// set property list
// -----------------
FindMoticCameras();
if(cameraCnt_ == 0)
{
return ERR_NO_CAMERAS_FOUND;
}
currentCam_ = 0;//MIDP_GetCurCameraIndex();
int ret;
CPropertyAction* pAct;
if (!OpenCamera(hCameras_[currentCam_])) return DEVICE_ERR;
char sName[Camera_Name_Len];
GetMotiCamNAME(hCameras_[currentCam_], sName);
//memcpy(sName, GetMotiCamNAME(hCameras_[currentCam_]), Camera_Name_Len);
pAct = new CPropertyAction(this, &MUCamSource::OnDevice);
ret = CreateProperty(g_Keyword_Cameras, sName, MM::String, true, pAct);
ret = SetAllowedValues(g_Keyword_Cameras, DevicesVec_);
assert(ret == DEVICE_OK);
ret = InitDevice();
if(ret == DEVICE_OK)
{
initialized_ = true;
}
return ret;
}
示例8: LOG_ERROR
//----------------------------------------------------------------------------
bool MediaFoundationVideoDevice::SetupDevice(unsigned int streamIndex, unsigned int formatIndex)
{
if(this->IsSetup)
{
LOG_ERROR("MediaFoundationVideoDevice::SetupDevice failed: device " << this->DeviceIndex << " is already set up");
return false;
}
HRESULT hr = InitDevice();
if(FAILED(hr))
{
LOG_ERROR("MediaFoundationVideoDevice::SetupDevice failed: device " << this->DeviceIndex << " interface IMFMediaSource cannot be retrieved");
return false;
}
this->Width = this->CurrentFormats[streamIndex][formatIndex].width;
this->Height = this->CurrentFormats[streamIndex][formatIndex].height;
this->FrameRate = this->CurrentFormats[streamIndex][formatIndex].MF_MT_FRAME_RATE;
hr = SetDeviceFormat(this->Source, (DWORD)streamIndex, (DWORD) formatIndex);
this->IsSetup = (SUCCEEDED(hr));
if(this->IsSetup)
{
LOG_DEBUG("MediaFoundationVideoDevice::SetupDevice: device " << this->DeviceIndex << " device is setup");
}
this->PreviousParameters = GetParameters();
this->ActiveType = formatIndex;
return this->IsSetup;
}
示例9: sizeof
bool DX11::CreateWindow()
{
static LPCWSTR AMJU_WINDOW_CLASS_NAME = L"MY_WINDOWS_CLASS";
// Register class
WNDCLASSEX wcex;
wcex.cbSize = sizeof( WNDCLASSEX );
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = MyDefaultWndProc; // TODO you should supply your own
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = g_hInst;
wcex.hIcon = 0;
wcex.hCursor = LoadCursor( NULL, IDC_ARROW );
wcex.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = AMJU_WINDOW_CLASS_NAME;
wcex.hIconSm = 0;
if( !RegisterClassEx( &wcex ) )
return false;
HWND hWnd = CreateWindowEx(
NULL,
AMJU_WINDOW_CLASS_NAME,
L"DX Boiler", // TODO you should supply a window title
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
100,
100,
640, // TODO you should supply width
480, // ..and height
NULL,
NULL,
g_hInst,
NULL);
if (!hWnd)
{
return false;
}
ShowWindow(hWnd, SW_SHOW);
UpdateWindow(hWnd);
g_hWnd = hWnd;
if (!m_input.Init(&g_hWnd))
{
return false;
}
if (InitDevice() != S_OK)
{
return false;
}
return true;
}
示例10: InitDevice
void CComponentInputKeyboard::Init(CInputDevice* pcDevice, CComponentInput* pcComponentInput)
{
CInputVirtualDevice* pcVirtual;
pcVirtual = pcDevice->CreateDefaultVirtualDeviceFromThis("Text Editor Input");
InitDevice(pcVirtual, pcDevice, pcComponentInput);
InitKeyboard(pcComponentInput->GetInput());
pcVirtual->Enable();
}
示例11: InitAudio
bool COSSAudioSource::Init(void)
{
bool rc = InitAudio(true);
if (!rc) {
return false;
}
if (!InitDevice()) {
return false;
}
rc = SetAudioSrc(
PCMAUDIOFRAME,
m_channelsConfigured,
m_pConfig->GetIntegerValue(CONFIG_AUDIO_SAMPLE_RATE));
if (!rc) {
return false;
}
// for live capture we can match the source to the destination
m_audioSrcSamplesPerFrame = m_audioDstSamplesPerFrame;
m_pcmFrameSize =
m_audioSrcSamplesPerFrame * m_audioSrcChannels * sizeof(u_int16_t);
if (m_audioOssMaxBufferSize > 0) {
size_t array_size;
m_audioOssMaxBufferFrames = m_audioOssMaxBufferSize / m_pcmFrameSize;
if (m_audioOssMaxBufferFrames == 0) {
m_audioOssMaxBufferFrames = 1;
}
array_size = m_audioOssMaxBufferFrames * sizeof(*m_timestampOverflowArray);
m_timestampOverflowArray = (Timestamp *)Malloc(array_size);
memset(m_timestampOverflowArray, 0, array_size);
}
m_pcmFrameBuffer = (u_int8_t*)malloc(m_pcmFrameSize);
if (!m_pcmFrameBuffer) {
goto init_failure;
}
// maximum number of passes in ProcessAudio, approx 1 sec.
m_maxPasses = m_audioSrcSampleRate / m_audioSrcSamplesPerFrame;
return true;
init_failure:
debug_message("audio initialization failed");
free(m_pcmFrameBuffer);
m_pcmFrameBuffer = NULL;
close(m_audioDevice);
m_audioDevice = -1;
return false;
}
示例12: main
void main() {
InitDevice();
while(1){
GetLuminosity();
GetTemperatureHumidity();
Uart1_Write_Text(&packet[0]);
Delay_ms(20000); //20sec
}
}
示例13: wWinMain
//--------------------------------------------------------------------------------------
// WinMain
//--------------------------------------------------------------------------------------
int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow )
{
// デバッグ ヒープ マネージャによるメモリ割り当ての追跡方法を設定
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
//Oculus Riftの初期化
if (InitOculusRift() == 1)
{
CleanupDevice();
return 1;
}
//ウィンドウの作成
if(!InitWindow( hInstance, nCmdShow ) )
{
CleanupDevice();
return 1;
}
//DirectXの初期化
if(FAILED(InitDevice()))
{
CleanupDevice();
return 1;
}
// Oculusで使用するDirectXのオブジェクトを作成する
if (FAILED(InitOculusRiftObjects(3U, HMD)))
{
CleanupDevice();
return 1;
}
//メッセージループのメイン
MSG msg = {0};
while( WM_QUIT != msg.message )
{
if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
else
{
//ここにメインループを書く
Render();
}
}
//終了処理
CleanupDevice();
return (int) msg.wParam;
}
示例14: main
int main(int argc, char *argv[])
{
assert(argc == 2);
char * outFileName = argv[1];
FILE *outFile = fopen(outFileName, "w");
int dtFlyPinitStatus = InitDevice(userIntHandler);
assert(dtFlyPinitStatus == 0);
int status;
/*
uint32_t regData[1];
uint32_t regAddress = 513;
// Read, write, then read again register 0
// ReadWriteConfigRegs(direction, registerNumber, registerDataBuffer, numberOfRegisters)
status = ReadWriteConfigRegs(READ, regAddress, regData, 1);
printf("Read status is %d, value is %08lx\n", status, regData[0]);
regData[0] = 0x12345678;
status = ReadWriteConfigRegs(WRITE, regAddress, regData, 1);
printf("Write status is %d\n", status);
status = ReadWriteConfigRegs(READ, regAddress, regData, 1);
printf("Read status is %d, value is %08lx\n", status, regData[0]);
*/
/*
* Read and dump to file
*/
SBufferInit buffer;
unsigned bufferIndex = 0;
AllocateBuffer(bufferIndex, &buffer);
for(int nReads = 0; nReads < 10; nReads += 1) {
status = ReceiveDMAbyBufIndex(DMA1, bufferIndex, 1);
if(status > 0) {
uint64_t *wordBuffer = (uint64_t *)buffer.UserAddr;
int nWords = status / sizeof(uint64_t);
for(int i = 0; i < nWords; i++) {
fprintf(outFile, "%016llx\n", wordBuffer[i]);
}
}
}
ReleaseBuffer(bufferIndex);
ReleaseDevice();
fclose(outFile);
return 0;
}
示例15: main
/* It's the main function for the program, what more do you need to know? */
int main() {
int16_t Degrees = 0;
uint8_t SregSave;
//int16_t Correction = 0;
Degrees = Degrees; //Because it's a warning otherwise, and I don't think I can get rid of it
DataReady = FALSE;
/* Setup the ATmega328p */
InitDevice();
/* Enable interrupts */
sei();
/* Wait till we get data */
while(!DataReady);
/* Main loop */
while(TRUE) {
/* If there is pending data, process it */
if(DataReady) {
SregSave = SREG; /* Preserve the status register */
/* We want the data retrevial completely performed without interruptions */
cli();
//Hand off to a function
Degrees = ProcessData();
DataReady = FALSE;
/* Restore the status register */
SREG = SregSave;
}
//Currently not used, add in later once supplies are received
/* Check to see if the calibration circuit is active, and if so, adjust
* change the mode to calibration mode
*/
//if(bit_is_clear(PORTD, PD4)) {
/* Check to so see if there is a low signal from the calibration circuit */
//Correction = Calibrate(Correction, Degrees);
//} else {
/* If we aren't calibrating, display the direction and such */
LcdWriteString(HeadingString(Degrees), LCD_LINE_ONE);
//}
//Degrees += Correction;
//LcdWriteString(("Degrees: %d", Degrees), LCD_LINE_TWO); //TODO fix this!
}
/* If this is ever called, I don't even know anymore */
return 0;
}