这篇教程C++ ErrorCheck函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ErrorCheck函数的典型用法代码示例。如果您正苦于以下问题:C++ ErrorCheck函数的具体用法?C++ ErrorCheck怎么用?C++ ErrorCheck使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ErrorCheck函数的21个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ErrorCheckint Player::openSong(std::string songName){ //close current song if there is currently one loaded if (m_songLoaded) { (void) ErrorCheck(m_channel->stop()); (void) ErrorCheck(m_song->release()); } //Open the song as a stream m_result = m_system->createStream(songName.c_str(), FMOD_DEFAULT, 0, &m_song); m_error = ErrorCheck(m_result); if (!m_error) { //assign a channel to the song and play it upon open m_result = m_system->playSound(m_song, NULL, false, &m_channel); m_error = ErrorCheck(m_result); } //check for errors and return accordingly if (m_error) { m_songLoaded = false; return OPEN_FAILURE; } else { m_channel->setLoopCount(0); m_songLoaded = true; return OPEN_SUCCESS; }}
开发者ID:davidruble,项目名称:SAMV,代码行数:33,
示例2: return void FMOD_System::CreateSounds( const SoundFilenameMap& soundFilenames ) { auto isPresent = [=]( const std::string& key ) -> bool { return ( soundFilenames.find( key ) != soundFilenames.end() ) ? true : false; }; if( isPresent( "bgmusic" ) ) { ErrorCheck( system->createStream( soundFilenames.at("bgmusic").c_str(), FMOD_LOOP_NORMAL | FMOD_CREATESTREAM, nullptr, &bgmusic ) ); bgmusic->setDefaults( 44100, 0.025f, 0.f, 128 ); } if( isPresent( "jet" ) ) { ErrorCheck( system->createSound( soundFilenames.at( "jet" ).c_str(), FMOD_3D, nullptr, &jet ) ); jet->setDefaults( 44100, 0.75f, 0.f, 128 ); } if( isPresent( "vent" ) ) { ErrorCheck( system->createSound( soundFilenames.at( "vent" ).c_str(), FMOD_3D | FMOD_LOOP_NORMAL, nullptr, &ventSound ) ); ventSound->setDefaults( 44100, 0.3f, 0.f, 128 ); } if( isPresent( "collision" ) ) { ErrorCheck( system->createSound( soundFilenames.at( "collision" ).c_str(), FMOD_3D, nullptr, &collision ) ); collision->setDefaults( 44100, 5.f, 0.f, 128 ); } if( isPresent( "roll" ) ) { ErrorCheck( system->createSound( soundFilenames.at( "roll" ).c_str(), FMOD_3D, nullptr, &roll ) ); roll->setDefaults( 44100, 2.f, 0.f, 128 ); } }
开发者ID:gemini14,项目名称:AirBall,代码行数:35,
示例3: GetSearchInt// This function prompts user to input searchInt based on search typeint GetSearchInt(int& choice){ int searchInt; // IN & OUT & CALC - int to searched, input // by user searchInt = 0; // Initialize searchInt to 0 // Will prompt user to input searchInt based on menu choice switch(choice) { case YEARSEARCH: cout << "/nWhich year are you looking for? "; searchInt = ErrorCheck(1878, 3000); cout << "/nSearching for the year " << searchInt << endl; break; case RATINGSEARCH: cout << "/nWhich rating are you looking for? "; searchInt = ErrorCheck(0, 9); cout << "/nSearching for the rating " << searchInt << endl; break; default: cout << "/nYou shouldn't have done that./n"; break; } // Returns int to be searched return searchInt;}
开发者ID:chellybear,项目名称:Searching-Linked-Lists,代码行数:28,
示例4: bool AudioSystem::Load2DSound(const string& filepath, FMOD::Sound** sound){ FMOD_RESULT result = m_system->createSound(filepath.c_str(), FMOD_2D, 0, &*sound); if (!ErrorCheck(result)) return false; result = (*sound)->setMode(FMOD_LOOP_OFF); if (!ErrorCheck(result)) return false; return true;}
开发者ID:Fliuhuo,项目名称:Game-Engine,代码行数:7,
示例5: ErrorCheckvoid Renderer::createBuffer(VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags memory_properties, VkBuffer & buffer, VkDeviceMemory & buffer_memory) { VkBufferCreateInfo buffer_create_info{}; buffer_create_info.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; buffer_create_info.size = size; buffer_create_info.usage = usage; buffer_create_info.sharingMode = VK_SHARING_MODE_EXCLUSIVE; ErrorCheck(vkCreateBuffer(_device, &buffer_create_info, nullptr, &buffer)); VkMemoryRequirements mem_requirements{}; vkGetBufferMemoryRequirements(_device, buffer, &mem_requirements); uint32_t type_filter = mem_requirements.memoryTypeBits; uint32_t memory_type; for (uint32_t i = 0; i < _gpu_memory_properties.memoryTypeCount; i++) { if ((type_filter & (1 << i)) && (_gpu_memory_properties.memoryTypes[i].propertyFlags & memory_properties) == memory_properties) { memory_type = i; break; } } VkMemoryAllocateInfo memory_allocate_info{}; memory_allocate_info.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO; memory_allocate_info.allocationSize = mem_requirements.size; memory_allocate_info.memoryTypeIndex = memory_type; ErrorCheck(vkAllocateMemory(_device, &memory_allocate_info, nullptr, &buffer_memory)); ErrorCheck(vkBindBufferMemory(_device, buffer, buffer_memory, 0));}
开发者ID:danielgrimshaw,项目名称:VulkanTest,代码行数:30,
示例6: ErrorCheckint SoundManager::Play3D(string Name, SoundType Type, XMFLOAT3 Position, bool Loop){ if(!Exists(Name)) { DebugScreen::GetInstance()->AddLogMessage("Sound: /"" + Name + "/" does not exist.", Red); return -1; } if(Loop) gSoundIterator->second.second->setMode(FMOD_LOOP_NORMAL); ErrorCheck(gSystem->playSound(FMOD_CHANNEL_FREE, gSoundIterator->second.second, true, &gChannel)); ErrorCheck(gChannel->setPaused(false)); switch(Type) { case Song: gChannel->setVolume( gMusicVolume * gMasterVolume ); break; case SFX: gChannel->setVolume( gEffectVolume * gMasterVolume ); break; } FMOD_VECTOR tVelocity = {0, 0, 0}; gResult = gChannel->set3DAttributes(&gListenerPosition, &tVelocity); ErrorCheck(gResult); gPlayingSounds->push_back(new PlayingSound(PSIndex( gUniqueIndex, Name ), PSEntry( Type, gChannel ))); ++gUniqueIndex; return gUniqueIndex - 1;}
开发者ID:CarlRapp,项目名称:CodenameGamma,代码行数:35,
示例7: ErrorCheckvoid Window::_InitSwapchainImages(){ _swapchain_images.resize( _swapchain_image_count ); _swapchain_image_views.resize( _swapchain_image_count ); ErrorCheck( vkGetSwapchainImagesKHR( _renderer->GetVulkanDevice(), _swapchain, &_swapchain_image_count, _swapchain_images.data() ) ); for( uint32_t i=0; i < _swapchain_image_count; ++i ) { VkImageViewCreateInfo image_view_create_info {}; image_view_create_info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; image_view_create_info.image = _swapchain_images[ i ]; image_view_create_info.viewType = VK_IMAGE_VIEW_TYPE_2D; image_view_create_info.format = _surface_format.format; image_view_create_info.components.r = VK_COMPONENT_SWIZZLE_IDENTITY; image_view_create_info.components.g = VK_COMPONENT_SWIZZLE_IDENTITY; image_view_create_info.components.b = VK_COMPONENT_SWIZZLE_IDENTITY; image_view_create_info.components.a = VK_COMPONENT_SWIZZLE_IDENTITY; image_view_create_info.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; image_view_create_info.subresourceRange.baseMipLevel = 0; image_view_create_info.subresourceRange.levelCount = 1; image_view_create_info.subresourceRange.baseArrayLayer = 0; image_view_create_info.subresourceRange.layerCount = 1; ErrorCheck( vkCreateImageView( _renderer->GetVulkanDevice(), &image_view_create_info, nullptr, &_swapchain_image_views[ i ] ) ); }}
开发者ID:piaoasd123,项目名称:VulkanTest,代码行数:26,
示例8: sync_MergeFromPilot_fast/*********************************************************************** * * Function: sync_MergeFromPilot_fast * * Summary: er, fast merge from Palm to desktop * * Parameters: None * * Returns: 0 if success, nonzero otherwise * ***********************************************************************/static intsync_MergeFromPilot_fast(SyncHandler * sh, int dbhandle, RecordModifier rec_mod){ int result = 0; PilotRecord *precord = sync_NewPilotRecord(DLP_BUF_SIZE); DesktopRecord *drecord = NULL; RecordQueue rq = { 0, NULL }; pi_buffer_t *recbuf = pi_buffer_new(DLP_BUF_SIZE); while (dlp_ReadNextModifiedRec(sh->sd, dbhandle, recbuf, &precord->recID, NULL, &precord->flags, &precord->catID) >= 0) { int count = rq.count; precord->len = recbuf->used; if (precord->len > DLP_BUF_SIZE) precord->len = DLP_BUF_SIZE; memcpy(precord->buffer, recbuf->data, precord->len); ErrorCheck(sh->Match(sh, precord, &drecord)); ErrorCheck(sync_record (sh, dbhandle, drecord, precord, &rq, rec_mod)); if (drecord && rq.count == count) ErrorCheck(sh->FreeMatch(sh, drecord)); } pi_buffer_free(recbuf); sync_FreePilotRecord(precord); result = sync_MergeFromPilot_process(sh, dbhandle, &rq, rec_mod); return result;}
开发者ID:jichu4n,项目名称:pilot-link,代码行数:44,
示例9: ErrorCheckvoid AudioSystem::Play3DSound(FMOD::Sound* sound, const FMOD_VECTOR& position, FMOD::Channel** channel){ FMOD_RESULT result = m_system->playSound(FMOD_CHANNEL_FREE, sound, true, &*channel); ErrorCheck(result); result = (*channel)->set3DAttributes(&position, 0); ErrorCheck(result); result = (*channel)->setPaused(false); ErrorCheck(result);}
开发者ID:Fliuhuo,项目名称:Game-Engine,代码行数:8,
示例10: m_channel AudioClip::AudioClip(const string& filename, bool streamed) : m_channel(0), m_playing(false), m_paused(false), m_looping(false), m_volume(1.0f) { if (!streamed) ErrorCheck(Audio::AudioSystem().createSound(filename.c_str(), FMOD_DEFAULT, 0, &m_sound)); else ErrorCheck(Audio::AudioSystem().createStream(filename.c_str(), FMOD_DEFAULT, 0, &m_sound)); }
开发者ID:Ossadtchii,项目名称:PIXEL2D,代码行数:8,
示例11: ErrorCheckvoid Summerface::AddWindow (const std::string& aName, SummerfaceWindow_Ptr aWindow){ ErrorCheck(aWindow, "Summerface::AddWindow: Window is not a valid pointer. [Name: %s]", aName.c_str()); ErrorCheck(Windows.find(aName) == Windows.end(), "Summerface::AddWindow: Window with name is already present. [Name: %s]", aName.c_str()); Windows[aName] = aWindow; aWindow->SetInterface(shared_from_this(), aName); ActiveWindow = aName;}
开发者ID:cdenix,项目名称:psmame,代码行数:9,
示例12: Trace bool AudioFMOD::Load(FMOD::Studio::Bank*& bank, const std::string & path) { Trace("Loading '" + path + "'"); // Load the bank into the sound system if (!ErrorCheck(System->loadBankFile(path.c_str(), FMOD_STUDIO_LOAD_BANK_NORMAL, &bank))) return false; // Now that the bank is finished loading, load its sample data ErrorCheck(bank->loadSampleData()); return true; }
开发者ID:Azurelol,项目名称:Samples,代码行数:11,
示例13: Trace void AudioFMOD::Initialize() { Trace("Initializing Low Level and Studio system objects... "); // Create the Low Level System ErrorCheck(FMOD::System_Create(&System.LowLevel)); // Create the Studio System ErrorCheck(System->create(&System.Studio)); // Set FMOD low level studio pointer ErrorCheck(System->getLowLevelSystem(&System.LowLevel)); // Initialize it unsigned maxChannels = 36; ErrorCheck(System->initialize(maxChannels, FMOD_STUDIO_INIT_NORMAL, FMOD_INIT_NORMAL, nullptr)); }
开发者ID:Azurelol,项目名称:Samples,代码行数:13,
示例14: clGetPlatformInfovoid OpenCLBase::GetPlatformInfo(cl_platform_id id) { // size_t length; cl_int errorCode; errorCode = clGetPlatformInfo(id, CL_PLATFORM_PROFILE, 0, NULL, &length); ErrorCheck("clGetPlatformInfo", errorCode); char* param = reinterpret_cast<char*>(malloc(length * sizeof(char))); errorCode = clGetPlatformInfo(id, CL_PLATFORM_PROFILE, length, param, NULL); ErrorCheck("clGetPlatformInfo", errorCode); cout << param << endl; free(param);}
开发者ID:GreatAS,项目名称:OpenCLSample,代码行数:16,
示例15: findSupportedFormatvoid Renderer::_InitRenderPass() { VkAttachmentDescription color_attachment {}; color_attachment.format = _window->getSurfaceFormat().format; color_attachment.samples = VK_SAMPLE_COUNT_1_BIT; color_attachment.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; color_attachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE; color_attachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; color_attachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; color_attachment.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; color_attachment.finalLayout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; VkAttachmentDescription depth_attachment {}; depth_attachment.format = findSupportedFormat( { VK_FORMAT_D32_SFLOAT, VK_FORMAT_D32_SFLOAT_S8_UINT, VK_FORMAT_D24_UNORM_S8_UINT }, VK_IMAGE_TILING_OPTIMAL, VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT ); depth_attachment.samples = VK_SAMPLE_COUNT_1_BIT; depth_attachment.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; depth_attachment.storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; depth_attachment.stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; depth_attachment.stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; depth_attachment.initialLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; depth_attachment.finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; VkAttachmentReference color_attachment_reference {}; color_attachment_reference.attachment = 0; color_attachment_reference.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; VkAttachmentReference depth_attachment_reference {}; depth_attachment_reference.attachment = 1; depth_attachment_reference.layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; VkSubpassDescription subpass{}; subpass.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS; subpass.colorAttachmentCount = 1; subpass.pColorAttachments = &color_attachment_reference; subpass.pDepthStencilAttachment = &depth_attachment_reference; VkSubpassDependency dependency {}; dependency.srcSubpass = VK_SUBPASS_EXTERNAL; dependency.dstSubpass = 0; dependency.srcStageMask = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT; dependency.srcAccessMask = VK_ACCESS_MEMORY_READ_BIT; dependency.dstStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; dependency.dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; std::array<VkAttachmentDescription, 2> attachments = { color_attachment, depth_attachment }; VkRenderPassCreateInfo render_pass_create_info {}; render_pass_create_info.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO; render_pass_create_info.attachmentCount = (uint32_t)attachments.size(); render_pass_create_info.pAttachments = attachments.data(); render_pass_create_info.subpassCount = 1; render_pass_create_info.pSubpasses = &subpass; render_pass_create_info.dependencyCount = 1; render_pass_create_info.pDependencies = &dependency; ErrorCheck(vkCreateRenderPass(_device, &render_pass_create_info, nullptr, &_render_pass));}
开发者ID:danielgrimshaw,项目名称:VulkanTest,代码行数:60,
示例16: ErrorCheck // Start playing a song FMOD::Channel *Song::Start(bool paused) { // Channel volume will be set to 1.0f (max) automatically ErrorCheck(engine->FMOD()->playSound(FMOD_CHANNEL_FREE, resource.get(), true, &channel)); // Add to channel group (for master volume) if (channelGroup) channel->setChannelGroup(channelGroup); // Songs repeat forever by default channel->setLoopCount(-1); channel->setMode(FMOD_LOOP_NORMAL); // Flush buffer to ensure loop logic is executed channel->setPosition(0, FMOD_TIMEUNIT_MS); // Set paused or not as applicable if (!paused) channel->setPaused(paused); // Cancel any fade that was previously applied fade = false; return channel; }
开发者ID:AnnaKitKatBar,项目名称:seeSound,代码行数:26,
|