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


C++ Mix_FadeOutChannel函数代码示例

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


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

示例1: mrb_sdl2_mixer_fade_out_channel

static mrb_value
mrb_sdl2_mixer_fade_out_channel(mrb_state *mrb, mrb_value self)
{
  mrb_int which, ms;
  mrb_get_args(mrb, "ii", &which, &ms);
  return mrb_fixnum_value(Mix_FadeOutChannel(which, ms));
}
开发者ID:Moon4u,项目名称:mruby-sdl2-mixer,代码行数:7,代码来源:sdl2-mixer.c

示例2: Fadeout_Sounds

void cAudio :: Fadeout_Sounds( unsigned int ms, std::string filename, bool overwrite_fading /* = 0 */ )
{
	if( !m_sound_enabled || !m_initialised )
	{
		return;
	}

	// add sound directory
	if( filename.find( DATA_DIR "/" GAME_SOUNDS_DIR "/" ) == std::string::npos )
	{
		filename.insert( 0, DATA_DIR "/" GAME_SOUNDS_DIR "/" );
	}

	// get all sounds
	for( AudioSoundList::const_iterator itr = m_active_sounds.begin(); itr != m_active_sounds.end(); ++itr )
	{
		// get object pointer
		const cAudio_Sound *obj = (*itr);

		// filename does not match
		if( obj->m_data->m_filename.compare( filename ) != 0 )
		{
			continue;
		}

		// Do not fade out the sound again
		if( !overwrite_fading && Is_Sound_Fading( obj->m_channel ) == MIX_FADING_OUT )
		{
			continue;
		}

		Mix_FadeOutChannel( obj->m_channel, ms );
	}
}
开发者ID:120pulsations,项目名称:SMC,代码行数:34,代码来源:audio.cpp

示例3: MG_sprite_play_music

void MG_sprite_play_music( SPRITE * self )
{
	if( !self->anim || !self->anim->music )
		return;

	int expire = self->anim->delay*self->anim->count;

	if( self->audio_state.channel < 0 )
	{
		self->audio_state.channel = Mix_PlayChannel( -1 , self->anim->music , -1 );
		self->audio_state.played_time = 0;
		return;
	}

	self->audio_state.played_time += MG_get_system_dt();
	if( self->audio_state.played_time >= expire ){
		if( Mix_Playing( self->audio_state.channel ) ){
//			Mix_HaltChannel( self->audio_state.channel );
			Mix_FadeOutChannel( self->audio_state.channel , MG_get_system_dt()*2 );
		}

		self->audio_state.channel = -1;

		if( self->audio_state.repeat ){
			MG_sprite_play_music( self );
		}

	}

}
开发者ID:mafiosso,项目名称:mgean,代码行数:30,代码来源:audio.c

示例4: FadeOut

bool Sample::FadeOut(float seconds) {
	int ret;
	if (m_Channel == -1) return false;
	ret=Mix_FadeOutChannel(m_Channel,(int)(seconds*1000.0f));
	if (ret) return false;
	return true;
}
开发者ID:nuvie,项目名称:nuvie,代码行数:7,代码来源:Sample.cpp

示例5: Mix_FadeOutChannel

/* Fade out a channel and then stop it automatically */
int Mix_FadeOutChannel(int which, int ms)
{
	int status;

	status = 0;
	if ( audio_opened ) {
		if ( which == -1 ) {
			int i;

			for ( i=0; i<num_channels; ++i ) {
				status += Mix_FadeOutChannel(i, ms);
			}
		} else if ( which < num_channels ) {
			SDL_LockAudio();
			if ( mix_channel[which].playing && 
			    (mix_channel[which].volume > 0) &&
			    (mix_channel[which].fading != MIX_FADING_OUT) ) {
				mix_channel[which].fade_volume = mix_channel[which].volume;
				mix_channel[which].fading = MIX_FADING_OUT;
				mix_channel[which].fade_length = ms;
				mix_channel[which].ticks_fade = SDL_GetTicks();

				/* only change fade_volume_reset if we're not fading. */
				if (mix_channel[which].fading == MIX_NO_FADING) {
				    mix_channel[which].fade_volume_reset = mix_channel[which].volume;
				}
				++status;
			}
			SDL_UnlockAudio();
		}
	}
	return(status);
}
开发者ID:iaco79,项目名称:IrrGameDemo,代码行数:34,代码来源:mixer.c

示例6: Mix_FadeOutChannel

void SoundChunk::fadeOut(int ms)
{
	if (mCurrentChanel >= 0)
	{
		Mix_FadeOutChannel(mCurrentChanel, ms);
		mCurrentChanel = -1;
	}
}
开发者ID:simonkwong,项目名称:Shamoov,代码行数:8,代码来源:Sound.cpp

示例7: Mix_FadeOutChannel

void
vsSoundSystem::StopChannel( int channel )
{
#if !TARGET_OS_IPHONE
	if ( channel != -1 )
		Mix_FadeOutChannel( channel, 500 );
#endif
}
开发者ID:vectorstorm,项目名称:vectorstorm,代码行数:8,代码来源:VS_SoundSystem.cpp

示例8: AudioSequence

/**
 * Play the intro.
 */
void IntroState::init()
{
	State::init();
	Options::keepAspectRatio = _wasLetterBoxed;
	if (CrossPlatform::fileExists(_introFile) && (CrossPlatform::fileExists(_introSoundFileDOS) || CrossPlatform::fileExists(_introSoundFileWin)))
	{
		audioSequence = new AudioSequence(_game->getResourcePack());
		Flc::flc.realscreen = _game->getScreen();
		Flc::FlcInit(_introFile.c_str());
		Flc::flc.dx = (Options::baseXResolution - Screen::ORIGINAL_WIDTH) / 2;
		Flc::flc.dy = (Options::baseYResolution - Screen::ORIGINAL_HEIGHT) / 2;
		Flc::flc.loop = 0; // just the one time, please
		Flc::FlcMain(&audioHandler);
		Flc::FlcDeInit();
		delete audioSequence;


#ifndef __NO_MUSIC
		// fade out!
		Mix_FadeOutChannel(-1, 45 * 20);
		if (Mix_GetMusicType(0) != MUS_MID) { Mix_FadeOutMusic(45 * 20); func_fade(); } // SDL_Mixer has trouble with native midi and volume on windows, which is the most likely use case, so [email protected]%# it.
		else { Mix_HaltMusic(); }
#endif

		SDL_Color pal[256];
		SDL_Color pal2[256];
		memcpy(pal, _game->getScreen()->getPalette(), sizeof(SDL_Color) * 256);
		for (int i = 20; i > 0; --i)
		{
			SDL_Event event;
			if (SDL_PollEvent(&event) && event.type == SDL_KEYDOWN) break;
			for (int color = 0; color < 256; ++color)
			{
				pal2[color].r = (((int)pal[color].r) * i) / 20;
				pal2[color].g = (((int)pal[color].g) * i) / 20;
				pal2[color].b = (((int)pal[color].b) * i) / 20;
				pal2[color].unused = pal[color].unused;
			}
			_game->getScreen()->setPalette(pal2, 0, 256, true);
			_game->getScreen()->flip();
			SDL_Delay(45);
		}
		_game->getScreen()->clear();
		_game->getScreen()->flip();
		Options::musicVolume = _oldMusic;
		Options::soundVolume = _oldSound;
		_game->setVolume(Options::soundVolume, Options::musicVolume, Options::uiVolume);

#ifndef __NO_MUSIC
		Sound::stop();
		Music::stop();
#endif
	}
	Screen::updateScale(Options::geoscapeScale, Options::geoscapeScale, Options::baseXGeoscape, Options::baseYGeoscape, true);
	_game->getScreen()->resetDisplay(false);
	_game->setState(new MainMenuState);
}
开发者ID:AMDmi3,项目名称:OpenXcom,代码行数:60,代码来源:IntroState.cpp

示例9: snd_halt_chan

void snd_halt_chan(int han, int ms)
{
	if (han >= MIX_CHANNELS)
		han %= MIX_CHANNELS;
	if (ms)
		Mix_FadeOutChannel(han, ms);
	else {
		Mix_HaltChannel(han);
	}
}
开发者ID:wimh,项目名称:instead,代码行数:10,代码来源:sound.c

示例10: Mix_FadeOutGroup

/* Halt playing of a particular group of channels */
int Mix_FadeOutGroup(int tag, int ms)
{
	int i;
	int status = 0;
	for ( i=0; i<num_channels; ++i ) {
		if( mix_channel[i].tag == tag ) {
			status += Mix_FadeOutChannel(i,ms);
		}
	}
	return(status);
}
开发者ID:iaco79,项目名称:IrrGameDemo,代码行数:12,代码来源:mixer.c

示例11: Mix_FadeOutMusic

int Musica::fadeOutSonMus(int ms)
{

    if (esMusica)
    {
        return Mix_FadeOutMusic(ms);
    }
    else
    {
        return Mix_FadeOutChannel(-1, ms);
    }
}
开发者ID:jonlazaro,项目名称:tetris-revivalpp,代码行数:12,代码来源:cMusica.cpp

示例12: lua_Mix_FadeOutChannel

	static int lua_Mix_FadeOutChannel(State & state){
		Stack * stack = state.stack;
		int channel = -1;
		int ms = 0;
		if (stack->is<LUA_TNUMBER>(1)){
			channel = stack->to<int>(1);
		}
		if (stack->is<LUA_TNUMBER>(2)){
			ms = stack->to<int>(2);
		}
		stack->push<int>(Mix_FadeOutChannel(channel, ms));
		return 1;
	}
开发者ID:soulik,项目名称:LuaSDL-2.0,代码行数:13,代码来源:sdl_mixer.cpp

示例13: stop_thrust

void stop_thrust(void)
{
#ifndef NOSOUND
#ifdef ARGS
	if (sound_arg)
	{
#endif
	Mix_FadeOutChannel(1,1000);
#ifdef ARGS
	}
#endif
#endif
}
开发者ID:dmitrysmagin,项目名称:vorton,代码行数:13,代码来源:audio.c

示例14: Mix_FadeOutChannel

  void SoundManager::launchBackGroundMusic(const std::string & filename){
    //If a background music is running
    if(m_BackgroundMusic != NULL){
      Mix_FadeOutChannel(0, 1000);
    }
    Mix_HaltChannel(0);
    destroySound(&m_BackgroundMusic);
    loadSound(&m_BackgroundMusic, filename);
    if(m_BackgroundMusic != NULL){
      	if(Mix_FadeInChannel(0, m_BackgroundMusic, -1, 1000) == -1){
	  std::cout << "SOUNDMANAGER : Impossible to play : " << filename << std::endl;
	} 
    } 
  }
开发者ID:flair2005,项目名称:MarinesSaveTheQueen,代码行数:14,代码来源:SoundManager.cpp

示例15: Mix_FadeOutChannel

void AudioMixer::fade_out_all()
{
	cout << "fading out" << endl;
	Mix_FadeOutChannel(-1, 500);
	Mix_FadeOutMusic(500);
	
	sfx_on = false;
	music_on = false;
	
	list<AudioFile*>::iterator iter;
	for (iter = audio_files.begin() ; iter != audio_files.end() ; iter++) {
		(*iter)->toggle_mute();
	}
}
开发者ID:joebain,项目名称:joebabies,代码行数:14,代码来源:AudioMixer.cpp


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