Esempio n. 1
0
File: audio.c Progetto: callaa/luola
void music_wait_stopped(void) {
#if HAVE_LIBSDL_MIXER
    while(Mix_FadingMusic()!=MIX_NO_FADING) {
        SDL_Delay(100);
    }
#endif
}
Esempio n. 2
0
void  PGE_MusPlayer::MUS_playMusicFadeIn(int ms)
{
    if(!isLoaded) return;
	if(play_mus)
    {
		if(Mix_PausedMusic()==0)
		{
			// Reset music sample count
			if (SDL_LockMutex(sampleCountMutex) == 0)
			{
				musSCount = 0;
				SDL_UnlockMutex(sampleCountMutex);
			}

			if(Mix_FadingMusic()!=MIX_FADING_IN)
				if(Mix_FadeInMusic(play_mus, -1, ms)==-1)
				{
                    PGE_MsgBox::warn(std::string(std::string("Mix_FadeInMusic:")+std::string(Mix_GetError())).c_str());
				}
		}
		else
			Mix_ResumeMusic();

    }
    else
    {
        PGE_MsgBox::warn(std::string(std::string("Play nothing:")+std::string(Mix_GetError())).c_str());
    }
}
Esempio n. 3
0
File: sound.c Progetto: wimh/instead
int snd_playing_mus(void)
{
	if (!sound_on)
		return 0;
	if (Mix_PlayingMusic() | Mix_FadingMusic())
		return 1;
	return 0;
}
Esempio n. 4
0
Mix_Fading cAudio :: Is_Music_Fading( void ) const
{
	if( !m_music_enabled || !m_initialised )
	{
		return MIX_NO_FADING;
	}

	return Mix_FadingMusic();
}
Esempio n. 5
0
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);
}
Esempio n. 6
0
void
audio_set_music_on_off (int on)
{
#ifdef USE_AUDIO
  if (!sound_supported) return;
    if (on) {
        if (Mix_PausedMusic()) Mix_ResumeMusic();
        else
        {
            while (Mix_FadingMusic() == MIX_FADING_OUT) SDL_Delay(100);
        }
        if (music[currentMus])
            Mix_FadeInMusic (music[currentMus], -1, 1000);
    }
    else {
        while (Mix_FadingMusic() == MIX_FADING_IN) SDL_Delay(100);
        Mix_FadeOutMusic (1000);
    }
    music_on = on;
#endif
}
Esempio n. 7
0
/* function: Mix_FadingMusic */
static int toluaI_sound_sound_is_fading_music00(lua_State* tolua_S)
{
 if (
 !tolua_isnoobj(tolua_S,1)
 )
 goto tolua_lerror;
 else
 {
 {
  s32b toluaI_ret = (s32b)  Mix_FadingMusic();
 tolua_pushnumber(tolua_S,(long)toluaI_ret);
 }
 }
 return 1;
tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'is_fading_music'.");
 return 0;
}
Esempio n. 8
0
void cMusicSDL2::Play(int _repeat, int fade){
	if(music != NULL){
		if(Mix_PlayingMusic() > 0){	//Music is already playing
			if(isPaused){
				Mix_ResumeMusic();
				isPaused = false;
				return;
			}else if(Mix_FadingMusic() == MIX_FADING_OUT){
				Mix_HaltMusic();
			}else{
				return;
			}
		}
		if(Mix_FadeInMusic(music, _repeat, fade) < 0){
			StormPrintLog(STORM_LOG_ERROR, "cMusicSDL2", "Error %s", Mix_GetError());
		}
	}
}
Esempio n. 9
0
void Mixer::playMusic( std::string name )
{
    if( soundList_.size() < 1 )
    {
        return;
    }

    AudioData* data = NULL;
    bool foundData = false;

    for ( size_t i = 0; i < soundList_.size(); ++i )
    {
    	if( soundList_[i]->friendlyname.compare( name ) == 0 )
    	{
    	    data = soundList_[i];

    	    // check if the data exists
    	    if( data->data_p == NULL ) return;
    	    foundData = true;
    	}
    }

    if( !foundData ) return;

    Mix_Music* music = (Mix_Music*)data->data_p;

    // check if there already is music playing
    // if this is the case, fade out & in
    // else just start playing
    // TODO: real crossfading needs implementation of a multi-channel music mixer
    if( Mix_PlayingMusic() )
    {
        Mix_FadeOutMusic( 500 );
        while( Mix_FadingMusic() ) {}
        Mix_FadeInMusic( music, -1, 500 );
    }
    else
    {
        Mix_PlayMusic( music, -1 );
    }

    lastPlayed = name;
}
Esempio n. 10
0
//----------------------------------------------------------------------------
void Audio::updateSettings( void)
{
    if (Mix_FadingMusic() != MIX_NO_FADING)
        return;

    bool oldPlayMusic = _playMusic;
    bool oldPlayDefaultSoundtrack = _playDefaultSoundtrack;

    ConfigS::instance()->getBoolean( "playMusic", _playMusic);
    ConfigS::instance()->getBoolean( "playDefaultSoundtrack",
        _playDefaultSoundtrack);

    if( (oldPlayMusic == _playMusic) &&
        (oldPlayDefaultSoundtrack == _playDefaultSoundtrack))
    {
        return;
    }

    startMusic();
}
Esempio n. 11
0
int cAudio :: isMusicFading( void )
{
	if( !bMusic || !bInitialised )
	{
		return 0;
	}

	Mix_Fading status = Mix_FadingMusic();

	if( status == MIX_NO_FADING )
	{
		return 0;
	}
	else if( status == MIX_FADING_IN )
	{
		return 1;
	}
	else if( status == MIX_FADING_OUT )
	{
		return 2;
	}

	return 0;
}
Esempio n. 12
0
bool PGE_MusPlayer::MUS_IsFading()
{
    if(!isLoaded) return false;
    return (Mix_FadingMusic()==1);
}
Esempio n. 13
0
void PGE_MusPlayer::MUS_stopMusicFadeOut(int ms)
{
    if(!isLoaded) return;
	if(Mix_FadingMusic()!=MIX_FADING_OUT)
		Mix_FadeOutMusic(ms);
}
Esempio n. 14
0
static mrb_value
mrb_sdl2_mixer_fading_music(mrb_state *mrb, mrb_value self)
{
  return mrb_fixnum_value(Mix_FadingMusic());
}
Esempio n. 15
0
int32_t MUSIC_FadeActive(void)
{
    return((Mix_FadingMusic() == MIX_FADING_OUT) ? TRUE : FALSE);
} // MUSIC_FadeActive
Esempio n. 16
0
bool Music::isFadingIn()
{
	return (Mix_FadingMusic() == MIX_FADING_IN);
}
Esempio n. 17
0
VALUE MSPhysics::Music::is_fading(VALUE self) {
	return Mix_FadingMusic() != MIX_NO_FADING ? Qtrue : Qfalse;
}
Esempio n. 18
0
		bool Music::IsFadingIn()
		{
			return Mix_FadingMusic() == MIX_FADING_IN;
		}
Esempio n. 19
0
		bool Music::IsFadingOut()
		{
			return Mix_FadingMusic() == MIX_FADING_OUT;
		}
Esempio n. 20
0
bool Music::isFadingOut()
{
	return (Mix_FadingMusic() == MIX_FADING_OUT);
}
Esempio n. 21
0
bool AudioHandler<AudioType::Music>::FadedOut() {
	const auto k_fading = (Mix_FadingMusic() == MIX_FADING_OUT);
	const auto k_playing = (Mix_PlayingMusic() == 1);
	return !k_fading && !k_playing;
}