當前位置: 首頁>>代碼示例>>C++>>正文


C++ FMOD_System_Update函數代碼示例

本文整理匯總了C++中FMOD_System_Update函數的典型用法代碼示例。如果您正苦於以下問題:C++ FMOD_System_Update函數的具體用法?C++ FMOD_System_Update怎麽用?C++ FMOD_System_Update使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了FMOD_System_Update函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: 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,代碼來源:ofxSoundPlayerFMOD.cpp

示例2: Java_org_fmod_playsound_Example_cUpdate

void Java_org_fmod_playsound_Example_cUpdate(JNIEnv *env, jobject thiz)
{
	FMOD_RESULT	result = FMOD_OK;

	result = FMOD_System_Update(gSystem);
	CHECK_RESULT(result);
}
開發者ID:mperroteau,項目名稱:Euterpe,代碼行數:7,代碼來源:main.c

示例3: CDA_Update

void CDA_Update (void)
{
#ifdef UQE_FMOD_CDAUDIO

	if(SND_Initialised == false || SND_MusicChannel.inuse == false)
		return;

	FMOD_System_Update(fmod_system);
	SND_MusicChannel.volume = bgmvolume.value;

	if(SND_MusicChannel.volume < 0.0f)
		SND_MusicChannel.volume = 0.0f;

	if(SND_MusicChannel.volume > 1.0f)
		SND_MusicChannel.volume = 1.0f;

	FMOD_Channel_SetVolume(SND_MusicChannel.channel, SND_MusicChannel.volume);


	if(SND_MusicChannel.volume == 0.0f | cl.paused == true)
		CDA_Pause();
	else
		CDA_Resume();

#else
	CDAudio_Update();
#endif
}
開發者ID:infernuslord,項目名稱:uqe-quake,代碼行數:28,代碼來源:snd_fmod.c

示例4: playMusic

void 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,代碼來源:sound.c

示例5: FMOD_System_Update

void FMCSound::stop()
{
    m_has_played = false;

    FMOD_System_Update(m_fmod_system);
    if (m_fmod_channel == 0) return;

    FMOD_Channel_Stop(m_fmod_channel);
}
開發者ID:Rodeo314,項目名稱:vasFMC-Krolock85,代碼行數:9,代碼來源:fmc_sounds.cpp

示例6: 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,代碼來源:audio.cpp

示例7: Update

void Update()
{
	FMOD_RESULT result = FMOD_OK;

	if (gSystem)
	{
		result = FMOD_System_Update(gSystem);
		CHECK_RESULT(result);
	}
}
開發者ID:mperroteau,項目名稱:Euterpe,代碼行數:10,代碼來源:main.c

示例8: Update

void AudioManager::Update()
{
	// Update the audio system.

		if( Initialized )
		{
			if( FMOD_System_Update( SystemInstance ) != FMOD_OK )
				throw exception();
		}
}
開發者ID:awillett,項目名稱:Team8,代碼行數:10,代碼來源:AudioManager.cpp

示例9: 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,代碼來源:audio.cpp

示例10: FMOD_System_CreateStream

void Audio::playBGM(const QString &filename)
{
    FMOD_RESULT result = FMOD_System_CreateStream(System, filename.toLocal8Bit(), FMOD_LOOP_NORMAL, NULL, &BGM);

    if (result == FMOD_OK) {
        FMOD_Sound_SetLoopCount(BGM, -1);
        FMOD_System_PlaySound(System, FMOD_CHANNEL_FREE, BGM, false, &BGMChannel);

        FMOD_Channel_SetVolume(BGMChannel, Config.BGMVolume);
        FMOD_System_Update(System);
    }
}
開發者ID:Fsu0413,項目名稱:QSanguosha-For-Hegemony,代碼行數:12,代碼來源:audio.cpp

示例11: FMOD_System_Update

void Sound::Update()
{
	FMOD_System_Update(fmodSystem);

	for(int i = 0; i < MAX_SOUNDS; i++)
	{
		Sound* sound = sounds[i];
		if(sound == nullptr) continue;

		if(sound->onlyPlayOnce && !sound->Is_Playing())
			Destroy_Sound(sound);
	}
}
開發者ID:Vavassor,項目名稱:meteor,代碼行數:13,代碼來源:Sound.cpp

示例12: sound_play

void		sound_play(eSound snd, float vol, float pan, float freq)
{
    static Sound*	s;

    if (!s)
        s = &((Data*)SDLazy_GetData())->sound;

    FMOD_System_PlaySound(s->system, FMOD_CHANNEL_FREE, s->mp3[snd], 0, &s->chan);
    FMOD_Channel_SetVolume(s->chan, vol);
    FMOD_Channel_SetPan(s->chan, pan);
    FMOD_Channel_SetFrequency(s->chan, freq);

    FMOD_System_Update(s->system);
}
開發者ID:AntoineBt,項目名稱:Shoot-em-Up-SDL-2D,代碼行數:14,代碼來源:sound.c

示例13: Java_org_fmod_realtimestitching_Example_cUpdate

void Java_org_fmod_realtimestitching_Example_cUpdate(JNIEnv *env, jobject thiz)
{
	FMOD_RESULT	result = FMOD_OK;

    /*
        Replace the subsound that just finished with a new subsound, to create endless seamless stitching!

        Note that this polls the currently playing subsound using the FMOD_TIMEUNIT_BUFFERED flag.
        Remember streams are decoded / buffered ahead in advance!
        Don't use the 'audible time' which is FMOD_TIMEUNIT_SENTENCE_SUBSOUND by itself.  When streaming, sound is
        processed ahead of time, and things like stream buffer / sentence manipulation (as done below) is required
        to be in 'buffered time', or else there will be synchronization problems and you might end up releasing a
        sub-sound that is still playing!
    */
    result = FMOD_Channel_GetPosition(gChannel, &gCurrentSubSoundID, (FMOD_TIMEUNIT)(FMOD_TIMEUNIT_SENTENCE_SUBSOUND | FMOD_TIMEUNIT_BUFFERED));
    CHECK_RESULT(result);

    if (gCurrentSubSoundID != gSubSoundID)
    {
        /*
            Release the sound that isn't playing any more.
        */
        result = FMOD_Sound_Release(gSubSound[gSubSoundID]);
        CHECK_RESULT(result);

        /*
            Replace it with a new sound in our list.
        */
        result = FMOD_System_CreateStream(gSystem, gSoundName[gSentenceID], FMOD_DEFAULT, 0, &gSubSound[gSubSoundID]);
        CHECK_RESULT(result);

        result = FMOD_Sound_SetSubSound(gSound, gSubSoundID, gSubSound[gSubSoundID]);
        CHECK_RESULT(result);

        sprintf(s, "Replacing subsound %d / 2 with sound %d / %d\n", gSubSoundID, gSentenceID, NUMSOUNDS);
        __android_log_write(ANDROID_LOG_INFO, "fmod_realtimestitching", s);

        gSentenceID++;
        if (gSentenceID >= NUMSOUNDS)
        {
            gSentenceID = 0;
        }

        gSubSoundID = gCurrentSubSoundID;
    }

	result = FMOD_System_Update(gSystem);
	CHECK_RESULT(result);
}
開發者ID:mperroteau,項目名稱:Euterpe,代碼行數:49,代碼來源:main.c

示例14: FMOD_System_Update

void SSVisualizer::UpdateUserLayer( const float deltaTime ) {
	// Perform non-simulation update logic here (Don't forget to set update order priority!)
	FMOD_System_Update(m_SoundSystem);
	//Get spectrum data
	PROFILE(AutoProfiler memAllocProfiler("VisualizerAllocation", Profiler::PROFILER_CATEGORY_STANDARD, true, true));
#ifdef USE_STACK_ALLOC
	float* leftSpectrum = (float*)m_Allocator->Allocate(sizeof(float) * SPECTRUM_SIZE);
	float* rightSpectrum = (float*)m_Allocator->Allocate(sizeof(float) * SPECTRUM_SIZE);
	Particle2* particles = (Particle2*)m_Allocator->Allocate(sizeof(Particle2) * SPECTRUM_SIZE);
#else
	float* leftSpectrum = (float*)malloc(sizeof(float) * SPECTRUM_SIZE);
	float* rightSpectrum = (float*)malloc(sizeof(float) * SPECTRUM_SIZE);
	Particle2* particles = (Particle2*)malloc(sizeof(Particle2) * SPECTRUM_SIZE);
#endif
	PROFILE(memAllocProfiler.Stop());

	FMOD_Channel_GetSpectrum(m_Channel, leftSpectrum, SPECTRUM_SIZE, 0, FMOD_DSP_FFT_WINDOW_TRIANGLE);
	FMOD_Channel_GetSpectrum(m_Channel, rightSpectrum, SPECTRUM_SIZE, 1, FMOD_DSP_FFT_WINDOW_TRIANGLE);
	int res = 8;
	float maxH;
	for (int i = 0; i < SPECTRUM_SIZE / res; ++i) {
		float h = -0.5f + glm::max((rightSpectrum[i] + rightSpectrum[i]) * 5.0f - 0.04f, 0.0f) + 0.015f;
		maxH = glm::max(h + 0.5f, maxH);
		for (int k = 0; k < res; k++) {
			int index = i * res + k;
			particles[index].Pos = glm::vec4((index / (float)SPECTRUM_SIZE) * 2.0f - 1.0f, h, 0.1f, 1);
			particles[index].Color = m_Color;
		}
	}
	maxH = glm::max(maxH, 0.0f);
	m_Color = glm::vec4(1.0f, 0.0f, 0.0f, 1.0f) * maxH + glm::vec4(0.0f, 0.0f, 1.0f, 1.0f) * (1.0f - maxH);
	glBindBuffer(GL_ARRAY_BUFFER, m_VBO);
	glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(Particle2) * SPECTRUM_SIZE, particles);
	m_RenderProgram.Apply();
	glBindBuffer(GL_ARRAY_BUFFER, m_VBO);
	glBindVertexArray(m_VAO);
	glDrawArrays(GL_LINE_STRIP, 0, SPECTRUM_SIZE);

	PROFILE(AutoProfiler memDellocProfiler("VisualizerDeallocation", Profiler::PROFILER_CATEGORY_STANDARD, true, true));
#ifdef USE_STACK_ALLOC
	m_Allocator->Unwind(m_Marker);
#else
	free(leftSpectrum);
	free(rightSpectrum);
	free(particles);
#endif
	PROFILE(memDellocProfiler.Stop());
}
開發者ID:toimelin,項目名稱:gameenginecourse2015,代碼行數:48,代碼來源:SSVisualizer.cpp

示例15: FMOD_CHECK

	void AudioPlayer::update( unsigned time )
	{
		FMOD_CHECK( FMOD_System_Update( mFmodSys ) );

		for( unsigned i = 0 ; i < MaxNumChannel ; ++i )
		{
			if ( mChannels[ i ] == NULL )
				continue;

			FMOD_BOOL isPlaying;
			if ( FMOD_Channel_IsPlaying( mChannels[i] , &isPlaying ) == FMOD_OK )
			{
				if ( !isPlaying )
					mChannels[i] = NULL;
			}
		}
	}
開發者ID:uvbs,項目名稱:GameProject,代碼行數:17,代碼來源:AudioPlayer.cpp


注:本文中的FMOD_System_Update函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。