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; } }
//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()); } } }
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(); } } }
//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()); } }