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

C++ Mix_FadeOutMusic函数代码示例

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

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



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

示例1: Mix_HookMusicFinished

void SDLSound::stopMusic()
{
    // nicely fade the music out for 1 second
    if(Mix_PlayingMusic()) {
        Mix_HookMusicFinished(0);
        Mix_FadeOutMusic(500);
    }
}
开发者ID:BackupTheBerlios,项目名称:netpanzer-svn,代码行数:8,代码来源:SDLSound.cpp


示例2: Mix_FadeOutMusic

//----------------------------------------------------------------------------
void Audio::turnMusicOff( void)
{
    if (_isPlaying)
    {
        Mix_FadeOutMusic(0);
        _isPlaying = false;
    }
}
开发者ID:BackupTheBerlios,项目名称:sotu-svn,代码行数:9,代码来源:Audio.cpp


示例3: music_stop

void music_stop (void)
{
#if HAVE_LIBSDL_MIXER
    if (!playlist || game_settings.music == 0)
        return;
    Mix_FadeOutMusic (500);
#endif
}
开发者ID:callaa,项目名称:luola,代码行数:8,代码来源:audio.c


示例4: game_titlescreen

void game_titlescreen()
{
    gamestate_over = true;
    gamestate_pause = false;
    gamestate_title = true;
    game_setstatustext("",0);
    Mix_FadeOutMusic(sound_fadetime);
    Mix_HaltChannel(-1);
}
开发者ID:dorkster,项目名称:espada,代码行数:9,代码来源:main.c


示例5: quitProgram

void quitProgram(int returnValue)
{
#ifdef SOUND_ENABLED
  Mix_FadeOutMusic(700);
#endif
  if(unpacked)
  {
    logString("Quitting\n");
    remove("textures/CRYSTAL.BMP");
    remove("textures/FLY.BMP");
    remove("textures/JOHN.BMP");
    remove("textures/MARS1.BMP");
    remove("textures/MARS2.BMP");
    remove("textures/METAL.BMP");
    remove("textures/MOON1.BMP");
    remove("textures/MOON2.BMP");
    remove("textures/SAND.BMP");
    remove("textures/STEIN1.BMP");
    remove("textures/STEIN.BMP");
    remove("textures/STONE53.BMP");
    remove("textures/STONE54.BMP");
    remove("sounds/bg.ogg");
    remove("sounds/boom.wav");
    remove("sounds/crystal.wav");
    remove("sounds/fanfare.wav");
    remove("gfx/font.bmp");
    remove("gfx/particle.bmp");
    remove("gfx/loading.bmp");
    remove("textures");
    remove("sounds");
    remove("gfx");
  }
  
  hiScores = fopen(hsFName, "w");
  if (!hiScores)
    fprintf(stderr, "Couldn't write Hall of Fame\n");
  else
  {
    int i;
    for(i=0; i<10; i++)
    {
      fprintf(hiScores, "%s = %d %d %d\n",
        scores[i].Name, scores[i].mins, scores[i].secs, scores[i].dsec);
    }
    fclose(hiScores);
  }
  
  free(camBase);
  free(shipBase);
#ifdef SOUND_ENABLED
  while(Mix_FadingMusic() == MIX_FADING_OUT){};
#endif
  SDL_Quit();
  if(!debug && unpacked)
    fclose(logfile);
  exit(returnValue);
}
开发者ID:torarvid,项目名称:crystal-quest-3d,代码行数:57,代码来源:common.cpp


示例6: while

void SDLInteraction::StopMusic()
{
    if (music != NULL) {
        // fade out music to finish 0,5 seconds from now
        while(!Mix_FadeOutMusic(1000) && Mix_PlayingMusic()) {
            SDL_Delay(100);
        }
    }
}
开发者ID:hkardes,项目名称:hedgewars-accessible,代码行数:9,代码来源:SDLs.cpp


示例7: 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


示例8: while

bool ModuleStartScreen::CleanUp()
{
	play = false;
	App->textures->Unload(graphics);
	while (!Mix_FadeOutMusic(1000) && Mix_PlayingMusic())
		SDL_Delay(1000);

	return true;
}
开发者ID:carcasanchez,项目名称:Puzzle-Bobble,代码行数:9,代码来源:ModuleStartScreen.cpp


示例9: snd_stop_mus

void snd_stop_mus(int ms)
{
	if (!sound_on)
		return;
	Mix_HookMusicFinished(NULL);
	if (ms)
		Mix_FadeOutMusic(ms);
	else
		Mix_HaltMusic();
}
开发者ID:wimh,项目名称:instead,代码行数:10,代码来源:sound.c


示例10: Mix_FadeOutMusic

bool MusicEntry::stop(int fade_ms)
{
	if (Mix_PlayingMusic())
	{
        logGlobal->traceStream()<<"Stoping music file "<<currentName;
		loop = 0;
		Mix_FadeOutMusic(fade_ms);
		return true;
	}
	return false;
}
开发者ID:COJIDAT,项目名称:vcmi-ios,代码行数:11,代码来源:CMusicHandler.cpp


示例11: LOG

// Load assets
bool ModuleWelcome::CleanUp()
{
	LOG("Unloading honda stage");
	App->textures->Unload(graphics);
	App->textures->Unload(graphics_2);
	App->textures->Unload(graphics_Balls);
	while (!Mix_FadeOutMusic(1000) && Mix_PlayingMusic())
		SDL_Delay(1000);

	return true;
}
开发者ID:tomaticgang,项目名称:Ms-Pac-Man,代码行数:12,代码来源:ModuleWelcome.cpp


示例12: Mix_LoadMUS

//BackGroundMusic, volume = between [0 - 128], 64 = neutral
void SoundBank::PlayBGM(SoundBgmType type, int volume) {
	Mix_Music* tempMusic = Mix_LoadMUS(bgmPathList.at(type));
	if (!Mix_PlayingMusic()) { //there is no music playing yet
		Mix_FadeInMusic(Mix_LoadMUS(bgmPathList.at(type)), -1, 1000);
		Mix_VolumeMusic(volume);
	}
	else if(!Mix_PausedMusic()) { //there is already music playing
		Mix_FadeOutMusic(1000);
		Mix_FadeInMusic(Mix_LoadMUS(bgmPathList.at(type)), -1, 1000);
		Mix_VolumeMusic(volume);
	}
}
开发者ID:mjowned,项目名称:GameDev,代码行数:13,代码来源:SoundBank.cpp


示例13: Mix_FadeOutMusic

void
AudioSDLMixer::stopMusic() 
{
  if( Mix_PlayingMusic() ) {
    Mix_FadeOutMusic(1500);
    SDL_Delay(1500);
  }
  if ( music ) {
    Mix_FreeMusic(music);
    music = NULL;
  }
}
开发者ID:BackupTheBerlios,项目名称:egachine,代码行数:12,代码来源:audiosdlmixer.cpp


示例14: 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


示例15: Mix_FadeOutMusic

// Play a music file
bool j1Audio::PlayMusic(const char* path, float fade_time)
{
	bool ret = true;

	if (!enabled)
		return false;

	if(music != NULL)
	{
		if(fade_time > 0.0f)
		{
			Mix_FadeOutMusic(int(fade_time * 1000.0f));
		}
		else
		{
			Mix_HaltMusic();
		}

		// this call blocks until fade out is done
		Mix_FreeMusic(music);
	}

	music = Mix_LoadMUS_RW(App->fs->Load(path), 1);

	if(music == NULL)
	{
		LOG("Cannot load music %s. Mix_GetError(): %s\n", path, Mix_GetError());
		ret = false;
	}
	else
	{
		if(fade_time > 0.0f)
		{
			if(Mix_FadeInMusic(music, -1, (int) (fade_time * 1000.0f)) < 0)
			{
				LOG("Cannot fade in music %s. Mix_GetError(): %s", path, Mix_GetError());
				ret = false;
			}
		}
		else
		{
			if(Mix_PlayMusic(music, -1) < 0)
			{
				LOG("Cannot play in music %s. Mix_GetError(): %s", path, Mix_GetError());
				ret = false;
			}
		}
	}

	LOG("Successfully playing %s", path);
	return ret;
}
开发者ID:markitus18,项目名称:Development,代码行数:53,代码来源:j1Audio.cpp


示例16: music_stop_fade

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


示例17: Mix_FadeOutMusic

bool j1Audio::PlayMusic(SDL_RWops* _music, const char* path, float fade_time)
{
	bool ret = true;

	if (_music != NULL)
	{
		if (fade_time > 0.0f)
		{
			Mix_FadeOutMusic(int(fade_time * 1000.0f));
		}
		else
		{
			Mix_HaltMusic();
		}

		// this call blocks until fade out is done

	}

	music = Load_music(_music);


	if (music == NULL)
	{
		LOG("Cannot load music %s. Mix_GetError(): %s\n", path, Mix_GetError());
		ret = false;
	}
	else
	{
		if (!fade_time > 0.0f)
		{
			if (Mix_FadeInMusic(music, -1, 10000) < 0)
			{
				LOG("Cannot fade in music %s. Mix_GetError(): %s", path, Mix_GetError());
				ret = false;
			}

		}
		else
		{
			if (Mix_PlayMusic(music, -1) < 0)
			{
				LOG("Cannot play in music %s. Mix_GetError(): %s", path, Mix_GetError());
				ret = false;
			}
		}
	}

	LOG("Successfully playing %s", path);
	return ret;
}
开发者ID:weprikjm,项目名称:DEV_MY_ENGINE,代码行数:51,代码来源:j1Audio.cpp


示例18: main

int main(int argc,char *argv[])
{
if ( SDL_Init(SDL_INIT_AUDIO) < 0 ) {
    fprintf(stderr, "Problem: %s\n", SDL_GetError());
    exit(1); 
}
atexit(SDL_Quit);

//frekvence 22050 Hz
//MIX_DEFAULT_FORMAT - Signed 16-bit zvuky, v systemovem bytovem poradi (little,big endian)
//mono-stereo: pro mono vlozte 1, pro stereo 2

if (Mix_OpenAudio(22050/*frekvence [Hz]*/, MIX_DEFAULT_FORMAT, 2/*mono-stereo*/,1024/*velikost bloku*/)==-1)
{
    fprintf(stderr,"Mix_OpenAudio: %s\n", Mix_GetError());
    exit(1);
}

 sounds[SND_ZVUK] = Mix_LoadWAV("zvuk.wav");
if (sounds[SND_ZVUK]==NULL) 
{
    fprintf(stderr,"zvuk [zvuk.wav] nebyl nahran\n");exit(2);}

 //kanal: -1 pro prvni volny kanal
//pocet opakovani x: zvuk se bude opakovat x+1 krat,x=-1 pro stale opakovani.
Mix_PlayChannel(-1/*kanal*/,sounds[SND_ZVUK]/*Mix_Chunk*/,0/*pocet opakovani*/);

 music=Mix_LoadMUS("music.mp3");
if (!music) {
    printf("Mix_LoadMUS(\"music.mp3\"): %s\n", Mix_GetError());
    exit(2);
}

//pocet opakovani x: hudba se bude opakovat x krat,x=-1 pro stale opakovani.
//postupne zvysuje hlasitost hudby od 0 do 100% za 2000 ms po spusteni

Mix_FadeInMusic(music, -1/*pocet opakovani*/,2000 /*cas[ms]*/);

//lze i jen provest pouhe spusteni hudby
//Mix_PlayMusic(music, -1/*pocet opakovani*/);

SDL_Delay(5000);

 //ztlumi hudbu az do ticha a vypne
Mix_FadeOutMusic(2000);

SDL_Delay(1000);

Mix_CloseAudio();
return 0;
}
开发者ID:Harvie,项目名称:Programs,代码行数:51,代码来源:main.c


示例19: 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


示例20: BGM_Stop

void SdlAudio::BGM_Fade(int fade) {
#ifdef _WIN32
	// FIXME: Because of design change in Vista and higher reducing Midi volume
	// alters volume of whole application and mutes it forever when restarted.
	// Fading out midi music was disabled for Windows.
	if (Mix_GetMusicType(bgm.get()) == MUS_MID &&
		WindowsUtils::GetWindowsVersion() >= 6) {
		BGM_Stop();
		return;
	}
#endif
	Mix_FadeOutMusic(fade);
	me_stopped_bgm = false;
}
开发者ID:gadesx,项目名称:Player,代码行数:14,代码来源:sdl_audio.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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