本文整理汇总了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;
}
示例2: cbStop
void MainWindow::cbStop(Fl_Widget*) {
AudioManager* man = AudioManager::getInstance();
m_playPauseButton->label("@>");
man->stopTrees();
m_playPauseButton->value(0);
m_tuilesTree->redraw();
}
示例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;
}
示例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;
}
}
示例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;
}
示例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;
}
示例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");
}
}
示例8: TEST
TEST(AudioManager, init)
{
AudioManager audioMgr;
audioMgr.startUp();
EXPECT_TRUE(audioMgr.isSupport());
audioMgr.shutDown();
EXPECT_FALSE(audioMgr.isSupport());
}
示例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;
}
示例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;
}
示例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;
}
}
}
示例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();
}
示例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;
}
示例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;
}
}
示例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();
}