• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ FMOD_System_Update函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了FMOD_System_Update函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: MOD_Update

void MOD_Update (void)
{
	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)
		MOD_Pause();
	else
		MOD_Resume();
}
开发者ID:infernuslord,项目名称:uqe-quake,代码行数:21,代码来源:snd_fmod.c


示例17: FMOD_System_GetChannelsPlaying

void Audio::stop()
{
    if (System == NULL) return;

    int n;
    FMOD_System_GetChannelsPlaying(System, &n);

    QList<FMOD_CHANNEL *> channels;
    for (int i = 0; i < n; i++) {
        FMOD_CHANNEL *channel;
        FMOD_RESULT result = FMOD_System_GetChannel(System, i, &channel);
        if (result == FMOD_OK) channels << channel;
    }

    foreach (FMOD_CHANNEL * const &channel, channels)
        FMOD_Channel_Stop(channel);

    stopBGM();

    FMOD_System_Update(System);
}
开发者ID:Fsu0413,项目名称:QSanguosha-For-Hegemony,代码行数:21,代码来源:audio.cpp


示例18: main

int main(int argc, char **argv)
{
	setup_ui(&argc, &argv);

	FMOD_SOUND *soundtrack;
	FMOD_CHANNEL *channel1;

	FMOD_VECTOR position = { 0, 0, 0 };
	FMOD_VECTOR velocity = { 0, 0, 0 };
	FMOD_VECTOR forward = { 0, 0, 1 };
	FMOD_VECTOR up = { 0, 1, 0 };

	FMOD_System_Create(&fsystem);
	FMOD_System_Init(fsystem, 100, FMOD_INIT_NORMAL, NULL);
	FMOD_System_Set3DSettings(fsystem, 1.0f, 1.0f, 1.0f);

	FMOD_System_CreateSound(fsystem, argc < 2 ? "../sounds/blast.wav" : argv[1], FMOD_3D | FMOD_LOOP_NORMAL, 0, &soundtrack);
	FMOD_System_PlaySound(fsystem, soundtrack, NULL, 1, &channel1);
	FMOD_Channel_Set3DAttributes(channel1, &position, &velocity, NULL);
	FMOD_Channel_SetPaused(channel1, 0);

	FMOD_System_Set3DListenerAttributes(fsystem, 0, &position, &velocity, &forward, &up);
	FMOD_System_Update(fsystem);

	gtk_main();

	/*int i = 0;
	while (i < 500) {
		i++;
		FMOD_System_Update(fsystem);

		struct timespec sleepTime = { 0, 50 * 1000 * 1000 };
		nanosleep(&sleepTime, NULL);
	}*/

	FMOD_Sound_Release(soundtrack);
	FMOD_System_Close(fsystem);
	FMOD_System_Release(fsystem);
}
开发者ID:tom95,项目名称:TOMSpaceshooter,代码行数:39,代码来源:fmod-reverb.c


示例19: FMOD_System_Update

void Systems::SoundSystem::Update(double dt)
{
	FMOD_System_Update(m_System);
	
	//Delete sounds. Not until it's done playing
	std::map<EntityID, FMOD_CHANNEL*>::iterator it;
	for(it = m_DeleteChannels.begin(); it != m_DeleteChannels.end();)
	{
		FMOD_Channel_IsPlaying(it->second, &m_isPlaying);
		if(m_isPlaying)
		{
			it++;
		}
		else
		{
// 			FMOD_Sound_Release(m_DeleteSounds[it->first]);
 			m_DeleteSounds.erase(it->first);
			it = m_DeleteChannels.erase(it);
		}

	}
	//LOG_INFO("Antal emitters i listan: %i", m_Channels.size());

	for(it = m_Channels.begin(); it != m_Channels.end();)
	{
		FMOD_Channel_IsPlaying(it->second, &m_isPlaying);
		if(!m_isPlaying)
		{
			it = m_Channels.erase(it);			
		}
		else
		{
			it++;
		}
	}
}
开发者ID:Tleety,项目名称:daydream,代码行数:36,代码来源:SoundSystem.cpp


示例20: main


//.........这里部分代码省略.........

    printf("Press 'Esc' to quit\n");
    printf("\n");

    fp = fopen("record.wav", "wb");
    if (!fp)
    {
        printf("ERROR : could not open record.wav for writing.\n");
        return 1;
    }

    /*
        Write out the wav header.  As we don't know the length yet it will be 0.
    */
    WriteWavHeader(fp, sound, datalength);

    result = FMOD_Sound_GetLength(sound, &soundlength, FMOD_TIMEUNIT_PCM);
    ERRCHECK(result);

    /*
        Main loop.
    */
    do
    {
        static unsigned int lastrecordpos = 0;
        unsigned int recordpos = 0;

        if (_kbhit())
        {
            key = _getch();
        }

        FMOD_System_GetRecordPosition(system, recorddriver, &recordpos);
        ERRCHECK(result);

        if (recordpos != lastrecordpos)        
        {
            void *ptr1, *ptr2;
            int blocklength;
            unsigned int len1, len2;
            
            blocklength = (int)recordpos - (int)lastrecordpos;
            if (blocklength < 0)
            {
                blocklength += soundlength;
            }

            /*
                Lock the sound to get access to the raw data.
            */
            FMOD_Sound_Lock(sound, lastrecordpos * exinfo.numchannels * 2, blocklength * exinfo.numchannels * 2, &ptr1, &ptr2, &len1, &len2);   /* * exinfo.numchannels * 2 = stereo 16bit.  1 sample = 4 bytes. */

            /*
                Write it to disk.
            */
            if (ptr1 && len1)
            {
                datalength += fwrite(ptr1, 1, len1, fp);
            }
            if (ptr2 && len2)
            {
                datalength += fwrite(ptr2, 1, len2, fp);
            }

            /*
                Unlock the sound to allow FMOD to use it again.
            */
            FMOD_Sound_Unlock(sound, ptr1, ptr2, len1, len2);
        }

        lastrecordpos = recordpos;

        printf("%-23s. Record buffer pos = %6d : Record time = %02d:%02d\r", (timeGetTime() / 500) & 1 ? "Recording to record.wav" : "", recordpos, datalength / exinfo.defaultfrequency / exinfo.numchannels / 2 / 60, (datalength / exinfo.defaultfrequency / exinfo.numchannels / 2) % 60);

        FMOD_System_Update(system);

        Sleep(10);

    } while (key != 27);

    printf("\n");

    /*
        Write back the wav header now that we know its length.
    */
    WriteWavHeader(fp, sound, datalength);

    fclose(fp);

    /*
        Shut down
    */
    result = FMOD_Sound_Release(sound);
    ERRCHECK(result);

    result = FMOD_System_Release(system);
    ERRCHECK(result);

    return 0;
}
开发者ID:Guitaroz,项目名称:Arcade-Space-Shooter,代码行数:101,代码来源:main.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FMR_ASSERT函数代码示例发布时间:2022-05-30
下一篇:
C++ FMOD_System_Release函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap