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


C++ Mix_FadeOutMusic函数代码示例

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


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


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