Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Biohazard90

Pages: [1]
1
Audio / MP3 looping issues
« on: September 26, 2022, 09:22:38 pm »
Hi, I have encountered two different issues when looping mp3 files with minimp3 included by SFML through an sf::Music object. At least one of these issues is rooted in minimp3, the other I'm not sure because I don't know the nitty-gritty details of the mp3 format.

The first issue occurs after looping for the first time, the internal file offset in minimp3 becomes incorrect when SFML seeks the file to zero, I have provided a test file and proposed a fix in minimp3 here on github: https://github.com/lieff/minimp3/issues/101

To reproduce this issue, loop the file with an sf::Music object and wait for the second time it plays to reach the end, now it will stop instead of looping again.

The second issue is similar. minimp3 does not reach the expected end of the file and stops short of it, in turn SFML does not loop the file and just stops playing music. But in this case I'm not sure if the issue is fundamentally in minimp3 or SFML. From what I can tell, the expected sample count in minimp3 is higher than the data that is truly available, leading to it never reaching the end. I have attached a file that exhibits this issue on github as well: https://github.com/lieff/minimp3/issues/101#issuecomment-1258468004

To reproduce this second issue, loop the second file with an sf::Music object and it will already fail looping the first time.

I believe I managed to fix the first issue, but I'm not sure how to go about solving the second issue. Learning the mp3 format to correct the expected sample count may be daunting or might even require decoding the entire file before being able to know the correct count, so changing the looping logic in SFML to not compare with the expected number of samples may be simpler/more efficient. The issue may also be something else entirely though.

Pages: [1]
anything