| Summary: | Mix_PlayMusic broken logic when loop > 1 | ||
|---|---|---|---|
| Product: | SDL_mixer | Reporter: | Peter Kosyh <gl00my> |
| Component: | misc | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | major | ||
| Priority: | P2 | CC: | sezeroz |
| Version: | 2.0.0 | ||
| Hardware: | All | ||
| OS: | All | ||
This is fixed in the latest version of SDL and SDL_mixer available in Mercurial: http://hg.libsdl.org/ Thanks! In SDL-1.2 branch, I backported 2.0 commit bd8389c6dd as: https://hg.libsdl.org/SDL_mixer/rev/b57842dc6349 ... and then applied the fix suggested by Peter Kosyh as: https://hg.libsdl.org/SDL_mixer/rev/c606c85c8863 |
Hello! This code in Mix_FadeInMusicPos ---------- if (loops == 1) { /* Loop is the number of times to play the audio */ loops = 0; } ----------- and music_halt_or_loop: ----------- if (music_loops) { Mix_Fading current_fade; if (music_loops > 0) { --music_loops; } current_fade = music_playing->fading; music_internal_play(music_playing, 0.0); music_playing->fading = current_fade; } ----------- makes loop parameter very strange. Mix_PlayMusic(x, 1) -> will play 1 time Mix_PlayMusic(x, 2) -> will play 3 time Mix_PlayMusic(x, n) -> will play n+1 time Can you tell me if it is bug or i will make workaround in my application? May be right fix would be: if (loops > 0) { /* Loop is the number of times to play the audio */ loops = loops - 1; } WBR, Peter Kosyh