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


C++ SoundPlayer::play方法代码示例

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


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

示例1: onInit

// 初期化
void FirstSceneController::onInit() {
	LOGD("FirstSceneController::onInit()");
	
	ApplicationController *ctr = ApplicationController::SharedInstance();
	
	// 音読み込み
	int bgmid = SoundPlayer::loadBGM("sound/bgm_house.ogg");
	SoundPlayer *player = SoundPlayer::SharedInstance();
	player->play(bgmid);
	sid = SoundPlayer::loadSE("sound/se_yay.ogg");
	
	// シーン作成
	Scene_ptr sceneMain(new Scene("SceneFirst"));
	// プレート追加
	Figure_ptr fig;
	fig = Figure_ptr(new Figure("Fig"));
	fig->mesh = PrimitiveObject::createPlate(Sizef(5, 5));
	// マテリアルとシェーダー設定
	fig->material = Material_ptr(new Material());
	fig->material->texture0 = Texture_ptr(new Texture("model/gclue_logo.png"));
	fig->material->ambientColor = Colorf(0, 0, 0.5);
//	fig->shader = ShaderManager::GetShader(ShaderTypeColor);
//	fig->shader = ShaderManager::GetShader(ShaderTypeFlat);
	fig->shader = ShaderManager::GetShader(ShaderTypeTex);
	fig->transform.translate(0, 3, 0);
	fig->touchEventListener = this;
	fig->isTouchable = true;
	
	// シーン変更
	sceneMain->addChildNode(fig);
	ctr->sceneMap[1] = sceneMain;
	ctr->changeScene(1);
}
开发者ID:gclue,项目名称:GCube2,代码行数:34,代码来源:FirstSceneController.cpp

示例2: trigSound

void EmulApp::trigSound(int sndtrig)
{
    const bool dostop = sndtrig < 0;    
    const unsigned snd = dostop ? -sndtrig : sndtrig;
    lastSndEvt = sndtrig;

    SoundPlayerMap::iterator it = soundPlayerMap.find(snd);
    SoundPlayer *sp = 0;
    if (it == soundPlayerMap.end()) {
        Error() << "Triggered unknown sound " << snd;
        return;
    }
    else sp = it->second;
    Debug() << "Got sound trig " << sndtrig << " for filename `" << sp->fileName() << "'";
    if (dostop) {
        //Debug() << "sound " << snd << " stop";
        sp->stop();
        controlwin->untriggeredSound(snd);
    } else {
        //Debug() << "sound " << snd << " play";
        sp->stop();
        sp->play();
        controlwin->triggeredSound(snd);
    }    
}
开发者ID:jerlich,项目名称:rt-fsm,代码行数:25,代码来源:EmulApp.cpp

示例3: onTouchNode

// ノードタッチイベント
void FirstSceneController::onTouchNode(TouchableNode& node, const TouchEvent &event) {
	if (event.action == TouchActionDown) {
		// 音再生
		SoundPlayer *player = SoundPlayer::SharedInstance();
		player->play(sid);
		// シーン遷移
		ApplicationController *ctr = ApplicationController::SharedInstance();
		ctr->changeScene(2);
		// サブウィンドウ表示
		Window_ptr mainWindow = ctr->windowArray[1];
		mainWindow->isVisible = true;
	}
}
开发者ID:gclue,项目名称:GCube2,代码行数:14,代码来源:FirstSceneController.cpp

示例4: playSound

//--------------------------------------------------------------
void SoundManager::playSound(string name, bool isLoop, float volume, int* speakers,int nbSpeakers)
{
    SoundPlayer* pSoundPlayer = getSoundPlayer(name);
    if (pSoundPlayer)
	{
		if (speakers == 0)
	        pSoundPlayer->play();
     	else
	        pSoundPlayer->playTo(speakers,nbSpeakers);
	 
		pSoundPlayer->setLoop(isLoop);
        pSoundPlayer->setVolume(volume);
    }
}
开发者ID:v3ga,项目名称:murmur,代码行数:15,代码来源:soundManager.cpp

示例5: RootController

  RootController(ci::JsonTree& params,
                 ci::TimelineRef timeline,
                 Event<std::vector<Touch> >& touch_event) noexcept :
    params_(params),
    timeline_(timeline),
    ui_camera_(createCamera(params["ui_view.camera"])),
    fov_(ui_camera_.getFov()),
    near_z_(ui_camera_.getNearClip()),
    far_z_(ui_camera_.getFarClip()),
    autolayout_(ui_camera_),
    touch_event_(touch_event),
    view_creator_(params, timeline, ui_camera_, autolayout_, event_, touch_event),
    sound_(params["sounds"]),
    background_(Json::getColor<float>(params["app.background"])),
    records_(params["version"].getValue<float>())
  {
    DOUT << "RootController()" << std::endl;
    
    event_.connect("begin-progress",
                   [this](const Connection&, EventParam& param) noexcept {
                     addController<ProgressController>(params_, timeline_, event_,
                                                       view_creator_.create("ui_progress.json"));
                   });
    
    event_.connect("begin-gameover",
                   [this](const Connection&, EventParam& param) noexcept {
                     addController<GameoverController>(params_, timeline_, event_,
                                                       param,
                                                       view_creator_.create("ui_gameover.json"));
                   });

    event_.connect("begin-stageclear",
                   [this](const Connection&, EventParam& param) noexcept {
                     addController<StageclearController>(params_, timeline_, event_, param,
                                                         view_creator_.create("ui_stageclear.json"));
                   });

    event_.connect("begin-pause",
                   [this](const Connection&, EventParam& param) noexcept {
                     addController<PauseController>(params_, timeline_, event_,
                                                    view_creator_.create("ui_pause.json"));
                   });

    event_.connect("begin-records",
                   [this](const Connection&, EventParam& param) noexcept {
                     EventParam records = {
                       { "total_play",  records_.getTotalPlayNum() },
                       { "total_time",  records_.getTotalPlayTime() },
                       { "high_score",  records_.getHighScore() },
                       { "total_item",  records_.getTotalItemNum() },
                       { "stage_ranks", records_.stageRanks() },
                     };
                     
                     addController<RecordsController>(params_, timeline_, event_, records,
                                                      view_creator_.create("ui_records.json"));
                   });

    event_.connect("begin-credits",
                   [this](const Connection&, EventParam& param) noexcept {
                     addController<CreditsController>(params_, timeline_, event_,
                                                      view_creator_.create("ui_credits.json"));
                   });

    event_.connect("begin-title",
                   [this](const Connection&, EventParam& param) noexcept {
                     startTitle(param);
                   });

    event_.connect("begin-settings",
                   [this](const Connection&, EventParam& param) noexcept {
                     addController<SettingsController>(params_, timeline_, event_, records_,
                                                       view_creator_.create("ui_settings.json"));
                   });

    event_.connect("begin-regulat-stageclear",
                   [this](const Connection&, EventParam& param) noexcept {
                     addController<AllStageClearController>(params_["regular_stageclear"], timeline_, event_,
                                                            param,
                                                            view_creator_.create("ui_regularstageclear.json"));
                   });

    event_.connect("begin-all-stageclear",
                   [this](const Connection&, EventParam& param) noexcept {
                     addController<AllStageClearController>(params_["all_stageclear"], timeline_, event_,
                                                            param,
                                                            view_creator_.create("ui_allstageclear.json"));
                   });

    // GameOver時に色々チェック
    event_.connect("check-after-gameover",
                   [this](const Connection&, EventParam& param) noexcept {
                     DOUT << "check-after-gameover" << std::endl;
                     Rating::popup([this]() {
                         AppSupport::pauseDraw(true);
                       },
                       [this]() {
                         AppSupport::pauseDraw(false);
                       });
                     Achievment::atGameOver(records_);
                   });
//.........这里部分代码省略.........
开发者ID:kazukin134,项目名称:BrickAndTrip,代码行数:101,代码来源:RootController.hpp


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