这篇教程C++ FMOD_System_PlaySound函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中FMOD_System_PlaySound函数的典型用法代码示例。如果您正苦于以下问题:C++ FMOD_System_PlaySound函数的具体用法?C++ FMOD_System_PlaySound怎么用?C++ FMOD_System_PlaySound使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了FMOD_System_PlaySound函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: FMOD_System_PlaySoundvoid Sound::play(float vol){ if(vol==0)return; FMOD_RESULT r; if( !this->ch ){ r = FMOD_System_PlaySound( parent->sys, FMOD_CHANNEL_FREE, sound, 0, & this->ch ); } else { r = FMOD_System_PlaySound( parent->sys, FMOD_CHANNEL_REUSE, sound, 0, & this->ch ); } FMOD_ERRCHECK(r); FMOD_Channel_SetVolume(ch, default_volume * vol );}
开发者ID:kikuchi-hiroshi,项目名称:moyai,代码行数:11,
示例2: FMOD_Sound_SetLoopCount void SoundManager::playSound(const std::string &sound, bool loop) { if (loop) { FMOD_Sound_SetLoopCount(this->_sounds[sound], -1); FMOD_System_PlaySound(this->_system, FMOD_CHANNEL_FREE, this->_sounds[sound], 0, 0); } else { FMOD_Sound_SetLoopCount(this->_sounds[sound], 0); FMOD_System_PlaySound(this->_system, FMOD_CHANNEL_FREE, this->_sounds[sound], 0, 0); } }
开发者ID:jlouazel,项目名称:bomberman,代码行数:13,
示例3: Java_org_fmod_playsound_Example_cPlaySoundvoid Java_org_fmod_playsound_Example_cPlaySound(JNIEnv *env, jobject thiz, int id){ FMOD_RESULT result = FMOD_OK; result = FMOD_System_PlaySound(gSystem, FMOD_CHANNEL_FREE, gSound[id], 0, &gChannel); CHECK_RESULT(result);}
开发者ID:mperroteau,项目名称:Euterpe,代码行数:7,
示例4: MOD_Startvoid MOD_Start (char *name, qboolean midi, qboolean loop, qboolean notify, qboolean resume){ char file[MAX_QPATH]; FMOD_CREATESOUNDEXINFO exinfo; if(SND_Initialised == false) return; if(SND_MusicChannel.inuse == true) FMOD_MusicStop(); if(strlen(name) == 0) return; if(SND_FOpen(name, midi, resume) == true) { memset(&exinfo, 0, sizeof(FMOD_CREATESOUNDEXINFO)); exinfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO); exinfo.length = SND_File.length; result = FMOD_System_CreateSound(fmod_system, (const char *)SND_File.data, FMOD_HARDWARE | FMOD_OPENMEMORY | FMOD_2D, &exinfo, &fmod_music); FMOD_ERROR(result, true, false); if(loop == true) { SND_MusicChannel.looping = true; result = FMOD_Sound_SetMode(fmod_music, FMOD_LOOP_NORMAL); FMOD_ERROR(result, true, false); } else { SND_MusicChannel.looping = false; result = FMOD_Sound_SetMode(fmod_music, FMOD_LOOP_OFF); FMOD_ERROR(result, true, false); } strcpy(file, SND_File.filename); SND_FClose(); } if(!fmod_music) { Con_Printf("Couldn't open stream %s/n", file); return; } else { if(notify == true) Con_Printf("Playing: %s.../n", file); } result = FMOD_System_GetChannel(fmod_system, 0, &SND_MusicChannel.channel); FMOD_ERROR(result, true, false); result = FMOD_System_PlaySound(fmod_system, FMOD_CHANNEL_REUSE, fmod_music, 0, &SND_MusicChannel.channel); FMOD_ERROR(result, true, false); SND_MusicChannel.inuse = true;}
开发者ID:infernuslord,项目名称:uqe-quake,代码行数:60,
示例5: CloseFilevoid QSPCallBacks::PlayFile(QSPString file, int volume){ FMOD_SOUND *newSound; FMOD_CHANNEL *newChannel; QSPSound snd; if (SetVolume(file, volume)) return; CloseFile(file); wxString strFile(wxFileName(wxString(file.Str, file.End), wxPATH_DOS).GetFullPath()); #if defined(__WXMSW__) || defined(__WXOSX__) if (!FMOD_System_CreateSound(m_sys, wxConvFile.cWX2MB(strFile.c_str()), FMOD_SOFTWARE | FMOD_CREATESTREAM, 0, &newSound)) #else FMOD_CREATESOUNDEXINFO exInfo; memset(&exInfo, 0, sizeof(FMOD_CREATESOUNDEXINFO)); exInfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO); wxString dlsPath(QSPTools::GetAppPath() + QSP_MIDIDLS); wxCharBuffer dlsCharPath(wxConvFile.cWX2MB(dlsPath.c_str())); exInfo.dlsname = dlsCharPath; if (!FMOD_System_CreateSound(m_sys, wxConvFile.cWX2MB(strFile.c_str()), FMOD_SOFTWARE | FMOD_CREATESTREAM, &exInfo, &newSound)) #endif { UpdateSounds(); FMOD_System_PlaySound(m_sys, FMOD_CHANNEL_FREE, newSound, FALSE, &newChannel); snd.Channel = newChannel; snd.Sound = newSound; snd.Volume = volume; m_sounds.insert(QSPSounds::value_type(strFile.Upper(), snd)); SetVolume(file, volume); }}
开发者ID:Nesles,项目名称:qsp,代码行数:29,
示例6: fmod_playsoundint fmod_playsound(int i){ FMOD_RESULT result; result = FMOD_System_PlaySound(xsystem, FMOD_CHANNEL_FREE, sound[i], 0, &channel); if (ERRCHECK(result)) return 1; return 0;}
开发者ID:srocha2,项目名称:Final-CS335,代码行数:7,
示例7: PlayMonovoid PlayMono( short which ){ if( soundOn ) { FMOD_System_PlaySound( fmodSystem, FMOD_CHANNEL_FREE, sound[which], false, &soundChannel[2]); }}
开发者ID:torque,项目名称:CandyCrisis,代码行数:7,
示例8: CreateGameSgame CreateGame(int id_map) { Sgame game; /* Creation du hero */ Shero Heros = CreateHero(POSITION_DEPART_HEROS_X, POSITION_DEPART_HEROS_Y,id_map,"sasha",PARQUET,DIRECTION_DEPART_HEROS); game.hero= Heros; /* Demarrage du son */ FMOD_SYSTEM *system; FMOD_SOUND *son; FMOD_System_Create(&system); FMOD_System_Init(system, 7, FMOD_INIT_NORMAL, NULL); FMOD_System_CreateSound(system, "data/music/Menutheme.mp3", FMOD_2D | FMOD_CREATESTREAM | FMOD_LOOP_NORMAL, 0, &son); FMOD_Sound_SetLoopCount(son, -1); FMOD_System_PlaySound(system, son, NULL, 0, NULL); game.pokedex[9]=game.hero.pokemon[0]; game.pokedex[9].vu=1; game.son = son; game.system = system; game.scenario=0; /* Ajout des personnages non jouables du jeu */ addNpc(&game); return game;}
开发者ID:CedricPortaneri,项目名称:Pokemon,代码行数:27,
示例9: FindSamplebool Audio::Play(std::string name){ FMOD_RESULT res; Sample *sample = FindSample(name);//***BUG if (!sample) return false; if (sample->sample != NULL) { try { //sample found, play it res = FMOD_System_PlaySound( system, FMOD_CHANNEL_FREE, sample->sample, true, &sample->channel); if (res!= FMOD_OK) return false; FMOD_Channel_SetLoopCount(sample->channel, -1); FMOD_Channel_SetPaused(sample->channel, false); } catch (...) { return false; } } return true;}
开发者ID:narc0tiq,项目名称:Unnamed-Train-Game,代码行数:29,
示例10: I_StartSoundINT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority){ FMOD_SOUND *sound; FMOD_CHANNEL *chan; INT32 i; float frequency; sound = (FMOD_SOUND *)S_sfx[id].data; I_Assert(sound != NULL); FMR(FMOD_System_PlaySound(fsys, FMOD_CHANNEL_FREE, sound, true, &chan)); if (sep == 0) sep = 1; FMR(FMOD_Channel_SetVolume(chan, (vol / 255.0) * (sfx_volume / 31.0))); FMR(FMOD_Channel_SetPan(chan, (sep - 128) / 127.0)); FMR(FMOD_Sound_GetDefaults(sound, &frequency, NULL, NULL, NULL)); FMR(FMOD_Channel_SetFrequency(chan, (pitch / 128.0) * frequency)); FMR(FMOD_Channel_SetPriority(chan, priority)); //UNREFERENCED_PARAMETER(priority); //FMR(FMOD_Channel_SetPriority(chan, 1 + ((0xff-vol)>>1))); // automatic priority 1 - 128 based on volume (priority 0 is music) FMR(FMOD_Channel_GetIndex(chan, &i)); FMR(FMOD_Channel_SetPaused(chan, false)); return i;}
开发者ID:HipsterLion,项目名称:SRB2,代码行数:29,
示例11: fmodevoid fmode(void){ FMOD_SYSTEM *system; FMOD_SOUND *musique; FMOD_CHANNEL *channel; FMOD_RESULT resultat; char *str; str = "./graphic/Martin Garrix - Animals.mp3"; FMOD_System_Create(&system); FMOD_System_Init(system, 2, FMOD_INIT_NORMAL, NULL); resultat = FMOD_System_CreateSound(system, str, FMOD_SOFTWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &musique); if (resultat != FMOD_OK) { my_printf(2, "Cannot find "); my_printf(2, "%s", str); my_printf(2, ", put this file next to the executable 'corewar'"); write(2, "/n", 1); } else { FMOD_Sound_SetLoopCount(musique, -1); FMOD_System_GetChannel(system, 9, &channel); FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, musique, 0, NULL); }}
开发者ID:MaddDogg0001,项目名称:Corewar,代码行数:27,
示例12: FMOD_System_PlaySoundbool Audio::Play(Sample *sample){ FMOD_RESULT res; if (sample == NULL) return false; if (sample->sample == NULL) return false; try { res = FMOD_System_PlaySound( system, FMOD_CHANNEL_FREE, sample->sample, true, &sample->channel); if (res!= FMOD_OK) return false; FMOD_Channel_SetLoopCount(sample->channel, -1); FMOD_Channel_SetPaused(sample->channel, false); } catch (...) { return false; } return true;}
开发者ID:narc0tiq,项目名称:Unnamed-Train-Game,代码行数:25,
示例13: FMOD_Channel_Stop// ----------------------------------------------------------------------------void ofxSoundPlayerFMOD::play(){ // if it's a looping sound, we should try to kill it, no? // or else people will have orphan channels that are looping if (bLoop == true){ FMOD_Channel_Stop(channel); } // if the sound is not set to multiplay, then stop the current, // before we start another if (!bMultiPlay){ FMOD_Channel_Stop(channel); } FMOD_System_PlaySound(sys, FMOD_CHANNEL_FREE, sound, bPaused, &channel); FMOD_Channel_GetFrequency(channel, &internalFreq); FMOD_Channel_SetVolume(channel,volume); FMOD_Channel_SetPan(channel,pan); FMOD_Channel_SetFrequency(channel, internalFreq * speed); FMOD_Channel_SetMode(channel, (bLoop == true) ? FMOD_LOOP_NORMAL : FMOD_LOOP_OFF); //fmod update() should be called every frame - according to the docs. //we have been using fmod without calling it at all which resulted in channels not being able //to be reused. we should have some sort of global update function but putting it here //solves the channel bug FMOD_System_Update(sys);}
开发者ID:alsdncka,项目名称:digitalstarcode,代码行数:31,
示例14: WStringToString bool ModuleIrisAudio::MePlay(wstring filePath, int volume, int rate){ string sfilepath = WStringToString(filePath); const char* fpath = sfilepath.c_str(); if (channels == 0){ if (meChannel != NULL){ BOOL isPlaying; FMOD_Channel_IsPlaying(meChannel, &isPlaying); if (isPlaying) FMOD_Channel_Stop(meChannel); } } FMOD_RESULT result; result = FMOD_System_CreateStream(fmodSystem, fpath, FMOD_DEFAULT, 0, &me); if (result != FMOD_OK) return false; result = FMOD_System_PlaySound(fmodSystem, FMOD_CHANNEL_FREE, me, true, &meChannel); if (result != FMOD_OK) return false; FMOD_Channel_SetMode(meChannel, FMOD_LOOP_NORMAL); FMOD_Channel_SetVolume(meChannel, volume / 100.0f); float frequancy; FMOD_Channel_GetFrequency(meChannel, &frequancy); FMOD_Channel_SetFrequency(meChannel, frequancy * (rate / 100.0)); FMOD_Channel_SetPaused(meChannel, FALSE); return true; }
开发者ID:HADESAngelia,项目名称:Iris-2D-Project,代码行数:34,
示例15: whitgl_sound_playvoid whitgl_sound_play(int id, float adjust){ int index = -1; int i; for(i=0; i<num_sounds; i++) { if(sounds[i].id == id) { index = i; continue; } } if(index == -1) { WHITGL_LOG("ERR Cannot find sound %d", id); return; } FMOD_RESULT result = FMOD_System_PlaySound(fmodSystem, FMOD_CHANNEL_FREE, sounds[index].sound, true, &sounds[index].channel); _whitgl_sound_errcheck("FMOD_System_PlaySound", result); float defaultFrequency; result = FMOD_Sound_GetDefaults(sounds[index].sound, &defaultFrequency, NULL, NULL, NULL); _whitgl_sound_errcheck("FMOD_Sound_GetDefaults", result); result = FMOD_Channel_SetFrequency(sounds[index].channel, defaultFrequency*adjust); _whitgl_sound_errcheck("FMOD_Channel_SetFrequency", result); result = FMOD_Channel_SetPaused(sounds[index].channel, false); _whitgl_sound_errcheck("FMOD_Channel_SetPaused", result);}
开发者ID:whitingjp,项目名称:ld29,代码行数:29,
示例16: FMOD_System_PlaySoundvoid Sound::Play(bool pause){ FMOD_RESULT s_result = FMOD_OK; s_result = FMOD_System_PlaySound(fmodSystem, FMOD_CHANNEL_FREE, sound, pause, &channel); if(s_result == FMOD_OK && isLooping) FMOD_Channel_SetMode(channel, FMOD_LOOP_NORMAL);}
开发者ID:Vavassor,项目名称:meteor,代码行数:7,
示例17: FMOD_System_PlaySoundvoid Game::playMusic(FMOD_SOUND *music){ if(config.m[MUSIC] == true) { FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, music, 0, &musicChannel); FMOD_Sound_SetLoopCount(music, -1); }}
开发者ID:Shiryu,项目名称:Flocks,代码行数:8,
示例18: mainint main(void){ SDL_Surface *screen = NULL, *viseur = NULL; SDL_Event event; SDL_Rect position; FMOD_SYSTEM *system; FMOD_SOUND *tir = NULL; FMOD_RESULT resultat; int continuer = 1; /*Initiation de FMOD pour le tir du pistolet*/ FMOD_System_Create(&system); FMOD_System_Init(system, 2, FMOD_INIT_NORMAL, NULL); resultat = FMOD_System_CreateSound(system,"gun_shot.mp3",FMOD_CREATESAMPLE, 0, &tir); if(resultat != FMOD_OK) { fprintf(stderr, "Impossible de lire gun_shot.mp3"); exit(EXIT_FAILURE); } /*Initiation de la SDL*/ SDL_Init(SDL_INIT_VIDEO); SDL_ShowCursor(SDL_DISABLE); screen = SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE | SDL_DOUBLEBUF); SDL_WM_SetCaption("Gestion du son avec FMOD", NULL); viseur = IMG_Load("cible.png"); SDL_EnableKeyRepeat(10, 10); while(continuer) { SDL_WaitEvent(&event); switch(event.type) { case SDL_QUIT: continuer = 0; break; case SDL_MOUSEBUTTONDOWN: FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, tir, 0, NULL); break; case SDL_MOUSEMOTION: position.x = event.motion.x - (viseur->w / 2); position.y = event.motion.y - (viseur->h / 2); break; } SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0)); SDL_BlitSurface(viseur, NULL, screen, &position); SDL_Flip(screen); } SDL_FreeSurface(viseur); SDL_Quit(); FMOD_Sound_Release(tir); FMOD_System_Close(system); FMOD_System_Release(system); return EXIT_SUCCESS;}
开发者ID:4charles2,项目名称:langace_c,代码行数:58,
示例19: FMOD_System_PlaySoundvoid Sound::Play(bool pause = false) //No agument is needed to play by default{ if (true == s_enabled) { s_result = FMOD_System_PlaySound(s_fmod_system, FMOD_CHANNEL_FREE, s_sound, pause, &s_channel); assert(s_result == FMOD_OK); FMOD_Channel_SetMode(s_channel, FMOD_LOOP_NORMAL); }}
开发者ID:Guitaroz,项目名称:Go-Fish-Card-Game,代码行数:9,
示例20: FMOD_System_PlaySound// plays a sound (can be started paused; no argument for unpaused)void Sound::play(bool pause){ if (possible && isOn) { result = FMOD_System_PlaySound(fmodsystem, FMOD_CHANNEL_FREE, sound, pause, &channel); FMOD_Channel_SetMode(channel, FMOD_LOOP_NORMAL); }}
开发者ID:jonquach,项目名称:bomberman,代码行数:10,
示例21: exceptionvoid AudioManager::Play( const AudioManager::AudioType Type, const string& ID, const float Volume, const float Pitch, const float Pan, const int32_t LoopCount, const int32_t Priority, const FMOD_CHANNELINDEX ChannelIndex ){ // Create local variables. float Frequency = Null; FMOD_CHANNEL* Channel = nullptr; unordered_map< string, SoundData >::iterator AudioMapIterator; // Check arguments. if( Type == MaxAudioTypes ) throw exception(); // Playback specified audio sample or stream. if( Initialized ) { AudioMapIterator = AudioMaps[ Type ].Instance.find( ID ); if( AudioMapIterator == AudioMaps[ Type ].Instance.end() ) throw exception(); if( FMOD_System_PlaySound( SystemInstance, ChannelIndex, AudioMapIterator->second.Instance, true, &Channel ) != FMOD_OK ) throw exception(); if( FMOD_Channel_SetChannelGroup( Channel, AudioMapIterator->second.Group ) != FMOD_OK ) throw exception(); if( FMOD_Channel_SetLoopCount( Channel, LoopCount ) != FMOD_OK ) throw exception(); if( FMOD_Channel_SetPriority( Channel, Priority ) != FMOD_OK ) throw exception(); if( FMOD_Channel_SetPan( Channel, Pan ) != FMOD_OK ) throw exception(); if( FMOD_Channel_GetFrequency( Channel, &Frequency ) != FMOD_OK ) throw exception(); if( FMOD_Channel_SetFrequency( Channel, ( Frequency * Pitch ) ) != FMOD_OK ) throw exception(); if( FMOD_Channel_SetVolume( Channel, Volume ) != FMOD_OK ) throw exception(); if( FMOD_Channel_SetPaused( Channel, false ) != FMOD_OK ) throw exception(); }}
开发者ID:awillett,项目名称:Team8,代码行数:57,
示例22: playMusicvoid playMusic(const int & n){ result = FMOD_System_PlaySound(sys, FMOD_CHANNEL_FREE, sounds[n], 0, &chan); ERRCHECK(result); FMOD_System_Update(sys); return;}
开发者ID:cscool,项目名称:portal,代码行数:9,
示例23: soundHelicovoid soundHelico(){ if(helico->positionWin.y + HELICO_HEIGHT < POSITION_BOTTOM-5) { if(timeAllowed(&previousTimeSoundHelico, 1300)) FMOD_System_PlaySound(sound_system, 1, sound_helico, 0, &canal_game); } else FMOD_Channel_Stop(canal_game);}
开发者ID:Ryuuke,项目名称:Choplifter,代码行数:10,
示例24: FMOD_System_PlaySoundvoid Systems::SoundSystem::PlaySound(FMOD_CHANNEL** channel, FMOD_SOUND* sound, float volume, bool loop){ FMOD_System_PlaySound(m_System, FMOD_CHANNEL_FREE, sound, false, channel); FMOD_Channel_SetVolume(*channel, volume); if(loop) { FMOD_Channel_SetMode(*channel, FMOD_LOOP_NORMAL); FMOD_Sound_SetLoopCount(sound, -1); }}
开发者ID:Tleety,项目名称:daydream,代码行数:10,
示例25: play void play(){ if(sound){ FMOD_RESULT result = FMOD_System_PlaySound(System, FMOD_CHANNEL_FREE, sound, false, &channel); if(result == FMOD_OK){ FMOD_Channel_SetVolume(channel, Config.EffectVolume); FMOD_System_Update(System); } } }
开发者ID:William8915,项目名称:QSanguosha,代码行数:10,
示例26: play void play(const bool doubleVolume = false) { if (sound) { FMOD_RESULT result = FMOD_System_PlaySound(System, FMOD_CHANNEL_FREE, sound, false, &channel); if (result == FMOD_OK) { FMOD_Channel_SetVolume(channel, (doubleVolume ? 2 : 1) * Config.EffectVolume); FMOD_System_Update(System); } } }
开发者ID:Fsu0413,项目名称:QSanguosha-For-Hegemony,代码行数:11,
注:本文中的FMOD_System_PlaySound函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ FMOD_System_Release函数代码示例 C++ FMOD_System_Init函数代码示例 |