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


C++ FMOD_Channel_SetPaused函数代码示例

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


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

示例1: FMOD_Channel_GetPaused

void SoundEngine::togglePauseChannel(unsigned int channel)
{
    FMOD_BOOL etat;
    FMOD_CHANNEL *canal=getChannel(channel);
    FMOD_Channel_GetPaused(canal, &etat);

    if (etat == 1) // Si la chanson est en pause
        FMOD_Channel_SetPaused(canal, 0); // On enlève la pause
    else // Sinon, elle est en cours de lecture
        FMOD_Channel_SetPaused(canal, 1); // On met en pause
}
开发者ID:bsignoret,项目名称:Bomberman-like-reseau,代码行数:11,代码来源:SoundEngine.cpp

示例2: while

	void ModuleIrisAudio::FadeBgmThreadProc(int duration){
		bgmIsFading = true;
		int time = duration;
		while (time >= 0){
			float v;
			FMOD_Channel_SetPaused(bgmChannel, true);
			FMOD_Channel_GetVolume(bgmChannel, &v);
			FMOD_Channel_SetVolume(bgmChannel, v - v / (duration / 1000));
			time -= 1000;
			FMOD_Channel_SetPaused(bgmChannel, false);
			Sleep(1000);
		}
		FMOD_Channel_Stop(bgmChannel);
		bgmIsFading = false;
	}
开发者ID:HADESAngelia,项目名称:Iris-2D-Project,代码行数:15,代码来源:ModuleIrisAudio.cpp

示例3: 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,代码来源:ModuleIrisAudio.cpp

示例4: FindSample

bool 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,代码来源:audio.cpp

示例5: FMOD_Channel_SetPaused

// ----------------------------------------------------------------------------
void ofxSoundPlayerFMOD::setPaused(bool bP)
{
	if (getIsPlaying() == true){
		FMOD_Channel_SetPaused(channel,bP);
		bPaused = bP;
	}
}
开发者ID:alsdncka,项目名称:digitalstarcode,代码行数:8,代码来源:ofxSoundPlayerFMOD.cpp

示例6: FMOD_Channel_GetPaused

// toggles pause/unpause
void Sound::togglePause(void)
{
  FMOD_BOOL p;

  FMOD_Channel_GetPaused(channel, &p);
  FMOD_Channel_SetPaused(channel, !p);
}
开发者ID:jonquach,项目名称:bomberman,代码行数:8,代码来源:Sound.cpp

示例7: FMOD_System_PlaySound

bool 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,代码来源:audio.cpp

示例8: I_StartSound

INT32 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,代码来源:win_snd.c

示例9: whitgl_sound_play

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

示例10: sound_toggle_pause

void sound_toggle_pause(void)
{
    if (loaded) {
        FMOD_BOOL p;
        FMOD_Channel_GetPaused(_channel,&p);
        FMOD_Channel_SetPaused (_channel,!p);
    }
}
开发者ID:SailorOnDaTea,项目名称:kissplayer,代码行数:8,代码来源:sound.cpp

示例11: exception

void 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,代码来源:AudioManager.cpp

示例12: FMOD_Channel_GetPaused

void Audio::pauseMusique() {
	if(!_canalMusique)
		return;
	
	FMOD_BOOL pause;
	FMOD_Channel_GetPaused(_canalMusique, &pause);
	
	FMOD_Channel_SetPaused(_canalMusique, !pause);
}
开发者ID:rems4e,项目名称:Projet2MIC,代码行数:9,代码来源:Audio.cpp

示例13: FMOD_Sound_Release

void Sound::load() {
    if (loaded) {
        FMOD_Sound_Release(audio);
    }
    char *path = &location[0u];
    FMOD_System_CreateSound(system, path, FMOD_SOFTWARE, 0, &audio);
    FMOD_Channel_SetChannelGroup(channel, channelGroup);
    FMOD_Channel_SetPaused(channel, true);
    loaded = true;
}
开发者ID:andreisergiu98,项目名称:squarly-hoop,代码行数:10,代码来源:Sound.cpp

示例14: set_paused

void set_paused(FMOD_CHANNEL **channel, int paused)
{
    FMOD_RESULT result;
    unsigned int blocksize;
    
    result = FMOD_System_GetDSPBufferSize(gSystem, &blocksize, 0);
    ERRCHECK(result);

    if (!paused)
    {
        unsigned int pausestart_hi = 0, pausestart_lo = 0;

        FMOD_System_GetDSPClock(gSystem, &pausestart_hi, &pausestart_lo);
        
        FMOD_64BIT_ADD(pausestart_hi, pausestart_lo, 0, blocksize * 2);   /* Into the future by 2 mixer blocks. */
        printf("\npause BOTH at %d \n", pausestart_lo);
       
        /* Make them both pause at exactly the same tick.  Mute them both to avoid a click as well. */
        FMOD_Channel_SetMute(channel[0], TRUE);
        FMOD_Channel_SetDelay(channel[0], FMOD_DELAYTYPE_DSPCLOCK_PAUSE, pausestart_hi, pausestart_lo);
        FMOD_Channel_SetMute(channel[1], TRUE);
        FMOD_Channel_SetDelay(channel[1], FMOD_DELAYTYPE_DSPCLOCK_PAUSE, pausestart_hi, pausestart_lo);
    }
    else
    {
        unsigned int syshi, syslo;
        int count;

        FMOD_System_GetDSPClock(gSystem, &syshi, &syslo);

        printf("\nunpause BOTH at %d\n", syslo);
        
        for (count = 0; count < 2; count++)
        { 
            unsigned int starttime_hi, starttime_lo; 
            unsigned int pausetime_hi = 0, pausetime_lo = 0;
            unsigned int hi = syshi, lo = syslo;
            
            FMOD_Channel_GetDelay(channel[count], FMOD_DELAYTYPE_DSPCLOCK_PAUSE, &pausetime_hi, &pausetime_lo);
            FMOD_Channel_GetDelay(channel[count], FMOD_DELAYTYPE_DSPCLOCK_START, &starttime_hi, &starttime_lo);

            FMOD_64BIT_ADD(hi, lo, 0, blocksize * 2);                   /* Push operation into the future by 2 mixer blocks so it doesnt conflict with mixer. */
            if (starttime_lo > pausetime_lo)                            /* Was already playing, unpause immediately. */
            {
                FMOD_64BIT_ADD(hi, lo, starttime_hi, starttime_lo);     /* Push forward the delayed start by the gap between starting and pausing */
                FMOD_64BIT_SUB(hi, lo, pausetime_hi, pausetime_lo);     /* Push forward the delayed start by the gap between starting and pausing */
            }
            printf("restart %d at %d\n", count, lo);
            FMOD_Channel_SetDelay(channel[count], FMOD_DELAYTYPE_DSPCLOCK_PAUSE, 0, 0);
            FMOD_Channel_SetDelay(channel[count], FMOD_DELAYTYPE_DSPCLOCK_START, hi, lo);
            FMOD_Channel_SetMute(channel[count], FALSE);
            FMOD_Channel_SetPaused(channel[count], FALSE);
        }
    }
}
开发者ID:chandonnet,项目名称:FTB2015,代码行数:55,代码来源:main.c

示例15: Java_org_fmod_realtimestitching_Example_cPause

void Java_org_fmod_realtimestitching_Example_cPause(JNIEnv *env, jobject thiz)
{
	FMOD_RESULT result = FMOD_OK;
	FMOD_BOOL paused = 0;

	result = FMOD_Channel_GetPaused(gChannel, &paused);
	CHECK_RESULT(result);

	result = FMOD_Channel_SetPaused(gChannel, !paused);
	CHECK_RESULT(result);
}
开发者ID:mperroteau,项目名称:Euterpe,代码行数:11,代码来源:main.c


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