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

C++ Mix_FadeOutChannel函数代码示例

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

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



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


示例16: Mix_FadeOutMusicCh

void ChannelInternalState::FadeOut(int milliseconds) {
  int channels_halted;
  if (IsStream()) {
#ifdef PINDROP_MULTISTREAM
    channels_halted = Mix_FadeOutMusicCh(channel_id_, milliseconds);
#else
    channels_halted = Mix_FadeOutMusic(milliseconds);
#endif  // PINDROP_MULTISTREAM
  } else {
    channels_halted = Mix_FadeOutChannel(channel_id_, milliseconds);
  }
  if (channels_halted == 0) {
    SDL_LogError(SDL_LOG_CATEGORY_ERROR, "Error halting channel %i\n");
  }
}
开发者ID:WangCrystal,项目名称:pindrop,代码行数:15,代码来源:channel_internal_state.cpp


示例17: rg_sound_fadeout

/*
 *  call-seq:
 *    fade_out( fade_time )  ->  self
 *
 *  Fade out to silence over the given number of seconds. Once the sound
 *  is silent, it is automatically stopped.
 *
 *  Returns::     The receiver (self).
 *
 *  **NOTE**: If the sound is currently paused, the fade will start,
 *  but you won't be able to hear it happening unless you #unpause during
 *  the fade. Does nothing if the sound is currently stopped.
 *
 */
static VALUE rg_sound_fadeout( VALUE self, VALUE fade_time )
{
	RG_Sound *sound;
	Data_Get_Struct(self,  RG_Sound, sound);

	int channel = sound->channel;
	int fade_ms = (int)(1000 * NUM2DBL(fade_time));

	/* Make sure the sound actually belongs to the channel */
	if( _rg_sound_channel_check(sound) )
	{
		Mix_FadeOutChannel( channel, fade_ms );
	}

	return self;
}
开发者ID:atiaxi,项目名称:rubygame,代码行数:30,代码来源:rubygame_sound.c


示例18: FadeOutSounds

void cAudio :: FadeOutSounds( unsigned int ms /* = 200 */, int channel /* = -1 */, bool overwrite_fading /* = 0  */ )
{
	if( !bSounds || !bInitialised )
	{
		return;
	}

	if( Mix_Playing( channel ) ) // Check the Channels
	{
		if( !overwrite_fading && isSoundFading( - 1 ) == 2 )
		{
			return; // Do not fade the Sound out again
		}

		Mix_FadeOutChannel( channel, ms );
	}
}
开发者ID:Arikado,项目名称:Wii-Homebrew,代码行数:17,代码来源:audio.cpp


示例19: Mix_FadeOutMusic

int BEE::Sound::fade_out(int ticks) {
	if (!is_loaded) {
		if (!has_play_failed) {
			game->messenger_send({"engine", "sound"}, BEE_MESSAGE_WARNING, "Failed to fade out sound \"" + name + "\" because it is not loaded");
			has_play_failed = true;
		}
		return 1;
	}

	is_playing = false;
	is_looping = false;

	if (is_music) {
		Mix_FadeOutMusic(ticks);
	} else {
		std::list<int> tmp_channels = current_channels;
		for (auto i=tmp_channels.begin(); i != tmp_channels.end(); ++i) {
			Mix_FadeOutChannel(*i, ticks);
		}
	}
	return 0;
}
开发者ID:piluke,项目名称:BasicEventEngine,代码行数:22,代码来源:sound.cpp


示例20: reposition_sound

void reposition_sound(int id, unsigned int distance)
{
	audio_lock lock;
	for (unsigned ch = 0; ch < channel_ids.size(); ++ch)
	{
		if (channel_ids[ch] != id) continue;
		if (distance >= DISTANCE_SILENT) {
			// Don't call Mix_FadeOutChannel if the channel's volume is set to
			// zero. It doesn't do anything in that case and the channel will
			// resume playing as soon as its volume is reset to a non-zero
			// value, which results in issues like sound sources deleted while
			// their volume is zero coming back to life and escaping Wesnoth's
			// sound source management code.
			if (Mix_Volume(ch, -1) == 0) {
				Mix_HaltChannel(ch);
			} else {
				Mix_FadeOutChannel(ch, 100);
			}
		} else {
			Mix_SetDistance(ch, distance);
		}
	}
}
开发者ID:aquileia,项目名称:wesnoth,代码行数:23,代码来源:sound.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ Mix_FadeOutMusic函数代码示例发布时间:2022-05-30
下一篇:
C++ Mix_FadeInMusic函数代码示例发布时间: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