I have a problem with FMOD_Sound_GetLength… the duration returned in milliseconds is completely wrong, with any midifile I use…
However the duration is well returned by Windows Media Player and Quicktime Player…
I have an example here, a midifile which returns a duration of 630182 ms (11:30.18 / 11 minutes, 30 seconds, 18 cents of seconds), even with FMOD_ACCURATETIME instead of 2 min 15 sec.
quicktime or windows mediaplayer report the file as having a duration of : 2 minutes 15 seconds…which is the proper duration.
here is how the CreateSoundEx is created…
result = FMOD_System_CreateSoundEx(system, App.Path & "\mid\test.mid", (FMOD_2D Or FMOD_HARDWARE Or FMOD_CREATESTREAM Or FMOD_ACCURATETIME), createsoundexinfo, Sound)
when i press play, I check the total length of the midifile using FMOD_Sound_GetLength to obtain into a Long the length of the midifile in milliseconds (lenms)
result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, Sound, 0, channel) ERRCHECK (result)
when i try to get the correct midifile length
result = FMOD_Sound_GetLength(Sound, lenms, FMOD_TIMEUNIT_MS) info.Caption = CStr(lenms)
I have always a wrong value… the problem is that I need GetLength to return a proper and Real value to handle a progressbar/slider…
Any help would be appreciated…
Thanks in advance.
- mumbly asked 7 years ago
49 days is what you get if the length was -1 (undetermined) and you treat as unsigned (converting from milliseconds to days). Are you using FMOD_ACCURATETIME?
For MIDI files, we calculate the time by scanning the file until the last track ends taking into account any tempo changes along the way. This has been quite accurate in our tests for quite some time.
I haven’t looked at the MIDI in question but I would expect there is something abnormal with it, especially since re-saving it fixes the issue.
Here it is :
Thanks for your help…
- mumbly answered 7 years ago
I get a length of 630467 ms here as well. c++
I confirm this bug. the sound plays the music then silence for an eternity.
There must be something wierd in it.
Meanwhile, get Anvil Studio, load your file and "save as" it. that fixes it.
I have compared sound tracks with what WinAmp reports, and what fmod sound.GetLength reports.
//"E:/Music/MP3/UNSORTED/Hermes Houseband – I Will Survive.mp3" <– Song length according to WinAmp 6:32 | 6:54 according to fMOD
//"E:/Music/MP3/N/Navoo/MP3/John Whistler-Im in Love.mp3" <– Song length according to WinAmp 3:32 | 3:52 according to fMOD
//"E:/Music/Modules/necro.mod" <– Song length according to WinAmp 2:00 | 49,7 DAYS according to fMOD
//"E:/Music/Modules/cc-catch – omf-fall3.mtm" <– Not Suported file format in fMOD.
Notice the module… almost 50 days 😮
Oh.. this is in C#
Edit: I do know that modules have this "jump to page 32 -then loop 45 times" tingy. But I cannot remember if this is true with the necro.mod (Necroscope from way back in 1990). 😀
Just tried with a mod I made in 94 where I know theres no jumping…
//"E:/Music/Modules/rock.mod" <– Song length according to WinAmp 0:28 | 49,7 DAYS according to fMOD
- Crinos answered 7 years ago
Please login first to submit.