Author: sapient
Date: Sun Mar 2 06:50:44 2008
New Revision: 24195
URL: http://svn.gna.org/viewcvs/wesnoth?rev=24195&view=rev
Log:
fix bug #11187 play_once=yes and fix musical cross-fading from patch #797
Modified:
trunk/changelog
trunk/src/sound.cpp
Modified: trunk/changelog
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=24195&r1=24194&r2=24195&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Sun Mar 2 06:50:44 2008
@@ -44,6 +44,7 @@
wml_exception was thrown (bug #10926).
* truncate names in the load dialog utf8 aware, might be related to
bug #11186
+ * fix bug #11187 play_once=yes and fix musical cross-fading
Version 1.3.19:
* map editor:
Modified: trunk/src/sound.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/sound.cpp?rev=24195&r1=24194&r2=24195&view=diff
==============================================================================
--- trunk/src/sound.cpp (original)
+++ trunk/src/sound.cpp Sun Mar 2 06:50:44 2008
@@ -503,6 +503,7 @@
void play_music()
{
+ music_start_time = 1; //immediate (same as effect as SDL_GetTicks())
want_new_music=true;
no_fading=false;
fadingout_time=current_track.ms_after;
@@ -510,7 +511,7 @@
void play_new_music()
{
- music_start_time = 0;
+ music_start_time = 0; //reset status: no start time
want_new_music=true;
if(!preferences::music_on() || !mix_ok || current_track.name.empty())
return;
@@ -533,21 +534,18 @@
itor =
music_cache.insert(std::pair<std::string,Mix_Music*>(current_track.name,music)).first;
last_track=current_track;
}
- if(!Mix_PlayingMusic())
+ LOG_AUDIO << "Playing track '" << current_track.name << "'\n";
+ int fading_time=current_track.ms_before;
+ if(no_fading)
{
- LOG_AUDIO << "Playing track '" << current_track.name << "'\n";
- int fading_time=current_track.ms_before;
- if(no_fading)
- {
- fading_time=0;
- }
- const int res = Mix_FadeInMusic(itor->second, 1, fading_time);
- if(res < 0)
- {
- ERR_AUDIO << "Could not play music: " << Mix_GetError()
<< " " << current_track.name <<" \n";
- }
- want_new_music=false;
- }
+ fading_time=0;
+ }
+ const int res = Mix_FadeInMusic(itor->second, 1, fading_time);
+ if(res < 0)
+ {
+ ERR_AUDIO << "Could not play music: " << Mix_GetError() << " "
<< current_track.name <<" \n";
+ }
+ want_new_music=false;
}
void play_music_repeatedly(const std::string &name)
@@ -719,8 +717,7 @@
return false;
}
channel_ids[channel] = id;
- if(group != SOUND_UI)
- Mix_SetDistance(channel,distance);
+ Mix_SetDistance(channel, distance);
sound_cache_chunk temp_chunk(file); // search the sound cache on this
key
it_bgn = sound_cache.begin(), it_end = sound_cache.end();
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits