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


C++ AudioManager类代码示例

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


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

示例1: playerSelection

int LobbyMenu::checkButtons(){
	InputManager::getInstance()->update();
	for (size_t i = 0; i < classButt.size(); ++i){
		// if pressed 
		if (dynamic_cast<ButtonLogicComponent*>(classButt[i]->GetComponent(COMPONENT_LOGIC))->isButtonPressed()){
			int selection = dynamic_cast<ButtonRenderComponent*>(classButt[i]->GetComponent(COMPONENT_RENDER))->getCurrImage();
			playerSelection(selection);
			selected = selection;
			return i+10;
		}
		// if hovering over show images of the tutorials
		if (dynamic_cast<ButtonLogicComponent*>(classButt[i]->GetComponent(COMPONENT_LOGIC))->isMouseHovering()){
			dynamic_cast<TutorialRenderComponent*>(tutorials[i]->GetComponent(COMPONENT_RENDER))->toggleImage(true);
		}
		else {
			dynamic_cast<TutorialRenderComponent*>(tutorials[i]->GetComponent(COMPONENT_RENDER))->toggleImage(false);
		}
	}
	if (selected != -1 && readyButt && dynamic_cast<ButtonLogicComponent*>(readyButt->GetComponent(COMPONENT_LOGIC))->isButtonPressed()){
		ready = !ready;
		AudioManager* audioMan = AudioManager::getAudioInstance();
		audioMan->playByName("readyupsfx.ogg");
		playerReady(ready);
		return BUTTON_READY;
	}
	if (dynamic_cast<ButtonLogicComponent*>(backButt->GetComponent(COMPONENT_LOGIC))->isButtonPressed()){
		return BUTTON_BACK;
	}
	return BUTTON_NONE;
}
开发者ID:EthanShimooka,项目名称:BAA,代码行数:30,代码来源:LobbyMenu.cpp

示例2: cbStop

void MainWindow::cbStop(Fl_Widget*) {
    AudioManager* man = AudioManager::getInstance();
    m_playPauseButton->label("@>");
    man->stopTrees();
    m_playPauseButton->value(0);
    m_tuilesTree->redraw();
}
开发者ID:scrime,项目名称:LiveTuiles,代码行数:7,代码来源:MainWindow.cpp

示例3: Run

  NS_IMETHODIMP Run() {
    nsCOMPtr<nsIAudioManager> amService = do_GetService(NS_AUDIOMANAGER_CONTRACTID);
    NS_ENSURE_TRUE(amService, NS_OK);
    AudioManager *am = static_cast<AudioManager *>(amService.get());
    for (int loop = 0; loop < AUDIO_STREAM_CNT; loop++) {
      AudioSystem::initStreamVolume(static_cast<audio_stream_type_t>(loop), 0,
                                   sMaxStreamVolumeTbl[loop]);
      int32_t index;
      am->GetStreamVolumeIndex(loop, &index);
      am->SetStreamVolumeIndex(loop, index);
    }

    if (sHeadsetState & AUDIO_DEVICE_OUT_WIRED_HEADSET)
      InternalSetAudioRoutes(SWITCH_STATE_HEADSET);
    else if (sHeadsetState & AUDIO_DEVICE_OUT_WIRED_HEADPHONE)
      InternalSetAudioRoutes(SWITCH_STATE_HEADPHONE);
    else
      InternalSetAudioRoutes(SWITCH_STATE_OFF);

    int32_t phoneState = nsIAudioManager::PHONE_STATE_INVALID;
    am->GetPhoneState(&phoneState);
#if ANDROID_VERSION < 17
    AudioSystem::setPhoneState(phoneState);
#else
    AudioSystem::setPhoneState(static_cast<audio_mode_t>(phoneState));
#endif

    AudioSystem::get_audio_flinger();
    return NS_OK;
  }
开发者ID:Jaxo,项目名称:releases-mozilla-central,代码行数:30,代码来源:AudioManager.cpp

示例4: hatchBird

void PlayerLogicComponent::hatchBird(bool respawn){
	if (isEgg){
		if (respawn && gameObjectRef->isLocal){
			AudioManager* audioMan = AudioManager::getAudioInstance();
			audioMan->playByName("roostersfx.ogg");
		}
		PlayerRenderComponent* renderComp = dynamic_cast<PlayerRenderComponent*>(gameObjectRef->GetComponent(COMPONENT_RENDER));
		//reset sprites
		//for (auto obj : renderComp->allObjs)obj.second->visible = true;
		createParticle(renderComp->allObjs["egg"], 10, gameObjectRef->posX, gameObjectRef->posY);
		renderComp->allObjs["body"]->visible = true;
		renderComp->allObjs["egg"]->visible = false;

		//reset positions
		renderComp->allObjs["base"]->posX = gameObjectRef->posX;
		renderComp->allObjs["base"]->posY = gameObjectRef->posY;
		//reset rotation
		PlayerPhysicsComponent* physicsComp = dynamic_cast<PlayerPhysicsComponent*>(gameObjectRef->GetComponent(COMPONENT_PHYSICS));
		b2Vec2 pos;
		physicsComp->mBody->SetFixedRotation(true);
		pos = physicsComp->mBody->GetPosition();
		gameObjectRef->rotation = 0;
		physicsComp->mBody->SetTransform(pos, 0);
		renderComp->allObjs["base"]->rotation = 0;
		isEgg = false;
	}
}
开发者ID:EthanShimooka,项目名称:BAA,代码行数:27,代码来源:PlayerLogicComponent.cpp

示例5: jackCallback

int jackCallback(jack_nframes_t nbFrames, void *arg) {
    AudioManager* aman = AudioManager::getInstance();
    //progress in the trees
    aman->processTrees(float(nbFrames)*aman->m_procStep);
    //process the buffers
    aman->process(nbFrames);
	return 0;
}
开发者ID:scrime,项目名称:LiveTuiles,代码行数:8,代码来源:AudioManager.cpp

示例6: _checkBufferStatus

// background thread that will check the status of the buffers
static void* _checkBufferStatus(void* args) {
	AudioManager* manager = (AudioManager*)args;
	while (bgThreadAlive) {
		manager->checkBuffers();
		usleep(500); // 500usec -> 0.5ms
	}
	return NULL;
}
开发者ID:funkaster,项目名称:FakeWebGL,代码行数:9,代码来源:FakeAudio.cpp

示例7: playShieldCollisionSFX

void PowerShieldLogicComponent::playShieldCollisionSFX() {
    //Need shield object
    PowerShieldRenderComponent* rendComp = dynamic_cast<PowerShieldRenderComponent*>(gameObjectRef->GetComponent(COMPONENT_RENDER));
    RenderManager* renderMan = RenderManager::getRenderManager();
    if (renderMan->isObjOnScreen(rendComp->objRef)) {
        AudioManager* audioMan = AudioManager::getAudioInstance();
        audioMan->playByName("chickenshieldsfx.ogg");
    }
}
开发者ID:EthanShimooka,项目名称:BAA,代码行数:9,代码来源:PowerShieldLogicComponent.cpp

示例8: TEST

TEST(AudioManager, init)
{
	AudioManager audioMgr;
	audioMgr.startUp();
	EXPECT_TRUE(audioMgr.isSupport());
	
	audioMgr.shutDown();
	EXPECT_FALSE(audioMgr.isSupport());
}
开发者ID:shipduck,项目名称:cham-cham-cham,代码行数:9,代码来源:audio_manager_test.cpp

示例9: recordCallback

int			recordCallback(	const void *input, void *output,
                            unsigned long,
							const PaStreamCallbackTimeInfo* timeInfo,
							PaStreamCallbackFlags statusFlags,
							void *userData)
{
	AudioManager *dis = (AudioManager*)userData;
	const SAMPLE *in = (const SAMPLE *)input;
	int retenc(0);
	(void) timeInfo;
	(void) statusFlags;
	(void) output;

    //OLD
//        dis->setDataRec(dis->getEnc()->encodeAudio(in, &retenc));
//    dis->setRetencRec(retenc);

    dis->getPool().tryLock(REC_MUTEX);
    //dis->getBufferRec().write(dis->getEnc()->encodeAudio(in, &retenc), retenc);
    unsigned char *tmp = dis->getEnc()->encodeAudio(in, &retenc);

    if (dis->getSizeRec() + retenc < 255*255)
    {
      LibC::memcpy(dis->getStaticBufferRec() + dis->getSizeRec(), tmp, retenc);
         dis->setSizeRec(dis->getSizeRec() + retenc);
    }
    dis->getPool().unLock(REC_MUTEX);

	return paContinue;
}
开发者ID:stephanemombuleau,项目名称:babelEpitech,代码行数:30,代码来源:AudioManager.cpp

示例10: main

int main () {
  AudioManager * am = new AudioManager();
  am->loadSamples("sampled-repos/car-clean-10.26.2015/");
  am->loadGroundTruth("audio-repos/car-clean-10.26.2015/");
  XCorrIdentifier * xc = new XCorrIdentifier(am);
  xc->doAllMatches();
  int correct = am->evaluate(xc->getMatches());
  cout << "Got " << correct << " out of " << am->getNumSamples() << endl;
  //Identifier identifiers [2] = {XCorrIdentifier(am), RandomIdentifier(am)};
  return 0;
}
开发者ID:arunganesan,项目名称:radiosampler,代码行数:11,代码来源:main.cpp

示例11: test

void test(){
	AudioManager* am = AudioManager::getInstance();

	//Adding music to filename's map
	am->add("1", "FileName1.mp3");
	am->add("2", "FileName2.mp3");

	char c = 0;

	//Testing based on user input
	while (42){
		c = _getch();
		cout << (int)c << endl;
		switch (c){
		case 'c':
		case 'C':
			delete am;
			AudioRenderer::destroy();
			return;
		case 'p':
		case 'P':
			(AudioRenderer::Instance())->pauseMusic();
			break;
		case 's':
		case 'S':
			(AudioRenderer::Instance())->stopMusic();
			break;
		case '1':
			(AudioRenderer::Instance())->loadAndPlayMusic("1", am);
			break;
		case '2':
			(AudioRenderer::Instance())->loadAndPlayMusic("2", am);
			break;
		case 'u':
		case 'U':
			(AudioRenderer::Instance())->musicVolumeUp();
			break;
		case 'd':
		case 'D':
			(AudioRenderer::Instance())->musicVolumeDown();
			break;
		case 'm':
		case 'M':
			(AudioRenderer::Instance())->muteMusic();
			break;
		case 'r':
		case 'R':
			(AudioRenderer::Instance())->musicVolumeReset();
			break;
		default:
			break;
		}
	}
}
开发者ID:Jbtyson,项目名称:EmawEngine,代码行数:54,代码来源:Test.cpp

示例12: togglePlayPause

void MainWindow::togglePlayPause() {
    AudioManager* man = AudioManager::getInstance();
    if(man->isPlaying()) {
		m_playPauseButton->label("@>");
		man->pauseTrees();
        m_playPauseButton->value(0);
    }
    else {
		m_playPauseButton->label("@||");
		man->startTrees();
        m_playPauseButton->value(1);
	}
    m_tuilesTree->redraw();
}
开发者ID:scrime,项目名称:LiveTuiles,代码行数:14,代码来源:MainWindow.cpp

示例13: playCallback

int			playCallback(	const void *input, void *output,
                            unsigned long,
							const PaStreamCallbackTimeInfo* timeInfo,
							PaStreamCallbackFlags statusFlags,
							void *userData)
{
	AudioManager *dis = (AudioManager*)userData;
	SAMPLE	*out = (SAMPLE *)output;
	(void) timeInfo;
	(void) statusFlags;
	(void) input;
    int tmp;

//NEW WAY
    dis->getPool().tryLock(PLAY_MUTEX);
    tmp = dis->getSizePlay();
    dis->setSizePlay(0);
    dis->getPool().unLock(PLAY_MUTEX);

    if (tmp)
        dis->getEnc()->decodeAudio(dis->getStaticBufferPlay(), out, tmp);


    //OLD
    //dis->getEnc()->decodeAudio(dis->getDataPlay(), out, dis->getRetencPlay());
	return paContinue;
}
开发者ID:stephanemombuleau,项目名称:babelEpitech,代码行数:27,代码来源:AudioManager.cpp

示例14:

Sound::Sound(int eventId)
{
	AudioManager* am = AudioManager::GetInstance();
	am->GetEventHandle(eventId, this->zEvent);
	this->zCurrentTime = 0;

	switch (eventId)
	{
	case EVENTID_NOTDEADYET_WALK_GRASS:
		this->zMaxTime = 0.5f;
		break;
	case EVENTID_NOTDEADYET_WALK_DIRT:
		this->zMaxTime = 0.5f;
		break;
	default:
		break;
	}
}
开发者ID:Crant,项目名称:Game_Project,代码行数:18,代码来源:Sound.cpp

示例15: updateChildren

void TreeWidget::updateChildren() {
    m_childrenTuileWidgets.clear();
    //get new children tuile widgets
    AudioManager* man = AudioManager::getInstance();
    vector<Tuile*>::const_iterator itChild=man->getChildren().begin();
    for(; itChild!=man->getChildren().end(); ++itChild) {
        if(m_tuileWidgets.find((*itChild)->getID())!=m_tuileWidgets.end()){
            m_childrenTuileWidgets.push_back(
                                        m_tuileWidgets[(*itChild)->getID()]);
        }
    }
    //update the children of all the tuilewidgets
    map<unsigned int, TuileWidget*>::iterator itWid=m_tuileWidgets.begin();
    for(; itWid!=m_tuileWidgets.end(); ++itWid) {
        itWid->second->updateChildren();
    }
    //print the trees
    man->printTrees();
    //update everything
    notifyUpdate();
}
开发者ID:scrime,项目名称:LiveTuiles,代码行数:21,代码来源:TreeWidget.cpp


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