andelf / rust-sdl2_mixer

Rust bindings for sdl2_mixer
Apache License 2.0
13 stars 17 forks source link

Can not loop music 2 times #17

Open bvssvni opened 9 years ago

bvssvni commented 9 years ago

https://github.com/andelf/rust-sdl2_mixer/blob/324fdbb457556fbcd3417a7def9e5d20072beab0/src/sdl2_mixer/lib.rs#L641

For loops set to 0 and 1, it plays through once and stops, but for 2 it plays 3 times through.

MarkDDR commented 8 years ago

I can confirm your problem and I have discovered why this happens! What usually should happen is if loops = 1 it should play the music 2 times (1 loop). The code we currently have works just fine. As it turns out, some bozo added this to the C SDL_mixer library in the Mix_FadeInMusicPos(...) (which is what Mix_PlayMusic(...) calls).

    if (loops == 1) {
        /* Loop is the number of times to play the audio */
        loops = 0;
    }

Long story short, this is an upstream bug, not ours.

MarkDDR commented 8 years ago

https://bugzilla.libsdl.org/show_bug.cgi?id=2706

It seems they have it in their bug tracker already but nothing has really happened in it for some reason.