Fade out music on scenario start and on disabling it
This commit is contained in:
parent
40bc508f7f
commit
d4e6d0bf2b
4 changed files with 25 additions and 11 deletions
|
@ -1,6 +1,7 @@
|
|||
Version 1.13.5+dev:
|
||||
* Music and sound effects:
|
||||
* Added a preference to pause the music when the game loses focus.
|
||||
* Now the storyscreen music fades out at the start of each scenario.
|
||||
* Units:
|
||||
* Changed the sound for the melee attack of the
|
||||
Loyalist Bowman, Orcish Crossbowman and Orcish Slurbow.
|
||||
|
|
|
@ -628,6 +628,7 @@
|
|||
[music]
|
||||
name={MUSIC}
|
||||
immediate=yes
|
||||
ms_after=2000
|
||||
[/music]
|
||||
[/event]
|
||||
#enddef
|
||||
|
@ -661,6 +662,7 @@
|
|||
name={SCENARIO_MUSIC}
|
||||
immediate=yes
|
||||
append=no
|
||||
ms_after=2000
|
||||
[/music]
|
||||
[/event]
|
||||
#enddef
|
||||
|
|
|
@ -5,15 +5,16 @@ changelog: https://github.com/wesnoth/wesnoth/blob/master/changelog
|
|||
Version 1.13.5+dev:
|
||||
* Music and sound effects:
|
||||
* Added a preference to pause the music when the game loses focus.
|
||||
* Now the storyscreen music fades out at the start of each scenario.
|
||||
* Units:
|
||||
* Changed the sound for the melee attack of the
|
||||
Loyalist Bowman, Orcish Crossbowman and Orcish Slurbow.
|
||||
* Performance:
|
||||
* When a heuristic determines that it's probably faster, the game predicts battle
|
||||
outcome by simulating a few thousand fights instead of calculating exact
|
||||
probabilities. This method is inexact, but in very complex battles (extremely
|
||||
high HP, drain, slow, berserk, etc.) it's significantly faster than the default
|
||||
damage calculation method.
|
||||
* When a heuristic determines that it's probably faster, the game predicts battle
|
||||
outcome by simulating a few thousand fights instead of calculating exact
|
||||
probabilities. This method is inexact, but in very complex battles (extremely
|
||||
high HP, drain, slow, berserk, etc.) it's significantly faster than the default
|
||||
damage calculation method.
|
||||
|
||||
Version 1.13.5:
|
||||
* Campaigns:
|
||||
|
|
|
@ -61,6 +61,7 @@ unsigned music_refresh_rate = 20;
|
|||
bool want_new_music = false;
|
||||
int fadingout_time=5000;
|
||||
bool no_fading = false;
|
||||
bool unload_music = false;
|
||||
|
||||
// number of allocated channels,
|
||||
const size_t n_of_channels = 32;
|
||||
|
@ -410,12 +411,8 @@ void reset_sound() {
|
|||
|
||||
void stop_music() {
|
||||
if(mix_ok) {
|
||||
Mix_HaltMusic();
|
||||
|
||||
std::map<std::string,Mix_Music*>::iterator i;
|
||||
for(i = music_cache.begin(); i != music_cache.end(); ++i)
|
||||
Mix_FreeMusic(i->second);
|
||||
music_cache.clear();
|
||||
Mix_FadeOutMusic(500);
|
||||
Mix_HookMusicFinished([](){ unload_music = true; });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -613,9 +610,22 @@ void music_thinker::process(events::pump_info &info) {
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
||||
music_muter::music_muter() :
|
||||
|
|
Loading…
Add table
Reference in a new issue