Consider the following case.
I have two mp3 files that I load with Mix_LoadMUS
, therefore obtaining two instances of Mix_Music *
. Let's call them m1
and m2
.
I play the first track for a while using Mix_PlayMusic
:
Mix_PlayMusic(m1, -1);
Then I (let me say) replace the first track with the second one using the second command:
Mix_PlayMusic(m2, -1);
Note: I don't free m1
because I want to use it again in future.
After a while, I decide to play again m1
, using exactly the same command shown above.
Here it is the problem.
When I play m1
the second time, I expect it starts from 0 as from the documentation:
Play the loaded music loop times through from start to finish.
Well, it does it. Almost. The problem is that a few milliseconds of the track immediately following the point it was when I stopped it are played for an unknown reason. Then it starts to reproduce the music from the start and that's all.
Am I doing something wrong? It looks like reusing an already existent Mix_Music
doesn't work properly.
I mean, it seems that what's in the buffer when the music is stopped is still there and thus is played when I run Mix_PlayMusic
the second time. Is this the intended behavior, a bug or something I'm just missing?
As a side note, it works as expected if I free m1
when m2
is played, then I load it again later.