When using FSOUND_stream_GetLengthMS to get the length of a track, the returned time is often incorrect. The incorrect time is always the same for any given track.
I tried to investigate further by using FSOUND_Sample_GetLength on the pointer returned by a call to FSOUND_Stream_GetSample, but the answer is always 17640 no matter what track is playing, although the frequency returned by a call to FSOUND_Sample_GetDefaults is correct.
- Phil asked 15 years ago
Unfortunately the MPEGACCURATE flag can’t be used as it makes the tracks too slow to load.
Also, I don’t think it will correct an error where the returned time is just over 7 times the correct time. This is not a rare occurance either.
I know that the data it there somewhere because Winamp manages to get it correctly when it makes up its playlist.
I’m not sure what win amp does, but the files certainly have some extra data that allows winamp to get artist/album/name data.
They were ripped with the latest version of CDex.
Whatever, it seems strange that from a single CD, most tracks are accurate to the second, but a few are out by a factor of 7 e.g. a 30 second track returns a time of around 3 mins 30 seconds.
That’s completely true. However mp3 is a very bad format: no global header, only sync headers that may mix mpeg1, mpeg2, layer1, layer2 and layer3 in the same file! And every format (mpeg1 or mpeg2) and every layer (1,2,3) have their own bitrate table… a real confusion!!!
[quote="Phil":3kaxe21k]I’m not sure what win amp does, but the files certainly have some extra data that allows winamp to get artist/album/name data.[/quote:3kaxe21k]
The “extra data” in the MP3 file is the ID3 tag. As Brett said, this is not actually part of the MPEG specification. ID3 information is also totally optional and is not required to be accurate. Now FMOD could include processing the ID3 tag, but what would a sound API need with a lifetime supply of chocolate? 😉
I understand all that, but as I said, it seems that FMod can get the time accurate to the second in around 90% of cases, and when it’s out it’s out by a factor of about seven.
Now, if you simply divided the MP3 file size by a fixed factor you would never be that far out with any normal music track.
All these files are ripped by the same program, at the same time, and yet most are very accurate, and a few wildly out.
It’s not a big deal, I’ve already worked around the problem, it’s just rather interesting.
What do you suppose FMOD does to get the very accurate time at the very start of playing a streamed track? That is to say, in my program, as soon as the sound starts to play it displays the returned value from GetLengthMS, and in most cases that time is accurate to the second.
Please login first to submit.