本文整理汇总了C++中InitDevice函数的典型用法代码示例。如果您正苦于以下问题:C++ InitDevice函数的具体用法?C++ InitDevice怎么用?C++ InitDevice使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了InitDevice函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:AntiMoron,项目名称:AudioTest,代码行数:37,代码来源:Audio.cpp
示例2: InitDevice
DirectX9Renderer::DirectX9Renderer(HWND a_hWindow, D3DPRESENT_PARAMETERS d3dpp)
{
m_pD3D = NULL;
m_pd3dDevice = NULL;
m_hWindow = a_hWindow;
InitDevice(d3dpp);
}
开发者ID:TheWhiteAmbit,项目名称:TheWhiteAmbit,代码行数:7,代码来源:DirectX9Renderer.cpp
示例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);
}
开发者ID:ArnoldSchiller,项目名称:obs-studio,代码行数:34,代码来源:d3d11-subsystem.cpp
示例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;
}
开发者ID:immiao,项目名称:QtDirectX,代码行数:27,代码来源:dxwidget.cpp
示例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;
}
开发者ID:PI-SRau,项目名称:micro-manager,代码行数:33,代码来源:MUCamSource.cpp
示例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();
}
开发者ID:jstraub,项目名称:Pangolin,代码行数:32,代码来源:pleora.cpp
示例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;
}
开发者ID:PI-SRau,项目名称:micro-manager,代码行数:41,代码来源:MUCamSource.cpp
示例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;
}
开发者ID:HGGM-LIM,项目名称:PLUS-LIM,代码行数:29,代码来源:MediaFoundationVideoDevice.cpp
示例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;
}
开发者ID:jason-amju,项目名称:dxboiler,代码行数:57,代码来源:DX11.cpp
示例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();
}
开发者ID:andrewpaterson,项目名称:Codaphela.Library,代码行数:9,代码来源:ComponentInputKeyboard.cpp
示例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;
}
开发者ID:acassis,项目名称:emlinux-ssd1935,代码行数:56,代码来源:audio_oss_source.cpp
示例12: main
void main() {
InitDevice();
while(1){
GetLuminosity();
GetTemperatureHumidity();
Uart1_Write_Text(&packet[0]);
Delay_ms(20000); //20sec
}
}
开发者ID:eavgerinos,项目名称:meteostats,代码行数:10,代码来源:main.c
示例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;
}
开发者ID:rodonjohn,项目名称:tutorial_oculus_0_3_x,代码行数:57,代码来源:main.cpp
示例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;
}
开发者ID:lferramacho,项目名称:sw_daq_tofpet,代码行数:54,代码来源:registerTest2.cpp
示例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;
}
开发者ID:iospace,项目名称:compass,代码行数:53,代码来源:compass.c
示例16: InitAudio
bool CALSAAudioSource::Init(void)
{
bool rc = InitAudio(true);
if (!rc) {
return false;
}
if (!InitDevice()) {
return false;
}
//#error we will have to remove this below - the sample rate will be
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;
// gets set
m_pcmFrameSize = m_audioSrcSamplesPerFrame * m_audioSrcChannels * sizeof(u_int16_t);
if (m_audioMaxBufferSize > 0) {
size_t array_size;
m_audioMaxBufferFrames = m_audioMaxBufferSize / m_pcmFrameSize;
if (m_audioMaxBufferFrames == 0) {
m_audioMaxBufferFrames = 1;
}
array_size = m_audioMaxBufferFrames * sizeof(*m_timestampOverflowArray);
m_timestampOverflowArray = (Timestamp *)Malloc(array_size);
memset(m_timestampOverflowArray, 0, array_size);
}
// maximum number of passes in ProcessAudio, approx 1 sec.
m_maxPasses = m_audioSrcSampleRate / m_audioSrcSamplesPerFrame;
return true;
#if 0
init_failure:
debug_message("audio initialization failed");
snd_pcm_close(m_pcmHandle);
m_pcmHandle = -1;
return false;
#endif
}
开发者ID:BluePandaLi,项目名称:mpeg4ip,代码行数:52,代码来源:audio_alsa_source.cpp
示例17: OnResetDevice
void OnResetDevice(void)
{
D3DPRESENT_PARAMETERS &d3dpp = d3d::GetGlobleD3DPP();
if(FAILED(Device->Reset(&d3dpp)))
{
return;
}
/*
m_sprite->OnResetDevice();
m_font->OnResetDevice();
*/
InitDevice();
}
开发者ID:kelunce,项目名称:InitDX,代码行数:14,代码来源:cube.cpp
示例18: main
/*********************************************************************
*
* Main Function
*
*********************************************************************/
void main(void)
{
InitDevice();
while(1)
{
// Transmit message
ECAN_Transmit();
// Toggle LED
Heartbeat();
// Delay for one millisecond
Delay(ONE_MS);
}
}
开发者ID:neolzh123,项目名称:ece-can-bus,代码行数:19,代码来源:main.c
示例19: OpenDevice
HX_RESULT CHXAudioDevice::CheckFormat(const HXAudioFormat* pFormat)
{
HX_RESULT res = HXR_FAIL;
//Symbian only supports 16-bit PCM.
if (pFormat->uBitsPerSample == 16 &&
HXR_OK == OpenDevice() &&
HXR_OK == InitDevice(pFormat))
{
res = HXR_OK;
}
return res;
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:14,代码来源:audsymbian.cpp
示例20: InitDevice
BOOL CMidiChCtrlDlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
::SetWindowLong(cmbBank.GetSafeHwnd(), GWL_USERDATA, -1);
::SetWindowLong(cmbProg.GetSafeHwnd(), GWL_USERDATA, -1);
// TODO: ここに初期化を追加してください
if (theCh != 0) {
InitDevice();
}
hTimer = SetTimer(0, 10, 0);
return TRUE; // return TRUE unless you set the focus to a control
// 例外 : OCX プロパティ ページは必ず FALSE を返します。
}
开发者ID:madscient,项目名称:FITOM,代码行数:15,代码来源:MidiChCtrlDlg.cpp
注:本文中的InitDevice函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论