当前位置: 首页>>代码示例>>C++>>正文


C++ CAudioManager::LoadFile方法代码示例

本文整理汇总了C++中CAudioManager::LoadFile方法的典型用法代码示例。如果您正苦于以下问题:C++ CAudioManager::LoadFile方法的具体用法?C++ CAudioManager::LoadFile怎么用?C++ CAudioManager::LoadFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CAudioManager的用法示例。


在下文中一共展示了CAudioManager::LoadFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TagToString

//=====================================================================================
//  JS: Sound Buffer:  An AL buffer dedicated to one sound
//  SoundBUF are managed by CAudioManager in a buffer cache.  Do not delete them.
//=====================================================================================
CSoundBUF::CSoundBUF(Tag t, char *nf)
{ CAudioManager *snd = globals->snd;
  user    = 1;
  idn     = t;
  offset  = 0;
  nfile   = 0;
  alSRC   = 0;
  TagToString(itag,t);
  ALuint  buf;
  alGenBuffers(1,&buf);
  alBUF   = buf;
  snd->Check();
  snd->LoadFile(this,nf);
  snd->IncBUF();
  gain    = 1;
  pMin    = 1;
  pMax    = 1;
}
开发者ID:,项目名称:,代码行数:22,代码来源:

示例2: WinMain


//.........这里部分代码省略.........
    else{
      pLog->Log(cfg.GameObjectFile + " (objects file) was loaded successfully!");
      for(int i = 0; i < gameData.m_catalog.GetTableSize();++i){
        pLog->Log("object", gameData.m_catalog.GetTerm(i, 0), gameData.m_catalog.GetTerm(i, 2));
      }
    }

    gTimerKey.Initialize();
    gTimerKey.ResetTimer();
    mouse.SetHandle(hWnd);
    gTimerFPS.Initialize();
    
    //game timer for update
    CTimer timerGame;
    timerGame.Initialize();

    //define events for changing game states
    //*************************************************************************
    //g_pStateIntro->AddTransitionEvent(EVENT_GO_PLAY1, g_pStatePlay1);
    //g_pStatePlay1->AddTransitionEvent(EVENT_GO_CREDITS, g_pStateCredits);   
    g_pStateIntro->AddTransitionEvent(EVENT_GO_MAIN, g_pStateMain);
    g_pStateMain->AddTransitionEvent(EVENT_GO_PLAY1, g_pStatePlay1);
    g_pStateMain->AddTransitionEvent(EVENT_GO_HELP, g_pStateHelp);
    g_pStateMain->AddTransitionEvent(EVENT_GO_CREDITS, g_pStateCredits);
    g_pStatePlay1->AddTransitionEvent(EVENT_GO_MAIN, g_pStateMain);
    g_pStateHelp->AddTransitionEvent(EVENT_GO_MAIN, g_pStateMain);
    g_pStateCredits->AddTransitionEvent(EVENT_GO_QUIT, g_pStateQuit);    
    g_pCurrent = g_pStateIntro;

    //************************************** S O U N D ************************
    //initialize sound manager
    //audio setup
    CAudioManager *pAudio = CAudioManager::Instance();
    pAudio->LoadFile("assets\\data\\sounds.dat");

    //load sound asset file
    pAudio->LoadFile(cfg.SoundAssetFile);
/*
    if(pAudio->LoadFile(cfg.SoundAssetFile) == false){
      pLog->Log("Failure loading " + cfg.GamePlayAssetFile);//assets.dat audio files!");
      ::MessageBox(hWnd,"Failed to load assets.dat audio files!", "Error", 0);
    }
    else
      pLog->Log(cfg.GamePlayAssetFile + " (audio) was loaded successfully!");
  */      
/*
    if(pAudio->IsValidSound() == true)
      pLog->Log("Audio system initialized (size)", pAudio->Size());
    else
      pLog->Log("Audio failure!");
*/
    //log all audio files    
    if(cfg.LogDebugInfo == true){
      pLog->Log("************************** Audio Files Loaded **************");
//      for(int i = 0; i < pAudio->Size(); i++){
//        pLog->Log(pAudio->GetFilename(i)); 
//      }
      pLog->Log("");
    }

    // enter the main loop
    //************************************** M A I N  L O O P *****************
    MSG msg;
    pLog->Log("Entering Main Control Loop");
    float timeDiff = 0.0f;
    g_pCurrent->Activate(gameData, cfg, con);
开发者ID:ChuckBolin,项目名称:JustAnotherTowerDefenseGame,代码行数:67,代码来源:main.cpp


注:本文中的CAudioManager::LoadFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。