예제 #1
0
파일: sound.cpp 프로젝트: aquileia/wesnoth
void music_thinker::process(events::pump_info &info) {
	if(preferences::music_on()) {
		if(!music_start_time && !current_track_list.empty() && !Mix_PlayingMusic()) {
			// Pick next track, add ending time to its start time.
			current_track = choose_track();
			music_start_time = info.ticks();
			no_fading=true;
			fadingout_time=0;
		}

		if(music_start_time && info.ticks(&music_refresh, music_refresh_rate) >= music_start_time - fadingout_time) {
			want_new_music=true;
		}

		if(want_new_music) {
			if(Mix_PlayingMusic()) {
				Mix_FadeOutMusic(fadingout_time);
			}

			unload_music = false;
			play_new_music();
		}
	}

	if (unload_music) {
		for (auto track : music_cache) {
			Mix_FreeMusic(track.second);
		}
		music_cache.clear();

		Mix_HookMusicFinished(nullptr);

		unload_music = false;
	}
}
예제 #2
0
//make sure we think about countdown even while dialogs are open
void playmp_controller::process(events::pump_info &info) {
	if(playmp_controller::counting_down()) {
		if(info.ticks(&timer_refresh, timer_refresh_rate)) {
			playmp_controller::think_about_countdown(info.ticks());
		}
	}
}
예제 #3
0
파일: sound.cpp 프로젝트: dailin/wesnoth
void music_thinker::process(events::pump_info &info) {
	if(preferences::music_on()) {
		if(!music_start_time && !current_track_list.empty() && !Mix_PlayingMusic()) {
			// Pick next track, add ending time to its start time.
			current_track = choose_track();
			music_start_time = info.ticks();
			no_fading=true;
			fadingout_time=0;
		}

		if(music_start_time && info.ticks(&music_refresh, music_refresh_rate) >= music_start_time - fadingout_time) {
			want_new_music=true;
		}

		if(want_new_music) {
			if(Mix_PlayingMusic()) {
				Mix_FadeOutMusic(fadingout_time);
			}
			play_new_music();
		}
	}
}
예제 #4
0
//make sure we think about countdown even while dialogs are open
void countdown_clock::process(events::pump_info &info)
{
	if(info.ticks(&timer_refresh, timer_refresh_rate)) {
		update(info.ticks());
	}
}