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


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

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


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

示例1: Initialize

//******************************************************************************
void Initialize(){                      //  I N I T I A L I Z E
//******************************************************************************

  //define transition events for game states
  g_pStateIntro->AddTransitionEvent(GO_MENU, g_pStateMenu);
  
  g_pStateMenu->AddTransitionEvent(GO_QUIT, g_pStateQuit);
  g_pStateMenu->AddTransitionEvent(GO_RULES, g_pStateRules);
  g_pStateMenu->AddTransitionEvent(GO_SCORE, g_pStateScore);
  g_pStateMenu->AddTransitionEvent(GO_PLAY, g_pStatePlay);
  
  g_pStateRules->AddTransitionEvent(GO_MENU, g_pStateMenu);
  
  g_pStateScore->AddTransitionEvent(GO_MENU, g_pStateMenu);
  
  g_pStatePlay->AddTransitionEvent(GO_MENU, g_pStateMenu);
  g_pStatePlay->AddTransitionEvent(GO_SCORE, g_pStateScore);//if new high score
 
  //perform any required game state initialization
  g_pStateIntro->Initialize();
  g_pStateMenu->Initialize();
  g_pStateQuit->Initialize();
  g_pStateRules->Initialize();
  g_pStateScore->Initialize();
  g_pStatePlay->Initialize();

  //start game
  g_pCurrent = g_pStateIntro;//g_pStatePlay;// 

  //initialize sound if audio initializes correctly
  if(g_audio.IsValidSound() == true){
    g_audio.LoadSample(0, "sounds\\burns_fired.wav");
    g_audio.LoadSample(1, "sounds\\Kids_Music_1.wav");
    g_audio.LoadSample(2, "sounds\\Kids_Music_2.wav");
    g_audio.LoadSample(3, "sounds\\Kids_Music_3.wav");
    g_audio.LoadSample(4, "sounds\\victory_fanfare.mp3");
    g_audio.LoadSample(5, "sounds\\burns_started.wav");
    g_audio.LoadSample(6, "sounds\\burns_succeed.wav");
    g_audio.LoadSample(7, "sounds\\truckhorn.wav");
    g_audio.LoadSample(8, "sounds\\trucks021.wav");
  }
}
开发者ID:ChuckBolin,项目名称:DOS2DGame,代码行数:43,代码来源:main.cpp

示例2: WinMain


//.........这里部分代码省略.........
  } 
  else{
    pLog->Log("ERROR****************** Failure to load textures (graphicfiles.dat)");
    delete cfr;
    g_con.CloseD3D();
    pLog->Log("DirectX closed!");
    Shutdown();
    return 0;
  }

  if(g_Sprite.LoadSprites() == true){
    pLog->Log("Sprites loaded!");
  }
  else{
    pLog->Log("ERROR****************** Failure to sprite data (sprites.dat)");
  }

  //used for framerate display
  std::ostringstream oss;
  std::string sFramerate;
  std::string sText;
  int nDisplayFPSCount = 0;

  //initialize audio manager
  //***************************************************************
  if(g_Global.g_bGameAudio == true){
    pLog->Log("Loading audio clip...");
    if(pAudio->IsValidSound())
      pLog->Log("Audio system is okay!");
    else
      pLog->Log("Audio system failure!");
    
    //load sounds
    pAudio->LoadSample(SOUND_BEEP, "assets\\sounds\\beep-03.wav");
    pAudio->LoadSample(SOUND_REMEMBER, "assets\\sounds\\remember.mp3");
    pAudio->LoadSample(SOUND_HYMN, "assets\\sounds\\navy_hymn.mp3");
    pAudio->LoadSample(SOUND_PERISCOPE, "assets\\sounds\\periscop.wav");
    pAudio->LoadSample(SOUND_BUTTON_CLICK, "assets\\sounds\\button_click.wav");
    pAudio->LoadSample(SOUND_DEPTH_CHARGE1,"assets\\sounds\\dc1.mp3");
    pAudio->LoadSample(SOUND_DEPTH_CHARGE2,"assets\\sounds\\dc2.mp3");
    pAudio->LoadSample(SOUND_TORPEDO1,"assets\\sounds\\torpedo3.mp3");
    pAudio->LoadSample(SOUND_TORPEDO2,"assets\\sounds\\torpedo4.mp3");
    pAudio->LoadSample(SOUND_AMBIENCE1,"assets\\sounds\\ambience1.mp3");
    pAudio->LoadSample(SOUND_CLEAR_BRIDGE,"assets\\sounds\\clear_bridge.wav");
    pAudio->LoadSample(SOUND_DIVING,"assets\\sounds\\diving.mp3");
    pAudio->LoadSample(SOUND_GQ,"assets\\sounds\\general_quarters.wav");
    pAudio->LoadSample(SOUND_ANCHORS,"assets\\sounds\\AnchorsAway.mp3");
    pAudio->LoadSample(SOUND_TAPS,"assets\\sounds\\Taps.mp3");
    pAudio->LoadSample(SOUND_SINKING,"assets\\sounds\\sinking2.mp3");
    pAudio->LoadSample(SOUND_ANTHEM,"assets\\sounds\\USA.mp3");
    pAudio->LoadSample(SOUND_FUNERAL,"assets\\sounds\\fnrlMrch.wav");
    pAudio->LoadSample(SOUND_PING,"assets\\sounds\\sonar1.mp3");
    
    //load stream
    pAudio->LoadStream(SOUND_BIO, "assets\\sounds\\fish.mp3");
    pAudio->AddStreamClip(SOUND_BIO1, SOUND_BIO, 0, 17708);
    pAudio->AddStreamClip(SOUND_BIO2, SOUND_BIO, 17708, 26434);
    pAudio->AddStreamClip(SOUND_BIO3, SOUND_BIO, 26434, 42859);
    pAudio->AddStreamClip(SOUND_BIO4, SOUND_BIO, 42859, 59541);
    pAudio->AddStreamClip(SOUND_BIO5, SOUND_BIO, 59541, 80073);

    for(int i = 0; i < pAudio->Size(); i++){
      pLog->Log(pAudio->GetFilename(i), i); //write filename and file index to log file
    }
  }
  else{
开发者ID:ChuckBolin,项目名称:Sinking,代码行数:67,代码来源:main.cpp


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