| Summary: | Mix_PlayMusic() can't start playing when previously music was paused and re-opened | ||
|---|---|---|---|
| Product: | SDL_mixer | Reporter: | Vitaly Novichkov <admin> |
| Component: | misc | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | sezeroz |
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | All | ||
|
Description
Vitaly Novichkov
2018-07-13 20:05:02 UTC
That patch seems wrong because it doesn't honor retval.
Correct one should be either this (always setting music_active):
diff --git a/music.c b/music.c
--- a/music.c
+++ b/music.c
@@ -761,6 +761,7 @@ int Mix_FadeInMusicPos(Mix_Music *music,
retval = music_internal_play(music, loops, position);
Mix_UnlockAudio();
+ music_active = (retval == 0);
return(retval);
}
int Mix_FadeInMusic(Mix_Music *music, int loops, int ms)
... or this (only setting to true if no error):
diff --git a/music.c b/music.c
--- a/music.c
+++ b/music.c
@@ -760,6 +760,9 @@ int Mix_FadeInMusicPos(Mix_Music *music,
}
retval = music_internal_play(music, loops, position);
Mix_UnlockAudio();
+ if (retval == 0) {
+ music_active = SDL_TRUE;
+ }
return(retval);
}
Can't decide which is better for now.
I think the first choice (always setting music_active to something) is correct, because music_internal_play() halts the existing music anyway. Correct? Applied this patch: https://hg.libsdl.org/SDL_mixer/rev/671a669e1065 Closing as fixed. Note though, this doesn't take into account the issue noted in https://bugzilla.libsdl.org/show_bug.cgi?id=4221 . |